mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
- Reserve sidebar min-height on desktop to prevent CLS from Alpine.js hydration - Defer lite-yt-embed.css with media="print" onload pattern - Add terser JS minification in eleventy.after build hook - Increase touch target sizing for category pills, facepile avatars, nav items - Fix text-surface-400 contrast ratio (3.05:1 → 6.23:1) across 20 instances Confab-Link: http://localhost:8080/sessions/edb1b7b0-da66-4486-bd9c-d1cfa7553b88
278 lines
14 KiB
Plaintext
278 lines
14 KiB
Plaintext
---
|
|
layout: layouts/base.njk
|
|
title: Funkwhale Listening Activity
|
|
permalink: /funkwhale/
|
|
withSidebar: true
|
|
---
|
|
<div class="funkwhale-page" x-data="{ activeTab: 'all' }">
|
|
<header class="mb-6 sm:mb-8">
|
|
<h1 class="text-2xl sm:text-3xl md:text-4xl font-bold text-surface-900 dark:text-surface-100 mb-2">Listening Activity</h1>
|
|
<p class="text-surface-600 dark:text-surface-400">
|
|
What I've been listening to on
|
|
<a href="{{ funkwhaleActivity.instanceUrl }}" class="text-purple-600 dark:text-purple-400 hover:underline" target="_blank" rel="noopener">
|
|
Funkwhale
|
|
</a>
|
|
</p>
|
|
</header>
|
|
|
|
{# Now Playing / Recently Played Hero #}
|
|
{% if funkwhaleActivity.nowPlaying and funkwhaleActivity.nowPlaying.status %}
|
|
<section class="mb-12">
|
|
<div class="relative p-4 sm:p-6 rounded-xl sm:rounded-2xl overflow-hidden {% if funkwhaleActivity.nowPlaying.status == 'now-playing' %}bg-gradient-to-br from-green-500/10 to-green-600/5 border-2 border-green-500/30{% else %}bg-gradient-to-br from-purple-500/10 to-purple-600/5 border border-purple-500/20{% endif %}">
|
|
<div class="flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:gap-5">
|
|
{% if funkwhaleActivity.nowPlaying.coverUrl %}
|
|
<img
|
|
src="{{ funkwhaleActivity.nowPlaying.coverUrl }}"
|
|
alt=""
|
|
class="w-20 h-20 sm:w-24 sm:h-24 rounded-lg shadow-lg object-cover flex-shrink-0"
|
|
loading="lazy"
|
|
eleventy:ignore
|
|
>
|
|
{% else %}
|
|
<div class="w-20 h-20 sm:w-24 sm:h-24 rounded-lg bg-surface-200 dark:bg-surface-700 flex items-center justify-center flex-shrink-0">
|
|
<svg class="w-8 h-8 sm:w-10 sm:h-10 text-surface-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"/>
|
|
</svg>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="flex-1 min-w-0 w-full sm:w-auto">
|
|
<div class="flex items-center gap-2 mb-2">
|
|
{% if funkwhaleActivity.nowPlaying.status == 'now-playing' %}
|
|
<span class="inline-flex items-center gap-1.5 px-2 py-1 text-xs font-medium bg-green-500/20 text-green-700 dark:text-green-400 rounded-full">
|
|
<span class="flex gap-0.5 items-end h-3">
|
|
<span class="w-0.5 bg-green-500 animate-pulse" style="height: 30%; animation-delay: 0s;"></span>
|
|
<span class="w-0.5 bg-green-500 animate-pulse" style="height: 70%; animation-delay: 0.2s;"></span>
|
|
<span class="w-0.5 bg-green-500 animate-pulse" style="height: 50%; animation-delay: 0.4s;"></span>
|
|
</span>
|
|
Now Playing
|
|
</span>
|
|
{% else %}
|
|
<span class="inline-flex items-center gap-1.5 px-2 py-1 text-xs font-medium bg-purple-500/20 text-purple-700 dark:text-purple-400 rounded-full">
|
|
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 24 24"><path d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
|
Recently Played
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<h2 class="text-lg sm:text-xl font-bold text-surface-900 dark:text-surface-100 truncate">
|
|
{% if funkwhaleActivity.nowPlaying.trackUrl %}
|
|
<a href="{{ funkwhaleActivity.nowPlaying.trackUrl }}" class="hover:text-purple-600 dark:hover:text-purple-400" target="_blank" rel="noopener">
|
|
{{ funkwhaleActivity.nowPlaying.track }}
|
|
</a>
|
|
{% else %}
|
|
{{ funkwhaleActivity.nowPlaying.track }}
|
|
{% endif %}
|
|
</h2>
|
|
<p class="text-surface-600 dark:text-surface-400">{{ funkwhaleActivity.nowPlaying.artist }}</p>
|
|
{% if funkwhaleActivity.nowPlaying.album %}
|
|
<p class="text-sm text-surface-600 dark:text-surface-400 mt-1">{{ funkwhaleActivity.nowPlaying.album }}</p>
|
|
{% endif %}
|
|
<p class="text-xs text-surface-600 dark:text-surface-400 mt-2">{{ funkwhaleActivity.nowPlaying.relativeTime }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
{% endif %}
|
|
|
|
{# Stats Section with Tabs #}
|
|
{% if funkwhaleActivity.stats %}
|
|
<section class="mb-12">
|
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6 flex items-center gap-2">
|
|
<svg class="w-6 h-6 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
|
|
</svg>
|
|
Listening Statistics
|
|
</h2>
|
|
|
|
{# Tab buttons #}
|
|
<div class="flex gap-1 mb-6 border-b border-surface-200 dark:border-surface-700 overflow-x-auto" role="tablist" aria-label="Listening statistics period">
|
|
<button
|
|
@click="activeTab = 'all'"
|
|
:class="activeTab === 'all' ? 'border-b-2 border-purple-500 text-purple-600 dark:text-purple-400' : 'text-surface-600 dark:text-surface-400 hover:text-surface-700 dark:hover:text-surface-300'"
|
|
:aria-selected="(activeTab === 'all').toString()"
|
|
role="tab" id="fw-tab-all" aria-controls="fw-panel-all"
|
|
class="px-4 py-2 text-sm font-medium transition-colors -mb-px whitespace-nowrap"
|
|
>
|
|
All Time
|
|
</button>
|
|
<button
|
|
@click="activeTab = 'month'"
|
|
:class="activeTab === 'month' ? 'border-b-2 border-purple-500 text-purple-600 dark:text-purple-400' : 'text-surface-600 dark:text-surface-400 hover:text-surface-700 dark:hover:text-surface-300'"
|
|
:aria-selected="(activeTab === 'month').toString()"
|
|
role="tab" id="fw-tab-month" aria-controls="fw-panel-month"
|
|
class="px-4 py-2 text-sm font-medium transition-colors -mb-px whitespace-nowrap"
|
|
>
|
|
This Month
|
|
</button>
|
|
<button
|
|
@click="activeTab = 'week'"
|
|
:class="activeTab === 'week' ? 'border-b-2 border-purple-500 text-purple-600 dark:text-purple-400' : 'text-surface-600 dark:text-surface-400 hover:text-surface-700 dark:hover:text-surface-300'"
|
|
:aria-selected="(activeTab === 'week').toString()"
|
|
role="tab" id="fw-tab-week" aria-controls="fw-panel-week"
|
|
class="px-4 py-2 text-sm font-medium transition-colors -mb-px whitespace-nowrap"
|
|
>
|
|
This Week
|
|
</button>
|
|
<button
|
|
@click="activeTab = 'trends'"
|
|
:class="activeTab === 'trends' ? 'border-b-2 border-purple-500 text-purple-600 dark:text-purple-400' : 'text-surface-600 dark:text-surface-400 hover:text-surface-700 dark:hover:text-surface-300'"
|
|
:aria-selected="(activeTab === 'trends').toString()"
|
|
role="tab" id="fw-tab-trends" aria-controls="fw-panel-trends"
|
|
class="px-4 py-2 text-sm font-medium transition-colors -mb-px whitespace-nowrap"
|
|
>
|
|
Trends
|
|
</button>
|
|
</div>
|
|
|
|
{# All Time Tab #}
|
|
<div x-show="activeTab === 'all'" x-cloak role="tabpanel" id="fw-panel-all" aria-labelledby="fw-tab-all">
|
|
{% set summary = funkwhaleActivity.stats.summary.all %}
|
|
{% set topArtists = funkwhaleActivity.stats.topArtists.all %}
|
|
{% set topAlbums = funkwhaleActivity.stats.topAlbums.all %}
|
|
{% include "components/funkwhale-stats-content.njk" %}
|
|
</div>
|
|
|
|
{# This Month Tab #}
|
|
<div x-show="activeTab === 'month'" x-cloak role="tabpanel" id="fw-panel-month" aria-labelledby="fw-tab-month">
|
|
{% set summary = funkwhaleActivity.stats.summary.month %}
|
|
{% set topArtists = funkwhaleActivity.stats.topArtists.month %}
|
|
{% set topAlbums = funkwhaleActivity.stats.topAlbums.month %}
|
|
{% include "components/funkwhale-stats-content.njk" %}
|
|
</div>
|
|
|
|
{# This Week Tab #}
|
|
<div x-show="activeTab === 'week'" x-cloak role="tabpanel" id="fw-panel-week" aria-labelledby="fw-tab-week">
|
|
{% set summary = funkwhaleActivity.stats.summary.week %}
|
|
{% set topArtists = funkwhaleActivity.stats.topArtists.week %}
|
|
{% set topAlbums = funkwhaleActivity.stats.topAlbums.week %}
|
|
{% include "components/funkwhale-stats-content.njk" %}
|
|
</div>
|
|
|
|
{# Trends Tab #}
|
|
<div x-show="activeTab === 'trends'" x-cloak role="tabpanel" id="fw-panel-trends" aria-labelledby="fw-tab-trends">
|
|
{% if funkwhaleActivity.stats.trends and funkwhaleActivity.stats.trends.length %}
|
|
<div class="bg-surface-50 dark:bg-surface-800 rounded-lg p-6 border border-surface-200 dark:border-surface-700 shadow-sm">
|
|
<h3 class="text-lg font-semibold text-surface-900 dark:text-surface-100 mb-4">Daily Listening (Last 30 Days)</h3>
|
|
<div class="flex items-end gap-1 h-32">
|
|
{% set maxCount = 1 %}
|
|
{% for day in funkwhaleActivity.stats.trends %}
|
|
{% if day.count > maxCount %}
|
|
{% set maxCount = day.count %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for day in funkwhaleActivity.stats.trends %}
|
|
<div
|
|
class="flex-1 bg-purple-500 hover:bg-purple-600 rounded-t transition-colors cursor-pointer"
|
|
style="height: {{ (day.count / maxCount * 100) if maxCount > 0 else 0 }}%; min-height: 2px;"
|
|
title="{{ day.date }}: {{ day.count }} plays"
|
|
></div>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="flex justify-between text-xs text-surface-600 dark:text-surface-400 mt-2">
|
|
<span>{{ funkwhaleActivity.stats.trends[0].date }}</span>
|
|
<span>{{ funkwhaleActivity.stats.trends[funkwhaleActivity.stats.trends.length - 1].date }}</span>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<p class="text-surface-600 dark:text-surface-400">No trend data available yet.</p>
|
|
{% endif %}
|
|
</div>
|
|
</section>
|
|
{% endif %}
|
|
|
|
{# Recent Listenings #}
|
|
<section class="mb-12">
|
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6 flex items-center gap-2">
|
|
<svg class="w-6 h-6 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
Recent Listens
|
|
</h2>
|
|
|
|
{% if funkwhaleActivity.listenings.length %}
|
|
<div class="space-y-3">
|
|
{% for listening in funkwhaleActivity.listenings | head(15) %}
|
|
<div class="flex items-center gap-4 p-3 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 hover:border-purple-400 dark:hover:border-purple-600 transition-colors shadow-sm">
|
|
{% if listening.coverUrl %}
|
|
<img src="{{ listening.coverUrl }}" alt="" class="w-12 h-12 rounded object-cover flex-shrink-0" loading="lazy" eleventy:ignore>
|
|
{% else %}
|
|
<div class="w-12 h-12 rounded bg-surface-200 dark:bg-surface-700 flex items-center justify-center flex-shrink-0">
|
|
<svg class="w-6 h-6 text-surface-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2z"/>
|
|
</svg>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="flex-1 min-w-0">
|
|
<h3 class="font-medium text-surface-900 dark:text-surface-100 truncate">
|
|
{% if listening.trackUrl %}
|
|
<a href="{{ listening.trackUrl }}" class="hover:text-purple-600 dark:hover:text-purple-400" target="_blank" rel="noopener">
|
|
{{ listening.track }}
|
|
</a>
|
|
{% else %}
|
|
{{ listening.track }}
|
|
{% endif %}
|
|
</h3>
|
|
<p class="text-sm text-surface-600 dark:text-surface-400 truncate">{{ listening.artist }}</p>
|
|
</div>
|
|
|
|
<div class="text-right flex-shrink-0">
|
|
<span class="text-xs text-surface-600 dark:text-surface-400">{{ listening.relativeTime }}</span>
|
|
{% if listening.duration %}
|
|
<span class="text-xs text-surface-600 dark:text-surface-400 block">{{ listening.duration }}</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p class="text-surface-600 dark:text-surface-400">No recent listening history available.</p>
|
|
{% endif %}
|
|
</section>
|
|
|
|
{# Favorites #}
|
|
{% if funkwhaleActivity.favorites.length %}
|
|
<section class="mb-12">
|
|
<h2 class="text-xl sm:text-2xl font-bold text-surface-900 dark:text-surface-100 mb-4 sm:mb-6 flex items-center gap-2">
|
|
<svg class="w-6 h-6 text-red-500" fill="currentColor" viewBox="0 0 24 24">
|
|
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
|
|
</svg>
|
|
Favorite Tracks
|
|
</h2>
|
|
|
|
<div class="grid gap-3 sm:gap-4 md:grid-cols-2">
|
|
{% for favorite in funkwhaleActivity.favorites | head(10) %}
|
|
<div class="flex items-center gap-3 p-3 bg-surface-50 dark:bg-surface-800 rounded-lg border border-surface-200 dark:border-surface-700 shadow-sm">
|
|
{% if favorite.coverUrl %}
|
|
<img src="{{ favorite.coverUrl }}" alt="" class="w-14 h-14 rounded object-cover flex-shrink-0" loading="lazy" eleventy:ignore>
|
|
{% else %}
|
|
<div class="w-14 h-14 rounded bg-surface-200 dark:bg-surface-700 flex items-center justify-center flex-shrink-0">
|
|
<svg class="w-6 h-6 text-surface-400" fill="currentColor" viewBox="0 0 24 24">
|
|
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
|
|
</svg>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="flex-1 min-w-0">
|
|
<h3 class="font-medium text-surface-900 dark:text-surface-100 truncate">
|
|
{% if favorite.trackUrl %}
|
|
<a href="{{ favorite.trackUrl }}" class="hover:text-purple-600 dark:hover:text-purple-400" target="_blank" rel="noopener">
|
|
{{ favorite.track }}
|
|
</a>
|
|
{% else %}
|
|
{{ favorite.track }}
|
|
{% endif %}
|
|
</h3>
|
|
<p class="text-sm text-surface-600 dark:text-surface-400 truncate">{{ favorite.artist }}</p>
|
|
{% if favorite.album %}
|
|
<p class="text-xs text-surface-600 dark:text-surface-400 truncate">{{ favorite.album }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</section>
|
|
{% endif %}
|
|
</div>
|