Files
SoulStream/src/components/AlbumCard.svelte
T
KeelrLeek a667b4b28e Baseline: full tree snapshot after git repository loss
The previous .git directory was found gutted (only info/ remained), so
history is unrecoverable locally. This commit restores version control
with the tree exactly as it stands: the working app, the preview-tracks
launcher on the artist hero, the scrollable-track-previews design bundle
(docs + approved mockups), and the Phase 0 validation artifacts.
2026-07-22 17:57:00 -05:00

89 lines
2.2 KiB
Svelte

<script>
import { getArt, ui } from "../lib/state.svelte.js";
import Icon from "./Icon.svelte";
let { album, onselect = null } = $props();
let art = $state(null);
$effect(() => {
art = null;
getArt(album.art_path).then((url) => (art = url));
});
function open() {
if (onselect) {
onselect(album);
return;
}
ui.view = "library";
ui.albumId = album.id;
}
</script>
<button class="card" type="button" onclick={open}>
{#if art}
<img class="art" src={art} alt="" draggable="false" />
{:else}
<div class="art placeholder"><Icon name="disc" size={40} /></div>
{/if}
<div class="card-title" title={album.title}>{album.title}</div>
<div class="card-sub">{album.year ? `${album.year} · ` : ""}{album.artist}</div>
</button>
<style>
.card {
display: flex;
flex-direction: column;
text-align: left;
background: var(--bg-elevated);
border-radius: var(--radius);
padding: 14px;
transition: background 0.2s;
cursor: pointer;
width: 100%;
/* Compact baseline for short titles; a five-line title is allowed to
grow beyond this instead of reserving its full height everywhere. */
min-height: 245px;
}
.card:hover {
background: var(--bg-highlight);
}
.art {
display: block;
width: 100%;
aspect-ratio: 1;
object-fit: cover;
border-radius: 6px;
margin-bottom: 12px;
}
.art.placeholder {
display: grid;
place-items: center;
background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
color: var(--text-muted);
font-size: 32px;
}
.card-title {
font-weight: 600;
line-height: 1.25;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 6;
}
.card-sub {
font-size: 12px;
color: var(--text-secondary);
margin-top: 4px;
line-height: 1.25;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>