feat(*): refactor dynamic vs. static structure and distinctions; make additional elements dynamic

This commit is contained in:
Cory Dransfeldt 2025-06-13 16:31:36 -07:00
parent 7a0b808f24
commit b1309908e5
No known key found for this signature in database
126 changed files with 983 additions and 955 deletions

View file

@ -1,7 +0,0 @@
<script type="module" src="/assets/scripts/components/now-playing.js?v={% appVersion %}"></script>
<p class="{{ section }}">
<mark>Now playing</mark>&puncsp;
<now-playing>
<span class="content">{{ nowPlaying }}</span>
</now-playing>
</p>

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../server/utils/init.php";
require __DIR__ . "/../../../vendor/autoload.php";
require __DIR__ . "/../../../config/dynamic/init.php";
use App\Classes\ArtistFetcher;

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../server/utils/init.php";
require __DIR__ . "/../../../vendor/autoload.php";
require __DIR__ . "/../../../config/dynamic/init.php";
use App\Classes\BookFetcher;

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../server/utils/init.php";
require __DIR__ . "/../../../vendor/autoload.php";
require __DIR__ . "/../../../config/dynamic/init.php";
use App\Classes\GenreFetcher;

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../server/utils/init.php";
require __DIR__ . "/../../../vendor/autoload.php";
require __DIR__ . "/../../../config/dynamic/init.php";
use App\Classes\MovieFetcher;

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../server/utils/init.php";
require __DIR__ . "/../../../vendor/autoload.php";
require __DIR__ . "/../../../config/dynamic/init.php";
use App\Classes\ShowFetcher;

View file

@ -1,7 +1,7 @@
<?php
require __DIR__ . "/../vendor/autoload.php";
require __DIR__ . "/../server/utils/init.php";
require __DIR__ . "/../../vendor/autoload.php";
require __DIR__ . "/../../config/dynamic/init.php";
use App\Classes\TagFetcher;
use App\Classes\GlobalsFetcher;

View file

@ -0,0 +1,15 @@
<?php
use App\Classes\LatestListenHandler;
$handler = new LatestListenHandler();
$data = $handler->getLatestListen();
if (!empty($data['content'])):
?>
<p class="now-playing">
<mark>Now playing</mark>&puncsp;
<span class="content"><?= $data['content'] ?></span>
</p>
<?php endif; ?>

View file

@ -0,0 +1,15 @@
<?php
use App\Classes\RecentMediaHandler;
$handler = new RecentMediaHandler();
$media = $handler->getRecentMedia();
if (!empty($media['recentMusic'])) echo renderMediaGrid($media['recentMusic'], 0, 'eager');
if (!empty($media['recentWatchedRead'])) echo renderMediaGrid($media['recentWatchedRead'], 0, 'eager');
?>
{% render "static/blocks/banners/rss.liquid",
url:"/feeds",
text:"Subscribe to my posts, movies, books, links or activity feed(s)"
%}

View file

@ -0,0 +1,41 @@
<?php if (!empty($music['recent_tracks'])): ?>
<div class="music-chart">
<?php foreach (array_slice($music['recent_tracks'], 0, 10) as $item): ?>
<?php $chart = $item['chart'] ?? []; ?>
<div class="chart-item">
<div class="meta">
<a href="<?= htmlspecialchars($chart['url'] ?? '#') ?>">
<img
srcset="
<?= htmlspecialchars($chart['image']) ?>?class=w50&type=webp 50w,
<?= htmlspecialchars($chart['image']) ?>?class=w100&type=webp 100w
"
sizes="(max-width: 450px) 50px, 100px"
src="<?= htmlspecialchars($chart['image']) ?>?class=w50&type=webp"
alt="<?= htmlspecialchars($chart['alt'] ?? '') ?>"
loading="lazy"
decoding="async"
width="64"
height="64"
>
</a>
<div class="meta-text">
<a class="title" href="<?= htmlspecialchars($chart['url'] ?? '#') ?>">
<?= htmlspecialchars($chart['title'] ?? '') ?>
</a>
<span class="subheader"><?= htmlspecialchars($chart['subtext'] ?? '') ?></span>
</div>
</div>
<?php if (!empty($chart['played_at'])): ?>
<?php
$timestamp = (int) $chart['played_at'];
$playedAt = (new DateTime("@$timestamp"))->setTimezone(new DateTimeZone('America/Los_Angeles'));
?>
<time datetime="<?= $playedAt->format('c') ?>">
<?= $playedAt->format('F j, g:ia') ?>
</time>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>

View file

@ -1,15 +0,0 @@
{% render "media/grid.liquid",
globals:globals,
data:media.recentMusic,
loading:"eager"
%}
{% render "media/grid.liquid",
globals:globals,
data:media.recentWatchedRead,
shape:"vertical",
loading:"eager"
%}
{% render "blocks/banners/rss.liquid",
url:"/feeds",
text:"Subscribe to my posts, movies, books, links or activity feed(s)"
%}

View file

@ -1,22 +0,0 @@
{%- assign updateTime = "" -%}
{%- if updated == "now" -%}
{%- assign updateTime = "now" | date:"%B %-d, %l:%M %P", "America/Los_Angeles" -%}
{%- elsif pageUpdated -%}
{%- assign updateTime = page.updated | date:"%B %-d, %l:%M %P", "America/Los_Angeles" -%}
{%- endif -%}
<footer>
{%- if updateTime -%}
<p class="updated"><em>This page was last updated on {{ updateTime | strip }}.</em></p>
{%- endif -%}
{% render "nav/menu.liquid",
page:page,
nav:nav.footer_icons
class:"social"
%}
{% render "nav/menu.liquid",
page:page,
nav:nav.footer_text
class:"sub-pages"
separator:true
%}
</footer>

View file

@ -1,30 +0,0 @@
<div class="music-chart">
{%- for item in data limit:10 -%}
<div class="chart-item">
<div class="meta">
<a href="{{ item.chart.url }}">
<img
srcset="
{{ item.chart.image }}?class=w50&type=webp 50w,
{{ item.chart.image }}?class=w100&type=webp 100w
"
sizes="(max-width: 450px) 50px, 100px"
src="{{ item.chart.image }}?class=w50&type=webp"
alt="{{ item.chart.alt | replaceQuotes }}"
loading="lazy"
decoding="async"
width="64"
height="64"
>
</a>
<div class="meta-text">
<a class="title" href="{{ item.chart.url }}">{{ item.chart.title }}</a>
<span class="subheader">{{ item.chart.subtext }}</span>
</div>
</div>
<time datetime="{{ item.chart.played_at | date: "%Y-%m-%dT%H:%M:%S%:z", "America/Los_Angeles" }}">
{{ item.chart.played_at | date:"%B %-d, %-I:%M%p", "America/Los_Angeles" }}
</time>
</div>
{%- endfor -%}
</div>

View file

@ -35,7 +35,7 @@
{% if key == "books" or key == "movies" or key == "shows" %}
{% assign shape = "vertical" %}
{% endif %}
{% render "media/grid.liquid",
{% render "static/media/grid.liquid",
data:items,
shape:shape
%}

View file

@ -1,22 +1,22 @@
{%- for block in blocks -%}
{%- case block.type -%}
{%- when "calendar_banner" -%}
{% render "blocks/banners/calendar.liquid",
{% render "static/blocks/banners/calendar.liquid",
url:block.url,
text:block.text
%}
{%- when "divider" -%}
{{ block.markup | markdown }}
{%- when "forgejo_banner" -%}
{% render "blocks/banners/forgejo.liquid",
{% render "static/blocks/banners/forgejo.liquid",
url:block.url
%}
{%- when "github_banner" -%}
{% render "blocks/banners/github.liquid",
{% render "static/blocks/banners/github.liquid",
url:block.url
%}
{%- when "hero" -%}
{% render "blocks/hero.liquid",
{% render "static/blocks/hero.liquid",
globals:globals,
image:block.image,
alt:block.alt
@ -24,17 +24,17 @@
{%- when "markdown" -%}
{{ block.text | markdown }}
{%- when "npm_banner" -%}
{% render "blocks/banners/npm.liquid",
{% render "static/blocks/banners/npm.liquid",
url:block.url,
command:block.command
%}
{%- when "rss_banner" -%}
{% render "blocks/banners/rss.liquid",
{% render "static/blocks/banners/rss.liquid",
url:block.url,
text:block.text
%}
{%- when "youtube_player" -%}
{% render "blocks/youtube-player.liquid",
{% render "static/blocks/youtube-player.liquid",
url:block.url
%}
{%- endcase -%}

View file

@ -1,7 +1,6 @@
<article class="intro">
{{ intro }}
{% render "blocks/now-playing.liquid",
nowPlaying:nowPlaying
{% render "dynamic/media/now-playing.php.liquid",
section:"music"
%}
<hr />

View file

@ -10,7 +10,7 @@
• {{ item.label }}
{%- if item.notes -%}
{% assign notes = item.notes | markdown %}
{% render "blocks/dialog.liquid",
{% render "static/blocks/dialog.liquid",
icon:"info-circle",
label:"View info about this concert"
dynamic:"optimized_concerts",
@ -49,7 +49,7 @@
{%- endif -%}
{%- endif -%}
</h3>
{% render "blocks/tags.liquid",
{% render "static/blocks/tags.liquid",
tags:item.tags
%}
</article>

View file

@ -0,0 +1,13 @@
<footer>
{% render "static/nav/menu.liquid",
page:page,
nav:nav.footer_icons
class:"social"
%}
{% render "static/nav/menu.liquid",
page:page,
nav:nav.footer_text
class:"sub-pages"
separator:true
%}
</footer>

View file

@ -20,13 +20,13 @@
<a href="/" tabindex="0">{{ headerContent }}</a>
{%- endif -%}
</h1>
{% render "nav/menu.liquid",
{% render "static/nav/menu.liquid",
page:page,
nav:nav.primary_icons
class:"icons"
%}
</section>
{% render "nav/menu.liquid",
{% render "static/nav/menu.liquid",
page:page,
nav:nav.primary
class:"primary"

View file

@ -42,6 +42,6 @@
</a>
{%- endfor -%}
</div>
{% render "nav/paginator.liquid",
{% render "static/nav/paginator.liquid",
pagination:pagination
%}

View file

@ -6,7 +6,7 @@
<span class="subheader">{{ item.chart.plays }} {{ playsLabel }}</span>
</div>
<div class="chart-item-progress">
{% render "media/progress-bar.liquid",
{% render "static/media/progress-bar.liquid",
percentage:item.chart.percentage
%}
</div>

View file

@ -3,7 +3,7 @@
{%- if count -%}
{%- for item in data limit:count -%}
<li value="{{ item.chart.rank }}">
{% render "media/music/charts/item.liquid",
{% render "static/media/music/charts/item.liquid",
item:item
%}
</li>
@ -11,7 +11,7 @@
{%- else -%}
{%- for item in pagination.items -%}
<li value="{{ item.chart.rank }}">
{% render "media/music/charts/item.liquid",
{% render "static/media/music/charts/item.liquid",
item:item
%}
</li>
@ -19,6 +19,6 @@
{%- endif -%}
</ol>
</div>
{% render "nav/paginator.liquid",
{% render "static/nav/paginator.liquid",
pagination:pagination
%}

View file

@ -9,7 +9,7 @@
({{ movie.year }})
</div>
</div>
{% render "blocks/hero.liquid",
{% render "static/blocks/hero.liquid",
globals:globals,
image:movie.backdrop,
alt:movie.title

View file

@ -2,7 +2,7 @@
{%- assign source = page -%}
{%- case schema -%}
{%- when 'artist', 'genre', 'book', 'movie', 'show', 'tags' -%}
{% render "fetchers/{{ schema }}.php.liquid" %}
{% render "dynamic/fetchers/{{ schema }}.php.liquid" %}
{%- when 'blog' -%}
{%- assign source = post -%}
{%- when 'music-index', 'music-week-artists' -%}
@ -37,7 +37,7 @@
{%- assign fullUrl = meta.url -%}
{%- assign oembedUrl = globals.url | append: "/oembed" | append: page.url -%}
{%- if type == 'dynamic' -%}
{% render "metadata/dynamic.php.liquid"
{% render "dynamic/metadata/index.php.liquid"
fullUrl: fullUrl,
oembedUrl: oembedUrl,
pageTitle: meta.title,
@ -46,7 +46,7 @@
globals: globals,
%}
{%- else -%}
{% render "metadata/static.liquid"
{% render "static/metadata/static.liquid"
fullUrl: fullUrl,
oembedUrl: oembedUrl,
pageTitle: meta.title,
@ -55,7 +55,7 @@
globals: globals,
%}
{%- endif %}
{% render "metadata/base.liquid"
{% render "static/metadata/base.liquid"
pageTitle: meta.title,
globals: globals,
eleventy: eleventy,

View file

@ -1,6 +1,7 @@
{%- assign categoryUrl = link.permalink | downcase -%}
{%- assign isHttp = categoryUrl contains "http" -%}
{%- if categoryUrl | isLinkActive:page.url -%}
{%- assign url = page.activeUrl | default: page.url -%}
{%- if categoryUrl | isLinkActive:url -%}
{%- capture linkClass -%}
{%- if link.section -%}button{%- endif -%}
{%- if link.icon -%}icon{%- endif -%}

View file

@ -1,6 +1,6 @@
<nav class="{{ class }}">
{%- for link in nav -%}
{% render "nav/link.liquid",
{% render "static/nav/link.liquid",
page:page,
link:link
%}