Files
qbz/crates/qbz-slint/ui/artist/ReleaseGrid.slint
T
vicrodh 391cbb86b9 feat(slint): ArtistView overhaul — server-driven buckets, dedicated discography, sort/load-more, Magazine, image fixes
Bucketing now trusts the server release_type: drop the foreign-artist filter
that hid band/guest releases (e.g. Vicky Psarakis' Albums were credited to
Sicksense), render every non-empty bucket, hide 'Purchase Only' (download),
and move 'Other' to the end, collapsed by default. Drop the misleading
per-section item counts.

New 'Latest release' highlight (last_release) and 'Appears On' track section
(tracks_appears_on, previously mislabeled as Compilations).

Per-section persisted 5-mode sort (artist_prefs) + per-section load-more
capped at 4 pages, reusing get_releases_grid. New dedicated discography page
(ArtistReleasesView + artist_releases controller) with sort + infinite scroll,
reached via each section's 'See discography' link.

Magazine/Stories sidebar tab (artist/story) with 1:1 thumbnails and a
Network|Magazine tab switcher; hide the empty similar-artists block to remove
the 'no similar' over populated-discovery incoherence. Header Share action.
Per-release award ribbons.

Fix custom artist AND album images: decode + apply immediately on upload and
resolve the local override on navigation, so a custom image now shows for
artists/albums with no Qobuz artwork.

Data layer: type last_release as PageArtistRelease, add /artist/story endpoint
+ core/client methods + ArtistStory* models, export ArtistReleases* globals.

cc
2026-06-21 21:42:22 -06:00

143 lines
5.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Wrapping grid of AlbumCards for the artist page's release sections
// (Albums, EPs & Singles, Live, Compilations, …).
//
// The discography lays these as grids — never as horizontally paginated
// carousels — so a long discography wraps into rows and the whole shape
// stays scannable. Pattern mirrors `discover/GridSection`: absolute
// positioning inside a Rectangle whose height comes from the row count.
//
// Header carries a per-section sort + a "See discography" link to the
// dedicated page. No item COUNT is shown — the bucket preview is partial
// (has_more), so a count would mislead (e.g. "Live 7" when there are more).
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { ArtistReleaseSection } from "../state.slint";
import { AlbumCard } from "../discover/AlbumCard.slint";
import { QbzSelect } from "../primitives/QbzSelect.slint";
export component ReleaseGrid inherits VerticalLayout {
in property <ArtistReleaseSection> section;
// Hide the title/sort/see-all header row — used by the collapsible
// "Other" section, which supplies its own header + collapse toggle.
in property <bool> hide-header: false;
callback album-clicked(string);
callback media-action(string, string, string);
callback set-section-sort(string /* release-type */, string /* sort */);
callback load-more-section(string /* release-type */);
callback open-releases(string /* release-type */);
property <length> card-width: 200px;
property <length> card-height: 246px;
property <length> gap: 24px;
property <int> count: root.section.albums.length;
// sort-by string -> QbzSelect index.
property <int> sort-index:
root.section.sort-by == "newest" ? 1 :
root.section.sort-by == "oldest" ? 2 :
root.section.sort-by == "title-asc" ? 3 :
root.section.sort-by == "title-desc" ? 4 : 0;
spacing: 12px;
// --- Header: title + see-discography link + sort ---------------------
if !root.hide-header: HorizontalLayout {
spacing: 12px;
Text {
text: root.section.title;
color: Theme.text-primary;
font-size: Typography.heading;
font-weight: Typography.semibold;
vertical-alignment: center;
horizontal-stretch: 1;
}
Rectangle {
width: see-all-text.preferred-width;
height: 28px;
see-all-text := Text {
text: @tr("See discography");
color: see-all-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
font-size: 13px;
vertical-alignment: center;
}
see-all-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.open-releases(root.section.release-type);
}
}
}
QbzSelect {
sm: true;
menu-width: 150px;
current-index: root.sort-index;
options: [
@tr("Default"),
@tr("Newest"),
@tr("Oldest"),
@tr("A–Z"),
@tr("Z–A"),
];
selected(idx) => {
root.set-section-sort(
root.section.release-type,
idx == 1 ? "newest"
: idx == 2 ? "oldest"
: idx == 3 ? "title-asc"
: idx == 4 ? "title-desc"
: "default");
}
}
}
// --- Grid: absolute-positioned cards inside a sized Rectangle --------
grid := Rectangle {
// Columns recomputed per resize so the grid flows from 5 wide
// at large viewports down to 2 on narrow ones.
property <int> columns: Math.max(
1,
Math.floor((self.width + root.gap) / (root.card-width + root.gap)));
property <int> rows: Math.ceil(root.count / self.columns);
height: self.rows > 0
? self.rows * root.card-height + Math.max(0, self.rows - 1) * root.gap
: 0px;
for album[i] in root.section.albums: AlbumCard {
x: Math.mod(i, grid.columns) * (root.card-width + root.gap);
y: Math.floor(i / grid.columns) * (root.card-height + root.gap);
width: root.card-width;
height: root.card-height;
album: album;
clicked(id) => {
root.album-clicked(id);
}
media-action(kind, id, action) => {
root.media-action(kind, id, action);
}
}
}
// --- Load more (per-section, capped to 4 pages on the index) ---------
if root.section.has-more: HorizontalLayout {
alignment: center;
Rectangle {
width: load-more-text.preferred-width + 24px;
height: 28px;
load-more-text := Text {
text: @tr("Load more");
color: load-more-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
font-size: 13px;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
}
load-more-ta := TouchArea {
mouse-cursor: pointer;
clicked => {
root.load-more-section(root.section.release-type);
}
}
}
}
}