Crea src/lib/actions/pressable.ts y clickOutside.ts (Svelte actions; role/tabindex se mantienen estáticos en el markup por accesibilidad SSR, la acción solo añade click + Enter/Espacio) y src/lib/toggle.svelte.ts (createToggle), usado por playlists.svelte.ts y queuePanel.svelte.ts. format.ts: añade plural(n, uno, muchos); migra las 15 pluralizaciones manuales del repo, unificando a minúscula (Δ visible en Playlists, Inicio, liked, Explorar). player.svelte.ts: añade toQueueItem, isQueueCurrent, playAllOrToggle, playShuffled; renombra addToQueue → playNextItem (el nombre anterior confundía: inserta a continuación, no al final). Migra los 5 sitios que repetían el patrón isCurrentQueue/playAll (álbum, playlist, liked, mezcla, Inicio). Simplifica liked.svelte.ts y recentlyPlayed.ts con object spread en vez de reconstruir cada campo a mano. navigation.svelte.ts: añade searchHref (migra el buildHref duplicado de TopBar y Explorar) y appNavLinks (creado; su adopción en Sidebar/ TabsBar queda para P12, como indica esa parte). menus.svelte.ts: createTrackMenu() sustituye el estado manual de menú contextual (contextMenu + contextMenuStateFor + addToQueue) en Inicio, Explorar y Mezcla. Pendiente a propósito: la tarea 5 (eliminar el envoltorio TrackTarget de tracks.ts y sus 8 accesores) se difiere a P13 — es el cambio de mayor riesgo del plan, toca tipos de forma transversal en Inicio/ Explorar/Mezcla/menús, y no se pudo verificar visualmente sin Docker en esta sesión. Verificado con npm run check/build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
76 lines
2.0 KiB
Svelte
76 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import Play from '@lucide/svelte/icons/play';
|
|
import Pause from '@lucide/svelte/icons/pause';
|
|
import SquarePencil from '@lucide/svelte/icons/square-pen';
|
|
import Trash from '@lucide/svelte/icons/trash';
|
|
import Artwork from '$lib/components/ui/Artwork.svelte';
|
|
import BackLink from '$lib/components/ui/BackLink.svelte';
|
|
import Button from '$lib/components/ui/Button.svelte';
|
|
import CollectionHeader from '$lib/components/ui/CollectionHeader.svelte';
|
|
import { plural } from '$lib/format';
|
|
|
|
interface Props {
|
|
title: string;
|
|
description?: string;
|
|
releaseYear?: number;
|
|
trackIds: (string | number)[];
|
|
coverUrl?: string;
|
|
playing: boolean;
|
|
isOwner: boolean;
|
|
onPlayAll: () => void;
|
|
onEdit: () => void;
|
|
onDelete: () => void;
|
|
}
|
|
|
|
let {
|
|
title,
|
|
description,
|
|
releaseYear,
|
|
trackIds,
|
|
coverUrl,
|
|
playing,
|
|
isOwner,
|
|
onPlayAll,
|
|
onEdit,
|
|
onDelete
|
|
}: Props = $props();
|
|
|
|
const meta = $derived(
|
|
[releaseYear ? String(releaseYear) : undefined, plural(trackIds.length, 'canción', 'canciones')]
|
|
.filter((part) => part !== undefined)
|
|
.join(' · ')
|
|
);
|
|
</script>
|
|
|
|
<BackLink
|
|
href={isOwner ? '/albums' : '/'}
|
|
label={isOwner ? 'Volver a tus álbumes' : 'Volver al inicio'}
|
|
/>
|
|
|
|
<CollectionHeader eyebrow="Álbum" {title} {description} {meta}>
|
|
{#snippet cover()}
|
|
<Artwork src={coverUrl} {trackIds} size="hero" alt={title} class="shrink-0" />
|
|
{/snippet}
|
|
{#snippet actions()}
|
|
<Button size="sm" onclick={onPlayAll} disabled={trackIds.length === 0}>
|
|
{#if playing}
|
|
<Pause class="h-4 w-4" strokeWidth={1.5} />
|
|
Pausar
|
|
{:else}
|
|
<Play class="h-4 w-4" strokeWidth={1.5} />
|
|
Reproducir
|
|
{/if}
|
|
</Button>
|
|
{#if isOwner}
|
|
<Button size="sm" variant="secondary" onclick={onEdit}>
|
|
<SquarePencil class="h-4 w-4" strokeWidth={1.5} />
|
|
Editar
|
|
</Button>
|
|
<Button size="sm" variant="secondary" onclick={onDelete}>
|
|
<Trash class="h-4 w-4" strokeWidth={1.5} />
|
|
Eliminar
|
|
</Button>
|
|
{/if}
|
|
{/snippet}
|
|
</CollectionHeader>
|