Files
qbz/crates/qbz-ui/ui/discover/ArtistCard.slint
T
vicrodh 05df99b713 fix(reco): full-albums-only + slop filter + taller Recommendation rows
Owner-directed polish after testing the Recommendations tab.

- Full albums only: drop singles/EPs/boxsets/compilations from every album row
  (Recommended Albums, Fresh Releases, Deep cuts). Qobuz's `release_type` is the
  source of truth ("album" | "single" | "boxset" | "compilation"); when absent,
  fall back to tracks_count >= 5. Kills the karaoke single that showed up under
  Fresh Releases.
- Slop second layer: reject karaoke / tribute / "made famous by" / "in the style
  of" / instrumental-version releases by artist-or-title keyword, applied both
  pre-resolution (candidates) and post-resolution (the Qobuz album), so AI-slop
  that still wears a full-album shape gets filtered.
- Taller rows in this view only: AlbumCard/ArtistCard/Carousel/ArtistCarousel
  grow an overridable `card-height` (defaults unchanged, so Home/Search are
  untouched); ExternalRecoView passes 266 to album rows and 256 to artist rows,
  whose cards carry the "Similar to…" subtitle (~250px) and were clipping the
  Follow chip at the old fixed 220.

cargo check -p qbz green.

cc
2026-06-27 11:20:06 -06:00

146 lines
5.6 KiB
Plaintext

// Artist card — ported 1:1 from the Tauri SearchView `.artist-card`:
// 160x220 tile inside a surface-card container, with a 120px circular
// avatar (gradient placeholder), centered name, and an optional Follow
// chip (rectangular per ADR-008) shown only when the user does not yet
// follow the artist.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { SlimItem } from "../state.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
export component ArtistCard inherits Rectangle {
in property <SlimItem> artist;
// Follow-chip behavior:
// "auto" show only when NOT following (artist search default);
// "toggle" always show, reflecting Follow/Following (label more-labels);
// "none" never show (label artists carousel — no follow there).
in property <string> follow-mode: "auto";
// kind passed in the follow media-action ("artist" | "label").
in property <string> follow-kind: "artist";
callback clicked(string);
// kind ("artist" | "label"), id, action ("follow").
callback media-action(string, string, string);
// Overridable: with the optional "Similar to…" subtitle + a Follow chip the
// content runs ~250px, so Discover Recommendations passes a taller value;
// the default 220 keeps artist-search / Top Artists unchanged.
in property <length> card-height: 220px;
width: 160px;
height: root.card-height;
border-radius: 12px;
background: ta.has-hover ? Theme.surface-elevated : Theme.surface-card;
animate background { duration: 150ms; }
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.clicked(root.artist.id);
}
}
VerticalLayout {
padding: 16px;
spacing: 12px;
alignment: start;
// 120px circular avatar with a soft gradient placeholder.
HorizontalLayout {
alignment: center;
Rectangle {
width: 120px;
height: 120px;
border-radius: 60px;
clip: true;
background: @linear-gradient(
135deg,
Theme.surface-elevated 0%,
Theme.surface-card 100%);
QbzIcon {
source: @image-url("../assets/icons/user.svg");
width: 38px;
height: 38px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: Theme.text-muted;
}
Image {
width: 100%;
height: 100%;
source: root.artist.artwork;
image-fit: cover;
}
}
}
Text {
text: root.artist.title;
width: 128px;
color: Theme.text-primary;
font-size: 14px;
font-weight: Typography.medium;
horizontal-alignment: center;
overflow: elide;
}
// Optional "Similar to X, Y" line (external-reco "Recommended Artists").
// Empty for every other usage (search / Top Artists / To Follow) -> hidden.
if root.artist.subtitle != "": Text {
text: root.artist.subtitle;
width: 128px;
color: Theme.text-muted;
font-size: 11px;
horizontal-alignment: center;
overflow: elide;
}
// Rectangular Follow / Following chip (ADR-008 — no pills). See
// `follow-mode`: "auto" shows it only when not yet following,
// "toggle" always shows it (and reflects the state), "none" hides it.
if (root.follow-mode == "auto" && !root.artist.following)
|| root.follow-mode == "toggle": HorizontalLayout {
alignment: center;
spacing: 0px;
Rectangle {
width: chip-row.preferred-width;
height: 28px;
border-radius: Radius.sm;
background: follow-ta.has-hover
? Theme.surface-hover
: Theme.surface-elevated;
animate background { duration: 150ms; }
chip-row := HorizontalLayout {
padding-left: 12px;
padding-right: 12px;
spacing: 6px;
VerticalLayout {
alignment: center;
QbzIcon {
source: root.artist.following
? @image-url("../assets/icons/check.svg")
: @image-url("../assets/icons/user-plus.svg");
width: 13px;
height: 13px;
tint: Theme.text-primary;
}
}
Text {
text: root.artist.following ? @tr("Following") : @tr("Follow");
color: Theme.text-primary;
font-size: 12px;
font-weight: Typography.medium;
vertical-alignment: center;
}
}
follow-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.media-action(root.follow-kind, root.artist.id, "follow");
}
}
}
}
}
}