feat(slint): port Awards pages (landing + albums listing + follow)
Port Tauri's AwardView/AwardAlbumsView to Slint: the award landing (hero + acclaimed-releases preview grid + other-awards rail + follow heart), the paginated albums listing with client-side search, and clickable album-sidebar laurels that open the award page (resolving the award id by name when /album/get omits it). - AwardState/AwardActions globals + AwardEntry; AlbumState.awards now carries award ids - award controller (src/award.rs): /award/page hero (never page.releases), /award/getAlbums grid, /award/explore other-awards + name->id resolver; follow via the shared favorite_awards cache (plural-read/singular-write favType, skip-if-remote, login seed) - nav registration: NavEntry::Award/AwardAlbums, ContentView arms, navigate_award/navigate_award_albums, AppShell mounts, app.slint exports - ArtworkTarget::AwardAlbum/AwardOther cc
This commit is contained in:
12 files changed
+1933
-10
No files matched your search
@@ -847,9 +847,20 @@ export component AlbumPageView inherits Rectangle {
|
||||
}
|
||||
for award in AlbumState.awards: SidebarCard {
|
||||
icon: @image-url("../assets/laurels.svg");
|
||||
name: award;
|
||||
name: award.name;
|
||||
compact: ShellState.content-constrained;
|
||||
avatar-bg: @linear-gradient(135deg, #b45309 0%, #eab308 100%);
|
||||
// Navigate to the award page. With an id, open it
|
||||
// directly; without one (Qobuz omits it on some
|
||||
// /album/get entries) pass the NAME and let the
|
||||
// controller resolve it (or toast if unresolved).
|
||||
clicked => {
|
||||
if (award.id != "") {
|
||||
root.media-action("award", award.id, "open");
|
||||
} else if (award.name != "") {
|
||||
root.media-action("award", award.name, "resolve-open");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { ShellState, MiniPlayerState } from "state.slint";
|
||||
import { MiniShell } from "miniplayer/MiniShell.slint";
|
||||
|
||||
// Re-export the state globals so the Rust layer can populate them.
|
||||
export { HomeState, HomeActions, DiscoverState, DiscoverActions, SectionDescriptor, ConfigRow, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, BlacklistState, BlacklistActions, BlacklistedArtistItem, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, CastState, CastDevice, CastActions, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, DacWizardState, DacWizardActions, DacCandidateRow, RemediationRow, DacConfigRow, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState, MiniPlayerState } from "state.slint";
|
||||
export { HomeState, HomeActions, DiscoverState, DiscoverActions, SectionDescriptor, ConfigRow, DiscoverBrowseState, DiscoverBrowseActions, ForYouState, MixState, GenreFilterState, GenreFilterActions, AlbumState, ArtistState, NavState, ShellState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, LyricsState, LyricsLineItem, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions, LabelState, LabelActions, AwardState, AwardActions, AwardEntry, LocationViewState, LocationViewActions, FavoritesState, FavoritesActions, PlaylistPickerState, PlaylistPickerActions, DuplicateConfirmState, DuplicateConfirmActions, PlaylistState, PlaylistActions, SidebarState, SidebarActions, SidebarFolderPopupState, CreatePlaylistState, CreatePlaylistActions, EditPlaylistState, EditPlaylistActions, CreateFolderState, CreateFolderActions, MyQbzCreateState, MyQbzCreateActions, DragState, DragActions, PlaylistManagerState, PlaylistManagerActions, OfflineManagerState, OfflineManagerActions, BlacklistState, BlacklistActions, BlacklistedArtistItem, MyQbzState, MyQbzActions, MixtapeCardItem, MyQbzAddState, MyQbzAddActions, MyQbzAddRow, MyQbzDetailState, MyQbzDetailActions, MixtapeDetailItem, MyQbzEditState, MyQbzEditActions, MyQbzMixState, MyQbzMixActions, DiscoBuilderState, DiscoBuilderActions, DiscoGroup, DiscoCandidate, LocalLibraryState, LocalLibraryActions, LibraryFoldersState, LibFolderEditState, LibraryManageActions, LibraryScanState, LibAlbumFilterState, LocalAlbumState, LocalAlbumActions, TagEditorState, TagEditorActions, FolderEditState, FolderEditActions, ToastState, TextUtil, QconnectDevState, QconnectDevice, CastState, CastDevice, CastActions, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, DacWizardState, DacWizardActions, DacCandidateRow, RemediationRow, DacConfigRow, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState, MiniPlayerState } from "state.slint";
|
||||
|
||||
// Which top-level screen is shown. The app starts on `splash` while it
|
||||
// restores a saved session, then resolves to `shell` or `login`.
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
// Award "See all" full-list page — every album carrying a given award,
|
||||
// shown as a paginated full grid with a client-side search filter.
|
||||
// Opened ONLY from AwardView's "See all" link. Mirrors Tauri's
|
||||
// AwardAlbumsView.svelte: the back/forward NavButtons + a kicker/title
|
||||
// block sit on the LEFT, the search box floats RIGHT on the same row.
|
||||
// AwardAlbums is the SIMPLE listing — NO sort dropdown, NO Hi-Res filter,
|
||||
// NO group-by-artist, NO grid/list toggle (those belong to Label).
|
||||
//
|
||||
// Structure homologated with DiscoverBrowseView: a fixed header, then an
|
||||
// infinite-scroll Flickable driving AwardActions.load-more() when the
|
||||
// viewport nears the bottom, gated on has-more + the loading flags AND an
|
||||
// empty search query (a client-side search filter must not keep paging the
|
||||
// catalog). The grid renders AwardState.visible (the search-filtered list),
|
||||
// kept live by sharing AwardState.albums when the query is empty.
|
||||
//
|
||||
// Two cheap improvements over Tauri:
|
||||
// 1. Distinct empty states — Tauri shows the same "No award-winning
|
||||
// releases yet." for both an empty award AND no-search-results; here a
|
||||
// non-empty query gets the reused search-empty message instead.
|
||||
// 2. open-artist IS wired on the album cards — Tauri drops the
|
||||
// onArtistClick prop in this view (artist-nav-from-card is dead there).
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { AwardState, AwardActions, NavState, ShellState } from "../state.slint";
|
||||
import { AlbumCollectionView } from "../discover/AlbumCollectionView.slint";
|
||||
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
|
||||
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
||||
import { NavButtons } from "../shell/NavButtons.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
|
||||
// Search field — a leading magnifier, the input, and a trailing X that
|
||||
// clears (mirrors Tauri's .search-wrapper; same visual as BrowseSearch).
|
||||
component AwardSearch inherits Rectangle {
|
||||
height: 34px;
|
||||
width: 200px;
|
||||
border-radius: 6px;
|
||||
background: Theme.surface-elevated;
|
||||
border-width: 1px;
|
||||
border-color: input.has-focus ? Theme.accent : Theme.border-subtle;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: 10px;
|
||||
padding-right: 6px;
|
||||
spacing: 8px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
QbzIcon {
|
||||
source: @image-url("../assets/icons/search.svg");
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
tint: Theme.text-muted;
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
clip: true;
|
||||
input := TextInput {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: Theme.text-primary;
|
||||
font-size: 13px;
|
||||
vertical-alignment: center;
|
||||
single-line: true;
|
||||
text <=> AwardState.search-query;
|
||||
edited => {
|
||||
AwardActions.search(self.text);
|
||||
}
|
||||
}
|
||||
Text {
|
||||
visible: input.text == "";
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// Reused discover placeholder (discover.searchPlaceholder).
|
||||
text: @tr("Search albums & tracks…");
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
vertical-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
// Trailing X — clears the query.
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Rectangle {
|
||||
visible: AwardState.search-query != "";
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 4px;
|
||||
background: clear-ta.has-hover ? Theme.surface-hover : transparent;
|
||||
QbzIcon {
|
||||
source: @image-url("../assets/icons/x.svg");
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
tint: clear-ta.has-hover ? Theme.text-primary : Theme.text-muted;
|
||||
}
|
||||
clear-ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AwardState.search-query = "";
|
||||
AwardActions.search("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component AwardAlbumsView inherits Rectangle {
|
||||
callback open-album(string);
|
||||
callback open-artist(string);
|
||||
callback media-action(string, string, string);
|
||||
|
||||
property <length> album-w: 200px;
|
||||
property <length> album-h: 266px;
|
||||
property <length> gap: 24px;
|
||||
|
||||
background: Theme.surface-main;
|
||||
|
||||
VerticalLayout {
|
||||
spacing: 0px;
|
||||
|
||||
// --- Fixed header (always visible) -------------------------------
|
||||
// NavButtons + the kicker/title block on the LEFT (kicker = the
|
||||
// award name, uppercase, server text bound directly; title =
|
||||
// "Acclaimed Releases"); the search box floats RIGHT. Like the
|
||||
// Discover toolbar: a fixed bar whose back/forward buttons keep the
|
||||
// same screen position as every page (center at y=25 = 11px top +
|
||||
// 14px half-button). Only the list below scrolls.
|
||||
Rectangle {
|
||||
height: 56px;
|
||||
background: Theme.surface-main;
|
||||
|
||||
// Left cluster — nav buttons then the kicker/title block, inline.
|
||||
HorizontalLayout {
|
||||
x: 32px;
|
||||
y: 25px - self.height / 2;
|
||||
width: self.preferred-width;
|
||||
height: self.preferred-height;
|
||||
spacing: 16px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
NavButtons { }
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 2px;
|
||||
// Kicker — the award name, server text (NEVER @tr).
|
||||
Text {
|
||||
text: AwardState.name;
|
||||
color: Theme.text-muted;
|
||||
font-size: 11px;
|
||||
font-weight: Typography.semibold;
|
||||
letter-spacing: 0.6px;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Acclaimed Releases");
|
||||
color: Theme.text-primary;
|
||||
font-size: Typography.section;
|
||||
font-weight: Typography.bold;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Right cluster — the search box, anchored right.
|
||||
HorizontalLayout {
|
||||
x: parent.width - self.preferred-width - 32px;
|
||||
y: 25px - self.height / 2;
|
||||
width: self.preferred-width;
|
||||
height: self.preferred-height;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
AwardSearch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Scrolling list (only the listing scrolls) ------------------
|
||||
flick := Flickable {
|
||||
vertical-stretch: 1;
|
||||
viewport-width: self.width;
|
||||
viewport-height: page.preferred-height;
|
||||
// Scroll-position restore on back/forward (see nav::scope_for).
|
||||
property <string> sr-armed: NavState.restore-scope;
|
||||
function sr-restore() {
|
||||
if (NavState.restore-scope == "award-albums" && self.viewport-height > self.height) {
|
||||
self.viewport-y = NavState.scroll-restore;
|
||||
NavState.restore-scope = "";
|
||||
}
|
||||
}
|
||||
init => { self.sr-restore(); }
|
||||
changed sr-armed => { self.sr-restore(); }
|
||||
changed viewport-height => { self.sr-restore(); }
|
||||
|
||||
// Infinite scroll — when the viewport nears the bottom of the
|
||||
// content (within 600px), pull the next page. Guarded by
|
||||
// has-more + the loading flags AND an empty search query, so a
|
||||
// client-side search filter does not keep paging the catalog.
|
||||
changed viewport-y => {
|
||||
NavState.report-scroll(self.viewport-y);
|
||||
if (-self.viewport-y + self.height >= self.viewport-height - 600px
|
||||
&& AwardState.has-more
|
||||
&& !AwardState.load-more-loading
|
||||
&& !AwardState.loading
|
||||
&& AwardState.search-query == "") {
|
||||
AwardActions.load-more();
|
||||
}
|
||||
}
|
||||
|
||||
page := VerticalLayout {
|
||||
width: parent.width;
|
||||
padding-left: 32px;
|
||||
padding-right: 32px;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 100px;
|
||||
spacing: 0px;
|
||||
alignment: start;
|
||||
|
||||
// Initial-load spinner.
|
||||
if AwardState.loading: HorizontalLayout {
|
||||
alignment: center;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 12px;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
LoadingSpinner { size: 36px; }
|
||||
}
|
||||
Text {
|
||||
text: @tr("Loading…");
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Error branch — failed load + retry (full reset, like
|
||||
// Tauri's fetchPage(true) retry).
|
||||
if !AwardState.loading && AwardState.load-error: HorizontalLayout {
|
||||
alignment: center;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 12px;
|
||||
Text {
|
||||
text: @tr("Failed to load Library");
|
||||
color: Theme.text-secondary;
|
||||
font-size: 14px;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
Rectangle {
|
||||
width: retry-row.preferred-width;
|
||||
height: 34px;
|
||||
border-radius: 6px;
|
||||
background: retry-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated;
|
||||
retry-row := HorizontalLayout {
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
Text {
|
||||
text: @tr("Retry");
|
||||
color: Theme.text-primary;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.medium;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
retry-ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AwardActions.retry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Empty states (improvement #1 — distinct branches).
|
||||
// No-search-results: reuse DiscoverBrowse's search-empty
|
||||
// string when a query filtered everything out.
|
||||
if !AwardState.loading && !AwardState.load-error
|
||||
&& AwardState.visible.length == 0
|
||||
&& AwardState.search-query != "": HorizontalLayout {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: @tr("No results found.");
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
// Genuinely-empty award (no query active).
|
||||
if !AwardState.loading && !AwardState.load-error
|
||||
&& AwardState.visible.length == 0
|
||||
&& AwardState.search-query == "": HorizontalLayout {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: @tr("No award-winning releases yet.");
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Album grid (plain grid; no toolbar) ----------------
|
||||
if !AwardState.loading && !AwardState.load-error: AlbumCollectionView {
|
||||
albums: AwardState.visible;
|
||||
view-mode: "grid";
|
||||
is-grouped: false;
|
||||
show-source: false;
|
||||
card-width: root.album-w;
|
||||
card-height: root.album-h;
|
||||
card-gap: root.gap;
|
||||
open-album(id) => { root.open-album(id); }
|
||||
// Improvement #2 — wire open-artist (Tauri leaves it dead).
|
||||
open-artist(id) => { root.open-artist(id); }
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom load-more spinner while the next page is in flight.
|
||||
if AwardState.load-more-loading: HorizontalLayout {
|
||||
alignment: center;
|
||||
Rectangle { height: 24px; }
|
||||
LoadingSpinner { size: 28px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shared scrollbar in the right gutter (homologated cross-view). Sits
|
||||
// below the fixed 56px header so it tracks only the scrolling list.
|
||||
ListScrollbar {
|
||||
x: parent.width - self.width - 4px;
|
||||
y: 56px;
|
||||
width: 14px;
|
||||
height: parent.height - 56px;
|
||||
viewport-height: flick.viewport-height;
|
||||
visible-height: flick.height;
|
||||
viewport-y <=> flick.viewport-y;
|
||||
auto-hide: true;
|
||||
hover-active: ShellState.pointer-in-window
|
||||
&& ShellState.pointer-x >= flick.absolute-position.x
|
||||
&& ShellState.pointer-x <= flick.absolute-position.x + flick.width
|
||||
&& ShellState.pointer-y >= flick.absolute-position.y
|
||||
&& ShellState.pointer-y <= flick.absolute-position.y + flick.height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
// Award landing page — a 1:1 port of Tauri's AwardView.svelte: a circular
|
||||
// laurel/gold hero with the award name + magazine + a Follow heart, a
|
||||
// section header ("Acclaimed Releases" + count + "See all" when more
|
||||
// exist), a bounded PREVIEW grid of award-winning releases (loading /
|
||||
// error+retry / empty / grid branches), and an "Other awards" carousel.
|
||||
//
|
||||
// Faithful composition from existing primitives — the scaffold (Flickable
|
||||
// + NavButtons + 32px page padding + shared ListScrollbar + NavState
|
||||
// scroll restore) mirrors LabelPageView; the hero laurel uses the album
|
||||
// sidebar's gold gradient; the preview grid reuses AlbumCollectionView
|
||||
// (the DiscoverBrowse/Label grid); the "Other awards" rail reuses the
|
||||
// SlimItem ArtistCarousel (LabelPageView's "More labels" precedent). No
|
||||
// new widgets — only this composition.
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { AwardState, AwardActions, NavState, DragState } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { CircleAction } from "../primitives/CircleAction.slint";
|
||||
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
|
||||
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
||||
import { NavButtons } from "../shell/NavButtons.slint";
|
||||
import { AlbumCollectionView } from "../discover/AlbumCollectionView.slint";
|
||||
import { ArtistCarousel } from "../discover/ArtistCarousel.slint";
|
||||
|
||||
component SectionTitle inherits Text {
|
||||
color: Theme.text-primary;
|
||||
font-size: Typography.heading;
|
||||
font-weight: Typography.semibold;
|
||||
}
|
||||
|
||||
export component AwardView inherits Rectangle {
|
||||
callback open-album(string);
|
||||
callback open-artist(string);
|
||||
callback media-action(string, string, string);
|
||||
|
||||
background: Theme.surface-main;
|
||||
|
||||
page-flickable := Flickable {
|
||||
// Don't scroll while a track is being dragged out (keeps the row's
|
||||
// pointer grab so drag-end fires) — matches the other content views.
|
||||
interactive: !DragState.active;
|
||||
viewport-width: self.width;
|
||||
viewport-height: page.preferred-height;
|
||||
// Scroll-position restore on back/forward (see nav::scope_for).
|
||||
property <string> sr-armed: NavState.restore-scope;
|
||||
function sr-restore() {
|
||||
if (NavState.restore-scope == "award" && self.viewport-height > self.height) {
|
||||
self.viewport-y = NavState.scroll-restore;
|
||||
NavState.restore-scope = "";
|
||||
}
|
||||
}
|
||||
init => { self.sr-restore(); }
|
||||
changed sr-armed => { self.sr-restore(); }
|
||||
changed viewport-height => { self.sr-restore(); }
|
||||
changed viewport-y => { NavState.report-scroll(self.viewport-y); }
|
||||
|
||||
page := VerticalLayout {
|
||||
width: parent.width;
|
||||
padding-left: 32px;
|
||||
padding-right: 32px;
|
||||
padding-top: 11px;
|
||||
padding-bottom: 100px;
|
||||
spacing: 0px;
|
||||
alignment: start;
|
||||
|
||||
// --- History navigation --------------------------------------
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
NavButtons { }
|
||||
}
|
||||
|
||||
Rectangle { height: 22px; }
|
||||
|
||||
// --- Award hero header ---------------------------------------
|
||||
HorizontalLayout {
|
||||
spacing: 32px;
|
||||
alignment: start;
|
||||
|
||||
// Circular 180px hero — the award/magazine image when set,
|
||||
// otherwise a white laurel on the gold gradient (matches the
|
||||
// album sidebar AWARDS avatar styling).
|
||||
Rectangle {
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
border-radius: 90px;
|
||||
background: @linear-gradient(135deg, #b45309 0%, #eab308 100%);
|
||||
drop-shadow-blur: 32px;
|
||||
drop-shadow-color: #00000080;
|
||||
drop-shadow-offset-y: 8px;
|
||||
clip: true;
|
||||
if AwardState.image-url == "": QbzIcon {
|
||||
source: @image-url("../assets/laurels.svg");
|
||||
width: 84px;
|
||||
height: 84px;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
tint: #ffffff;
|
||||
}
|
||||
if AwardState.image-url != "": Image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
source: AwardState.image;
|
||||
image-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
padding-top: 8px;
|
||||
spacing: 0px;
|
||||
horizontal-stretch: 1;
|
||||
|
||||
Text {
|
||||
text: @tr("Award");
|
||||
color: Theme.text-muted;
|
||||
font-size: 10px;
|
||||
font-weight: Typography.semibold;
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
Rectangle { height: 6px; }
|
||||
Text {
|
||||
text: AwardState.name;
|
||||
color: Theme.text-primary;
|
||||
font-size: Typography.section;
|
||||
font-weight: Typography.bold;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
// Magazine line — only when present (server text, untranslated).
|
||||
if AwardState.magazine-name != "": Rectangle { height: 10px; }
|
||||
if AwardState.magazine-name != "": Text {
|
||||
text: AwardState.magazine-name;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Typography.body;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
Rectangle { height: 18px; }
|
||||
|
||||
// Follow heart — three states: not-following / following /
|
||||
// toggling (disabled while the API call is in flight). The
|
||||
// filled heart + accent tint marks the followed state; the
|
||||
// disabled state dims (CircleAction enabled=false).
|
||||
HorizontalLayout {
|
||||
alignment: start;
|
||||
CircleAction {
|
||||
primary: false;
|
||||
diameter: 44px;
|
||||
active: AwardState.is-following;
|
||||
enabled: !AwardState.following-toggling;
|
||||
icon: AwardState.is-following
|
||||
? @image-url("../assets/icons/heart-filled.svg")
|
||||
: @image-url("../assets/icons/heart.svg");
|
||||
tooltip: AwardState.is-following
|
||||
? @tr("Unfollow award")
|
||||
: @tr("Follow award");
|
||||
clicked => {
|
||||
AwardActions.toggle-follow(AwardState.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 32px; }
|
||||
|
||||
// --- Section header: title + count + "See all" ---------------
|
||||
HorizontalLayout {
|
||||
spacing: 12px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
HorizontalLayout {
|
||||
spacing: 10px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
SectionTitle {
|
||||
text: @tr("Acclaimed Releases");
|
||||
}
|
||||
}
|
||||
// Count badge — shown only when the total hint is > 0.
|
||||
if AwardState.total > 0: VerticalLayout {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: "\{AwardState.total}";
|
||||
color: Theme.text-muted;
|
||||
font-size: Typography.body;
|
||||
font-weight: Typography.medium;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// "See all" — only when there are more albums than the preview.
|
||||
if AwardState.has-more: VerticalLayout {
|
||||
alignment: center;
|
||||
see-all := Rectangle {
|
||||
width: see-all-text.preferred-width + 16px;
|
||||
height: 26px;
|
||||
border-radius: 4px;
|
||||
background: see-all-ta.has-hover ? Theme.surface-hover : transparent;
|
||||
see-all-text := Text {
|
||||
// "See All" is the contract i18n value; the arrow
|
||||
// glyph is decoration appended outside the msgid.
|
||||
text: @tr("See All") + " →";
|
||||
color: see-all-ta.has-hover ? Theme.text-primary : Theme.text-secondary;
|
||||
font-size: 14px;
|
||||
font-weight: Typography.medium;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
}
|
||||
see-all-ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AwardActions.open-albums();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { height: 16px; }
|
||||
|
||||
// --- Body: loading / error+retry / empty / grid (exclusive) --
|
||||
if AwardState.loading: Rectangle {
|
||||
height: 280px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 18px;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
LoadingSpinner { size: 36px; }
|
||||
}
|
||||
Text {
|
||||
text: @tr("Loading…");
|
||||
color: Theme.text-muted;
|
||||
font-size: 13px;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !AwardState.loading && AwardState.load-error: Rectangle {
|
||||
height: 240px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
spacing: 16px;
|
||||
Text {
|
||||
text: @tr("Failed to load Library");
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
retry-btn := Rectangle {
|
||||
width: retry-text.preferred-width + 32px;
|
||||
height: 34px;
|
||||
border-radius: 6px;
|
||||
background: retry-ta.has-hover
|
||||
? Theme.surface-hover
|
||||
: Theme.surface-elevated;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-subtle;
|
||||
retry-text := Text {
|
||||
text: @tr("Retry");
|
||||
color: Theme.text-primary;
|
||||
font-size: 13px;
|
||||
font-weight: Typography.medium;
|
||||
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||
}
|
||||
retry-ta := TouchArea {
|
||||
mouse-cursor: pointer;
|
||||
clicked => {
|
||||
AwardActions.retry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !AwardState.loading && !AwardState.load-error
|
||||
&& AwardState.albums.length == 0: Rectangle {
|
||||
height: 200px;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: @tr("No award-winning releases yet.");
|
||||
color: Theme.text-muted;
|
||||
font-size: 14px;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The PREVIEW grid (reuses the DiscoverBrowse/Label grid).
|
||||
if !AwardState.loading && !AwardState.load-error
|
||||
&& AwardState.albums.length > 0: AlbumCollectionView {
|
||||
albums: AwardState.albums;
|
||||
view-mode: "grid";
|
||||
is-grouped: false;
|
||||
show-source: false;
|
||||
open-album(id) => { root.open-album(id); }
|
||||
open-artist(id) => { root.open-artist(id); }
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Other awards carousel -----------------------------------
|
||||
// Reuses the SlimItem ArtistCarousel (LabelPageView's "More
|
||||
// labels" precedent): circular cards, title = award name,
|
||||
// subtitle = magazine. No follow chip here.
|
||||
if AwardState.other-awards.length > 0: Rectangle { height: 32px; }
|
||||
if AwardState.other-awards.length > 0: ArtistCarousel {
|
||||
title: @tr("Other awards");
|
||||
artists: AwardState.other-awards;
|
||||
card-follow-mode: "none";
|
||||
artist-clicked(id) => {
|
||||
AwardActions.open-award(id, "");
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shared scrollbar in the right gutter (homologated cross-view).
|
||||
ListScrollbar {
|
||||
x: parent.width - self.width - 4px;
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
viewport-height: page-flickable.viewport-height;
|
||||
visible-height: page-flickable.height;
|
||||
viewport-y <=> page-flickable.viewport-y;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,8 @@ import { ArtistPageView } from "../artist/ArtistPageView.slint";
|
||||
import { MusicianPageView } from "../musician/MusicianPageView.slint";
|
||||
import { LabelReleasesView } from "../label/LabelReleasesView.slint";
|
||||
import { LabelPageView } from "../label/LabelPageView.slint";
|
||||
import { AwardView } from "../award/AwardView.slint";
|
||||
import { AwardAlbumsView } from "../award/AwardAlbumsView.slint";
|
||||
import { ArtistsByLocationView } from "../location/ArtistsByLocationView.slint";
|
||||
import { FavoritesView } from "../favorites/FavoritesView.slint";
|
||||
import { FavoritesOfflineRail } from "../favorites/FavoritesOfflineRail.slint";
|
||||
@@ -99,6 +101,8 @@ export component AppShell inherits Rectangle {
|
||||
|| NavState.view == ContentView.musician
|
||||
|| NavState.view == ContentView.label
|
||||
|| NavState.view == ContentView.label-releases
|
||||
|| NavState.view == ContentView.award
|
||||
|| NavState.view == ContentView.award-albums
|
||||
|| NavState.view == ContentView.location
|
||||
|| NavState.view == ContentView.mix
|
||||
// Playlist: LOCAL playlists and the offline sidecar rendering of a
|
||||
@@ -281,6 +285,28 @@ export component AppShell inherits Rectangle {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if NavState.view == ContentView.award && !OfflineState.offline: AwardView {
|
||||
open-album(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
open-artist(id) => {
|
||||
root.open-artist(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if NavState.view == ContentView.award-albums && !OfflineState.offline: AwardAlbumsView {
|
||||
open-album(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
open-artist(id) => {
|
||||
root.open-artist(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if NavState.view == ContentView.location && !OfflineState.offline: ArtistsByLocationView {
|
||||
open-artist(id) => {
|
||||
root.open-artist(id);
|
||||
|
||||
@@ -68,6 +68,15 @@ export struct SlimItem {
|
||||
following: bool,
|
||||
}
|
||||
|
||||
// One editorial award on an album — the sidebar AWARDS list. Carries the
|
||||
// award id (may be "" — some /album/get entries omit it; the controller
|
||||
// then resolves it by name) so the laurel card can navigate to the award
|
||||
// page. Mirrors Tauri's `AlbumAward { id?, name }`.
|
||||
export struct AwardEntry {
|
||||
id: string,
|
||||
name: string,
|
||||
}
|
||||
|
||||
// A playlist result in search (and the label landing's Playlists row).
|
||||
// Qobuz returns up to four cover URLs per playlist; the card renders them
|
||||
// as a count-based collage. Defined here (before LabelState) so the label
|
||||
@@ -419,7 +428,7 @@ export global AlbumState {
|
||||
in property <string> label;
|
||||
// Label id for the sidebar label card → label page navigation ("" = none).
|
||||
in property <string> label-id;
|
||||
in property <[string]> awards: [];
|
||||
in property <[AwardEntry]> awards: [];
|
||||
// True when the album ships a downloadable booklet/liner-notes PDF
|
||||
// (Qobuz goodies). Gates the booklet button in the header — not every
|
||||
// album has one.
|
||||
@@ -601,7 +610,7 @@ export global DragActions {
|
||||
}
|
||||
|
||||
// Which content view the shell shows.
|
||||
export enum ContentView { home, album, artist, settings, search, musician, label, label-releases, location, favorites, mix, playlist, discover-browse, playlist-manager, offline-manager, blacklist-manager, local-library, local-album, mixtapes, collections, mixtape-detail, discography-builder }
|
||||
export enum ContentView { home, album, artist, settings, search, musician, label, label-releases, award, award-albums, location, favorites, mix, playlist, discover-browse, playlist-manager, offline-manager, blacklist-manager, local-library, local-album, mixtapes, collections, mixtape-detail, discography-builder }
|
||||
|
||||
// In-app toast (transient notification). Mirrors Tauri's toastStore:
|
||||
// a single toast at a time (a new one replaces the current), auto-hidden
|
||||
@@ -3027,6 +3036,63 @@ export global LabelActions {
|
||||
callback search(string /* query */);
|
||||
}
|
||||
|
||||
// Award pages (AwardView landing + AwardAlbumsView listing) — mirrors
|
||||
// Tauri's AwardView.svelte / AwardAlbumsView.svelte. One global serves
|
||||
// both, like LabelState: the landing renders the hero + `albums` preview
|
||||
// (first /award/getAlbums page) + `other-awards`; the listing renders the
|
||||
// full paginated `albums` with client-side search (`visible`). The grid is
|
||||
// always sourced from /award/getAlbums — never `/award/page.releases`
|
||||
// (user-scoped, hero-only).
|
||||
export global AwardState {
|
||||
in property <string> id;
|
||||
in property <string> name;
|
||||
// Hero image URL (award image, falling back to magazine image) + the
|
||||
// decoded image. Empty image-url => laurel/gold placeholder.
|
||||
in property <string> image-url;
|
||||
in property <image> image;
|
||||
// Magazine name shown under the award name (may be "").
|
||||
in property <string> magazine-name;
|
||||
// Header follow heart — three states: not-following / following /
|
||||
// toggling (disabled while the API call is in flight).
|
||||
in property <bool> is-following: false;
|
||||
in property <bool> following-toggling: false;
|
||||
// Loaded album catalog (landing preview OR full listing) + the artwork
|
||||
// pipeline target (stable indices). `visible` is the search-filtered
|
||||
// subset the listing renders (shares `albums` when the query is empty,
|
||||
// so artwork stays live — the DiscoverBrowse/Label pattern).
|
||||
in property <[AlbumCardItem]> albums: [];
|
||||
in property <[AlbumCardItem]> visible: [];
|
||||
in property <int> total: 0;
|
||||
in property <bool> has-more: false;
|
||||
in property <bool> loading: false;
|
||||
in property <bool> load-more-loading: false;
|
||||
// True when the releases load failed (drives the error/retry branch).
|
||||
in property <bool> load-error: false;
|
||||
// "Other awards" carousel (from /award/explore, current award excluded).
|
||||
// Reuses SlimItem: title = award name, subtitle = magazine.
|
||||
in property <[SlimItem]> other-awards: [];
|
||||
// True once the landing page-data load resolves (gates the spinner).
|
||||
in property <bool> page-loaded: false;
|
||||
// Listing in-view search query + the count actually shown after filter.
|
||||
in-out property <string> search-query: "";
|
||||
in property <int> shown: 0;
|
||||
}
|
||||
|
||||
export global AwardActions {
|
||||
// Header: toggle follow on the open award.
|
||||
callback toggle-follow(string /* award id */);
|
||||
// Landing "See all" -> open the full albums listing.
|
||||
callback open-albums();
|
||||
// "Other awards" card click -> open that award's landing.
|
||||
callback open-award(string /* award id */, string /* award name */);
|
||||
// Listing: fetch the next album page.
|
||||
callback load-more();
|
||||
// Listing: re-filter `visible` after `search-query` changed (UI thread).
|
||||
callback search(string /* query */);
|
||||
// Releases error branch: retry the failed load.
|
||||
callback retry();
|
||||
}
|
||||
|
||||
// One artist in the scene-discovery grid (artists from the same
|
||||
// place as the source artist).
|
||||
export struct LocationArtistItem {
|
||||
|
||||
Reference in new issue
Block a user