Files
qbz/crates/qbz-slint/ui/discover/RadioCard.slint
T
vicrodh c27f6e1b9f feat(slint): For You Spotlight section
Ports Tauri's SpotlightLite — one favorite artist highlighted with a
hero and a content row. Backed by get_artist_page.

  - Spotlight component: header (title + "Shine a light…" subtitle),
    hero (round portrait + ARTIST label + name + play-top-tracks /
    open-artist circle buttons), and a draggable Flickable row
    mixing a TOP TRACKS card, a RADIO card, and the artist's albums.
  - New RadioCard (port of RadioCardLite): a 180px tile with the seed
    artwork centered on an elevated panel, a wordmark label over it,
    and a title/subtitle below; hover reveals play. (The Tauri
    palette-derived panel colour is approximated with a neutral
    elevated panel.)
  - foryou::load_spotlight rotates among the top-5 favorites by
    wall-clock seconds, fetches get_artist_page, and extracts up to 6
    albums (album > live > ep-single > compilation, deduped) plus
    whether the artist has top tracks. ForYouState gains the
    spotlight-* fields; two new artwork targets feed the portrait +
    album covers.
  - Wiring: ForYouView renders Spotlight after Artists to Follow.
    play-top-tracks routes to the existing artist play-top action;
    "start radio" has no artist-radio backend yet so it falls back to
    playing top tracks (logged).

Remaining For You: Radio Stations section (old card design), Qobuz
Mixes row, and the reco-DB sections (More from library, Rediscover).

cc
2026-05-21 01:51:31 -06:00

124 lines
4.0 KiB
Plaintext

// Radio / Top-Tracks card — port of Tauri's RadioCardLite. A 180px
// tile: a square "display" with the seed artwork centered and a
// wordmark label ("RADIO" / "TOP TRACKS") over it, then a title +
// subtitle below. Hover reveals a play button.
//
// The Tauri version derives the panel colour from the artwork's
// dominant palette; that palette extraction is omitted here (a
// neutral elevated panel stands in), the rest matches.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
export component RadioCard inherits Rectangle {
in property <string> seed-title;
in property <string> seed-subtitle;
in property <string> label: "RADIO";
in property <image> artwork;
callback clicked();
callback play();
width: 180px;
height: 234px;
VerticalLayout {
spacing: 8px;
// Display panel.
panel := Rectangle {
width: 180px;
height: 180px;
border-radius: Radius.sm;
background: Theme.surface-elevated;
clip: true;
// Centered artwork "display".
Rectangle {
width: 114px;
height: 114px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2 - 8px;
border-radius: 4px;
background: Theme.surface-card;
clip: true;
Image {
width: 100%;
height: 100%;
source: root.artwork;
image-fit: cover;
}
}
// Wordmark over the display, bottom.
Text {
text: root.label;
color: #ffffffe6;
font-size: 15px;
font-weight: Typography.bold;
letter-spacing: 2px;
x: (parent.width - self.width) / 2;
y: parent.height - self.height - 16px;
}
// Hover overlay + play.
Rectangle {
width: 100%;
height: 100%;
background: #000000;
opacity: ta.has-hover || play-ta.has-hover ? 0.45 : 0.0;
animate opacity { duration: 150ms; }
}
play-circle := Rectangle {
width: 44px;
height: 44px;
border-radius: 22px;
background: #ffffff;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
opacity: ta.has-hover || play-ta.has-hover ? 1.0 : 0.0;
animate opacity { duration: 150ms; }
QbzIcon {
source: @image-url("../assets/icons/play-fill.svg");
width: 18px;
height: 18px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: #000000;
}
play-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.play();
}
}
}
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.clicked();
}
}
}
// Meta.
Text {
text: root.seed-title;
color: Theme.text-primary;
font-size: Typography.body;
font-weight: Typography.medium;
overflow: elide;
width: 180px;
}
if root.seed-subtitle != "": Text {
text: root.seed-subtitle;
color: Theme.text-muted;
font-size: Typography.legal;
overflow: elide;
width: 180px;
}
}
}