Files
qbz/crates/qbz-slint/ui/discover/ArtistCard.slint
T
vicrodh 5707601174 fix(slint): search results 1:1 with Tauri
- Most popular: a crowned hero inline with the artists carousel; its
  cover now resolves (a dedicated artwork target was missing).
- Artists: a real carousel on the All tab, ArtistCard restyled to the
  Tauri For-You tile with a Follow chip (favorites the artist) shown
  when the user does not follow it.
- Playlists: a PlaylistCarousel of PlaylistCard, with a count-based
  PlaylistCollage (1/2/3/4-up) instead of a flat row list.
- Carousels gained a View all link; result counts removed from titles.
- searchType filter is a styled radio row (ring + accent dot) at the
  top right with a clear button, not a dropdown.
- Title fixed to Search Results.
- QbzCore::favorite_artist_ids backs the follow state.

cc
2026-05-19 13:59:56 -06:00

112 lines
3.7 KiB
Plaintext

// Artist card — a circular portrait with the artist name and, when the
// user does not already follow the artist, a Follow chip. Style ported
// from the Tauri Discover "For You" artist tile.
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { SlimItem } from "../state.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
export component ArtistCard inherits Rectangle {
in property <SlimItem> artist;
callback clicked(string);
// kind ("artist"), artist id, action ("follow").
callback media-action(string, string, string);
width: 170px;
height: 248px;
border-radius: 8px;
background: ta.has-hover ? Theme.surface-elevated : transparent;
// Whole-card click — declared before the content so the Follow chip
// keeps its own clicks.
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.clicked(root.artist.id);
}
}
VerticalLayout {
padding: 12px;
spacing: 8px;
alignment: start;
// Circular portrait.
HorizontalLayout {
alignment: center;
Rectangle {
width: 140px;
height: 140px;
border-radius: 70px;
clip: true;
background: Theme.surface-elevated;
QbzIcon {
source: @image-url("../assets/icons/user.svg");
width: 44px;
height: 44px;
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
tint: Theme.text-muted;
}
Image {
width: 100%;
height: 100%;
source: root.artist.artwork;
image-fit: cover;
}
}
}
Text {
text: root.artist.title;
width: 146px;
color: Theme.text-primary;
font-size: 14px;
font-weight: Typography.medium;
horizontal-alignment: center;
overflow: elide;
}
// Follow chip — only while the user does not follow the artist.
if !root.artist.following: HorizontalLayout {
alignment: center;
Rectangle {
width: chip-row.preferred-width;
height: 30px;
border-radius: 15px;
background: follow-ta.has-hover
? Theme.surface-hover
: Theme.surface-elevated;
chip-row := HorizontalLayout {
padding-left: 14px;
padding-right: 14px;
spacing: 6px;
VerticalLayout {
alignment: center;
QbzIcon {
source: @image-url("../assets/icons/user-plus.svg");
width: 14px;
height: 14px;
tint: Theme.text-primary;
}
}
Text {
text: @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("artist", root.artist.id, "follow");
}
}
}
}
}
}