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 203012eef7
No known key found for this signature in database
129 changed files with 983 additions and 960 deletions

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; ?>