Corrections from testing feedback: - Remove the greeting — the current QBZ discovery view has no greeting, only the tab selector. Drops HomeState.greeting and the chrono dep. - Quality badge is now the icon-only badge (hi-res.svg, or cd.svg in a framed square), not a numeric text pill. AlbumCardItem carries a quality tier instead of a quality string. - Tighten the album card: deterministic 274px height, title and artist in a 2px-spaced stack — removes the large gap between them. - SectionRow no longer scrolls vertically (vertical-scrollbar-policy always-off, height pinned to the card height). - Artwork is downscaled to 264px on decode instead of holding ~600px source textures. cc
133 lines
4.5 KiB
Plaintext
133 lines
4.5 KiB
Plaintext
// Album card for the Discover sections.
|
|
//
|
|
// Mirrors the Svelte AlbumCardLite: 220px column, 220px square artwork
|
|
// with a bottom-left award ribbon, then a tight title / artist stack
|
|
// alongside an icon-only quality badge. Deterministic height (274px) so
|
|
// the section row never scrolls vertically.
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { Spacing } from "../foundation/spacing.slint";
|
|
import { AlbumCardItem } from "../state.slint";
|
|
|
|
export component AlbumCard inherits Rectangle {
|
|
in property <AlbumCardItem> album;
|
|
|
|
width: 220px;
|
|
height: 274px;
|
|
|
|
VerticalLayout {
|
|
alignment: start;
|
|
spacing: 0px;
|
|
|
|
// --- Artwork ------------------------------------------------------
|
|
Rectangle {
|
|
width: 220px;
|
|
height: 220px;
|
|
border-radius: Radius.sm;
|
|
background: Theme.surface-elevated;
|
|
clip: true;
|
|
|
|
// Cover art. Empty until the artwork pipeline resolves it,
|
|
// leaving the elevated placeholder visible underneath.
|
|
Image {
|
|
width: 100%;
|
|
height: 100%;
|
|
source: root.album.artwork;
|
|
image-fit: cover;
|
|
}
|
|
|
|
if root.album.ribbon != "": Rectangle {
|
|
x: 0px;
|
|
y: parent.height - self.height - 8px;
|
|
height: 20px;
|
|
background: root.album.ribbon-kind == "press"
|
|
? #d49511
|
|
: #000000e0;
|
|
border-top-right-radius: 3px;
|
|
border-bottom-right-radius: 3px;
|
|
|
|
// Left accent stripe (not on the gold press ribbon).
|
|
Rectangle {
|
|
x: 0px;
|
|
width: root.album.ribbon-kind == "press" ? 0px : 3px;
|
|
background: root.album.ribbon-kind == "qobuzissime"
|
|
? #8b5cf6
|
|
: #eab308;
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: 10px;
|
|
padding-right: 10px;
|
|
Text {
|
|
text: root.album.ribbon;
|
|
color: root.album.ribbon-kind == "press"
|
|
? #1f1407
|
|
: #ffffff;
|
|
font-size: 10px;
|
|
font-weight: Typography.semibold;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle { height: 8px; }
|
|
|
|
// --- Title / artist + quality badge ------------------------------
|
|
HorizontalLayout {
|
|
height: 46px;
|
|
spacing: Spacing.sm;
|
|
|
|
VerticalLayout {
|
|
alignment: center;
|
|
spacing: 2px;
|
|
horizontal-stretch: 1;
|
|
|
|
Text {
|
|
text: root.album.title;
|
|
color: Theme.text-primary;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.album.artist;
|
|
color: Theme.text-muted;
|
|
font-size: Typography.link;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
|
|
// Icon-only quality badge.
|
|
VerticalLayout {
|
|
alignment: center;
|
|
|
|
if root.album.quality-tier == "hires": Image {
|
|
source: @image-url("../assets/hi-res.svg");
|
|
width: 42px;
|
|
height: 28px;
|
|
image-fit: contain;
|
|
}
|
|
if root.album.quality-tier == "cd": Rectangle {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 3px;
|
|
background: Theme.surface-elevated;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
Image {
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
width: 16px;
|
|
height: 16px;
|
|
source: @image-url("../assets/cd.svg");
|
|
image-fit: contain;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|