The MediaCard consolidation in the discovery doc would have needed ~14 props to cover the differentiating bits (wrapping element a vs button, art-shape, art-fallback strategy, click semantics, title align/size, subtitle count). That's a god-prop blob that's harder to reason about than three explicit cards. Narrowed to the actually-drifted bit: the action cluster (LikeButton + Plus + bottom-right menu slot, including the stopPropagation defensive wrappers). One small component covers AlbumCard / ArtistCard / CompactTrackCard so the focus-ring and button-styling drift can't recur. Each card keeps its own data-fetching, art container, and wrapping element since those have load-bearing differences. The consolidation addresses drift, not LOC for its own sake. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
import { FALLBACK_COVER } from '$lib/media/covers';
|
||||
import { api } from '$lib/api/client';
|
||||
import { enqueueTracks, playQueue } from '$lib/player/store.svelte';
|
||||
import { Plus, Play } from 'lucide-svelte';
|
||||
import LikeButton from './LikeButton.svelte';
|
||||
import { Play } from 'lucide-svelte';
|
||||
import AlbumMenu from './AlbumMenu.svelte';
|
||||
import CardActionCluster from './CardActionCluster.svelte';
|
||||
|
||||
let { album }: { album: AlbumRef } = $props();
|
||||
|
||||
@@ -58,24 +58,20 @@
|
||||
<div class="text-xs text-text-secondary">{album.year}</div>
|
||||
{/if}
|
||||
</a>
|
||||
<div class="absolute right-2 top-2 z-10 flex gap-1">
|
||||
<LikeButton entityType="album" entityId={album.id} />
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Add to queue"
|
||||
onclick={onAddClick}
|
||||
class="rounded-full bg-surface px-2 py-1 text-sm text-text-secondary hover:text-text-primary focus-visible:ring-2 focus-visible:ring-accent"
|
||||
>
|
||||
<Plus size={16} strokeWidth={1} />
|
||||
</button>
|
||||
</div>
|
||||
<div class="absolute right-2 bottom-2 z-10">
|
||||
<AlbumMenu
|
||||
albumId={album.id}
|
||||
albumTitle={album.title}
|
||||
artistId={album.artist_id}
|
||||
artistName={album.artist_name}
|
||||
/>
|
||||
</div>
|
||||
<CardActionCluster
|
||||
likeEntityType="album"
|
||||
likeEntityId={album.id}
|
||||
onAdd={onAddClick}
|
||||
addLabel="Add to queue"
|
||||
>
|
||||
{#snippet menu()}
|
||||
<AlbumMenu
|
||||
albumId={album.id}
|
||||
albumTitle={album.title}
|
||||
artistId={album.artist_id}
|
||||
artistName={album.artist_name}
|
||||
/>
|
||||
{/snippet}
|
||||
</CardActionCluster>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user