refactor(web-player): let TrackTable declare its own columns

Every one of the seven tables repeated the same header markup and hand
written grid templates, always in the same shape: an optional index, the
title, optional desktop-only meta columns, the duration and an optional
action. TrackTable now takes that shape as props and builds both grid
templates and the headers itself.
This commit is contained in:
2026-07-21 18:50:17 +02:00
parent 04eab6c6d6
commit 5585f4fa83
8 changed files with 51 additions and 67 deletions
@@ -49,18 +49,14 @@
{#if items.length > 0}
<TrackTable
columns="32px 1fr 100px 100px 64px 36px"
columnsMobile="28px 1fr 52px 32px"
index
action
meta={[
{ label: 'Subida', width: '100px' },
{ label: 'Escuchas', width: '100px' }
]}
class="mt-6 sm:mt-8"
>
{#snippet headers()}
<span class="text-center">#</span>
<span>Título</span>
<span class="hidden text-center sm:block">Subida</span>
<span class="hidden text-center sm:block">Escuchas</span>
<span class="hidden text-center sm:block">Duración</span>
<span></span>
{/snippet}
{#each items as track, i (track.id)}
<TrackRow>
<TrackIndexCell