The playlist cards were showing "No description was pr…" because the API stored that English sentence whenever a playlist was created without a description. Descriptions are optional now and the old rows are cleared. Section headings drop to 18/20px so they stop competing with the content, and the space moved from inside the sections to between them. The three media cards repeated the same anchor, art class and label block, so they share a MediaCard that also carries the hover lift the track tiles already had.
71 lines
1.3 KiB
Svelte
71 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import MediaCard from './MediaCard.svelte';
|
|
import PlaylistArt from './PlaylistArt.svelte';
|
|
import Cover from './Cover.svelte';
|
|
import { hueFor } from '$lib/theme/color';
|
|
|
|
interface Props {
|
|
id: string;
|
|
title: string;
|
|
href?: string;
|
|
subtitle?: string;
|
|
typeLabel?: string;
|
|
releaseYear?: number;
|
|
trackCount?: number;
|
|
trackIds?: (string | number)[];
|
|
coverSrc?: string | null;
|
|
index?: number;
|
|
onContextMenu?: (event: MouseEvent) => void;
|
|
}
|
|
|
|
let {
|
|
id,
|
|
title,
|
|
href,
|
|
subtitle,
|
|
typeLabel,
|
|
releaseYear,
|
|
trackCount,
|
|
trackIds = [],
|
|
coverSrc,
|
|
index = 0,
|
|
onContextMenu
|
|
}: Props = $props();
|
|
|
|
const meta = $derived(
|
|
[
|
|
typeLabel,
|
|
subtitle,
|
|
releaseYear ? String(releaseYear) : undefined,
|
|
trackCount === undefined
|
|
? undefined
|
|
: `${trackCount} ${trackCount === 1 ? 'canción' : 'canciones'}`
|
|
]
|
|
.filter((part) => !!part)
|
|
.join(' · ')
|
|
);
|
|
</script>
|
|
|
|
<MediaCard
|
|
href={href ?? `/albums/${id}`}
|
|
{title}
|
|
subtitle={meta}
|
|
{index}
|
|
oncontextmenu={onContextMenu}
|
|
>
|
|
{#snippet art(artClass)}
|
|
{#if coverSrc}
|
|
<Cover
|
|
trackId={id}
|
|
src={coverSrc}
|
|
hue={hueFor(id)}
|
|
size="large"
|
|
alt={title}
|
|
class={artClass}
|
|
/>
|
|
{:else}
|
|
<PlaylistArt {trackIds} hue={hueFor(id)} class={artClass} />
|
|
{/if}
|
|
{/snippet}
|
|
</MediaCard>
|