feat(slint/discover): DiscoverState global + prefs controller + load/persist
Add the Slice 5 foundation for the Discover section configurator: a single DiscoverState/DiscoverActions global pair owning both the prefs-driven render descriptor lists and the modal payload, plus a thin frontend controller over the headless qbz_app discover_prefs store. - state.slint: SectionDescriptor + ConfigRow structs and the DiscoverState / DiscoverActions globals (active-tab lives here; render loop + modal read it). - app.slint: re-export the new globals/structs so the Rust layer can bind them. - discover_prefs.rs: per-user store lifecycle (init_for_user/teardown mirror fav_cache), in-memory authoritative prefs, descriptor + config-row push helpers, id->kind/label maps, and toggle/move/reset/open/close handlers (mutate -> persist -> re-push -> re-render, re-firing artwork for the active Home/Editor tab). Labels resolve in Rust (English today) since Slint @tr needs a literal key and the gettext pipeline is unwired. - home.rs: add the SectionData.id key; build the Home/Editor ordered descriptor lists from the cached section data (album ids embed their DiscoverSection, fixed ids carry an empty section); rerender_active_tab + descriptor artwork jobs. Empty album sections are dropped (policy b); placeholder-bearing Home sections are kept and gated in the view. - artwork.rs: DiscoverSectionAlbum target so covers paint on the descriptor list (DiscoverState.home-sections / editor-sections) rather than HomeState. - main.rs/auth.rs: mod + seed at both shell entries + per-user init/teardown at every session-activation point + the 5 DiscoverActions callback registrations. Descriptor lists are pushed but not yet rendered (the views still draw the old way); no behavior change until the render loop lands. cc
This commit is contained in:
7 files changed
+639
-9
No files matched your search
@@ -35,6 +35,15 @@ pub type ImageCache = Arc<Mutex<Option<ImageCacheService>>>;
|
||||
pub enum ArtworkTarget {
|
||||
/// A card in `HomeState.sections[section_idx].albums[album_idx]`.
|
||||
Section { section_idx: usize, album_idx: usize },
|
||||
/// A card in a Discover descriptor list's embedded album section
|
||||
/// (`DiscoverState.home-sections` / `editor-sections`
|
||||
/// `[section_idx].section.albums[album_idx]`) — Slice 5's prefs-driven
|
||||
/// Home/Editor render loop. `editor` picks which list the job targets.
|
||||
DiscoverSectionAlbum {
|
||||
editor: bool,
|
||||
section_idx: usize,
|
||||
album_idx: usize,
|
||||
},
|
||||
/// A card in `HomeState.popular[idx]`.
|
||||
Popular { idx: usize },
|
||||
/// A card in `HomeState.recent[idx]`.
|
||||
@@ -645,6 +654,26 @@ fn apply_artwork(
|
||||
item.artwork = image;
|
||||
section.albums.set_row_data(album_idx, item);
|
||||
}
|
||||
ArtworkTarget::DiscoverSectionAlbum {
|
||||
editor,
|
||||
section_idx,
|
||||
album_idx,
|
||||
} => {
|
||||
let state = window.global::<crate::DiscoverState>();
|
||||
let sections = if editor {
|
||||
state.get_editor_sections()
|
||||
} else {
|
||||
state.get_home_sections()
|
||||
};
|
||||
let Some(desc) = sections.row_data(section_idx) else {
|
||||
return;
|
||||
};
|
||||
let Some(mut item) = desc.section.albums.row_data(album_idx) else {
|
||||
return;
|
||||
};
|
||||
item.artwork = image;
|
||||
desc.section.albums.set_row_data(album_idx, item);
|
||||
}
|
||||
ArtworkTarget::Popular { idx } => {
|
||||
let popular = home.get_popular();
|
||||
let Some(mut item) = popular.row_data(idx) else {
|
||||
|
||||
@@ -110,6 +110,7 @@ where
|
||||
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
|
||||
crate::offline_mode::init_for_user(&dir);
|
||||
crate::fav_cache::init_for_user(&dir);
|
||||
crate::discover_prefs::init_for_user(&dir);
|
||||
}
|
||||
// Lyrics cache (per-user, shared lyrics.db with Tauri).
|
||||
crate::lyrics::init_for_user(core.client(), user_id);
|
||||
@@ -219,6 +220,7 @@ where
|
||||
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
|
||||
crate::offline_mode::init_for_user(&dir);
|
||||
crate::fav_cache::init_for_user(&dir);
|
||||
crate::discover_prefs::init_for_user(&dir);
|
||||
}
|
||||
// Lyrics cache (per-user, shared lyrics.db with Tauri).
|
||||
crate::lyrics::init_for_user(core.client(), user_id);
|
||||
@@ -265,6 +267,7 @@ where
|
||||
crate::offline::deactivate().await;
|
||||
crate::offline_mode::teardown();
|
||||
crate::fav_cache::teardown();
|
||||
crate::discover_prefs::teardown();
|
||||
crate::lyrics::teardown();
|
||||
runtime.deactivate().await?;
|
||||
log::info!("[qbz-slint] logged out");
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
//! Discover section-configurator controller (Slice 5).
|
||||
//!
|
||||
//! Thin frontend binding over the headless `qbz_app::settings::discover_prefs`
|
||||
//! store (ADR-006: all model logic — defaults, reconcile, toggle, move, reset —
|
||||
//! lives in `qbz-app`; this module only owns the per-user store lifecycle, the
|
||||
//! in-memory authoritative copy, and the push helpers that map prefs into the
|
||||
//! `DiscoverState` Slint global).
|
||||
//!
|
||||
//! Lifecycle mirrors `fav_cache`: a process-global `Mutex<Option<Store>>`
|
||||
//! (persistence) + `Mutex<Option<Prefs>>` (in-memory authoritative, so a UI
|
||||
//! toggle never round-trips SQLite on the event loop), bound per session via
|
||||
//! [`init_for_user`] / [`teardown`] next to the other per-user stores.
|
||||
//!
|
||||
//! The render driver: Rust recomputes `prefs.enabled_ordered(tab)` on every
|
||||
//! mutation and on tab switch, then pushes the ordered descriptor lists. For You
|
||||
//! descriptors are built here (the data lives in `ForYouState`, dispatched by
|
||||
//! id); Home / Editor's Picks descriptors are built in `crate::home` (it owns
|
||||
//! the cached `SectionData` the album-carousel arms embed). The configurator
|
||||
//! modal reads `config-rows` (the FULL ordered list, enabled + disabled).
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use qbz_app::settings::discover_prefs::{
|
||||
default_prefs, DiscoverPrefs, DiscoverPrefsStore, DiscoverySectionId, DiscoveryTab,
|
||||
};
|
||||
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
|
||||
|
||||
use crate::artwork::{ImageCache, spawn_loads};
|
||||
use crate::{AppWindow, ConfigRow, DiscoverSection, DiscoverState, SectionDescriptor};
|
||||
|
||||
/// Per-user persistent store. `None` outside an active session.
|
||||
static STORE: Mutex<Option<DiscoverPrefsStore>> = Mutex::new(None);
|
||||
/// In-memory authoritative prefs — the source of truth for the UI thread.
|
||||
static PREFS: Mutex<Option<DiscoverPrefs>> = Mutex::new(None);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Lifecycle (mirrors fav_cache::{init_for_user, teardown})
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Bind the per-user store and load the persisted prefs into memory. Called on
|
||||
/// every session activation (login / restore / offline entry), next to
|
||||
/// `fav_cache::init_for_user`. Best-effort: a store-open failure logs and falls
|
||||
/// back to in-memory defaults (the configurator still works, just non-persistent).
|
||||
pub fn init_for_user(base_dir: &Path) {
|
||||
match DiscoverPrefsStore::new_at(base_dir) {
|
||||
Ok(store) => {
|
||||
*PREFS.lock().unwrap() = Some(store.load());
|
||||
*STORE.lock().unwrap() = Some(store);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("[qbz-slint] discover prefs store open failed: {e}");
|
||||
*PREFS.lock().unwrap() = Some(default_prefs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Drop the per-user store and in-memory prefs on logout.
|
||||
pub fn teardown() {
|
||||
*STORE.lock().unwrap() = None;
|
||||
*PREFS.lock().unwrap() = None;
|
||||
}
|
||||
|
||||
/// A clone of the current in-memory prefs (defaults if no session yet).
|
||||
fn current() -> DiscoverPrefs {
|
||||
PREFS.lock().unwrap().clone().unwrap_or_else(default_prefs)
|
||||
}
|
||||
|
||||
fn persist() {
|
||||
if let (Some(p), Some(s)) = (
|
||||
PREFS.lock().unwrap().as_ref(),
|
||||
STORE.lock().unwrap().as_ref(),
|
||||
) {
|
||||
if let Err(e) = s.save(p) {
|
||||
log::error!("[qbz-slint] discover prefs save failed: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// id -> render kind / i18n label key
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Coarse render family. Used by the one tab-dependent Home arm: `mostStreamed`
|
||||
/// renders as a slim grid on Home but an album carousel on Editor's Picks. The
|
||||
/// rest of the dispatch is by id; this is harmless metadata for those.
|
||||
pub fn render_kind(id: DiscoverySectionId) -> &'static str {
|
||||
use DiscoverySectionId::*;
|
||||
match id {
|
||||
// Album carousels (Home / Editor share the Carousel component).
|
||||
NewReleases | PressAwards | IdealDiscography | EditorPicks | Qobuzissimes => "albumCarousel",
|
||||
// mostStreamed is overridden per tab in `home::tab_descriptors`; this is
|
||||
// its Home default.
|
||||
MostStreamed => "slimGrid",
|
||||
QobuzPlaylists => "playlistCarousel",
|
||||
RecentlyPlayedAlbums => "albumCarousel",
|
||||
ContinueListening => "slimGrid",
|
||||
QobuzMixes => "qobuzMixes",
|
||||
RadioStations => "radio",
|
||||
TopArtists | ArtistsToFollow => "artistCarousel",
|
||||
ArtistSpotlight => "spotlight",
|
||||
ReleaseWatch | FavoriteAlbums | SimilarAlbums | RediscoverLibrary | EssentialsByGenre => {
|
||||
"albumCarousel"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// id -> Tauri i18n key (frontend concern, NOT in the headless prefs crate per
|
||||
/// ADR-006). Resolved to a string in Rust because Slint `@tr` needs a literal
|
||||
/// key. Returns the English label today (the Slint gettext pipeline is unwired,
|
||||
/// so labels are plain Rust strings — consistent with every other Slint section
|
||||
/// title). When gettext lands this swaps to an MO lookup with NO `.slint` change.
|
||||
/// The keys are kept verbatim (with their real, mixed `home.*` / `discover.*` /
|
||||
/// `discovery.*` namespaces) so the lookup ports 1:1 when the pipeline arrives.
|
||||
pub fn label_for(id: DiscoverySectionId) -> &'static str {
|
||||
use DiscoverySectionId::*;
|
||||
match id {
|
||||
NewReleases => "New Releases", // home.newReleases
|
||||
PressAwards => "Press Accolades", // home.pressAwards
|
||||
QobuzPlaylists => "Qobuz Playlists", // home.qobuzPlaylists
|
||||
RecentlyPlayedAlbums => "Recently Played", // home.recentlyPlayed
|
||||
ContinueListening => "Continue Listening", // home.continueListening
|
||||
IdealDiscography => "Ideal Discography", // discover.idealDiscography
|
||||
MostStreamed => "Most Streamed", // home.mostStreamed
|
||||
ReleaseWatch => "Release Watch", // home.releaseWatch
|
||||
EditorPicks => "Albums of the Week", // home.editorPicks
|
||||
Qobuzissimes => "Qobuzissimes", // home.qobuzissimes
|
||||
TopArtists => "Your Top Artists", // home.yourTopArtists
|
||||
FavoriteAlbums => "Favorite Albums", // home.favoriteAlbums
|
||||
QobuzMixes => "Qobuz Mixes", // home.qobuzMixes
|
||||
RadioStations => "Radio Stations", // home.radioStations
|
||||
SimilarAlbums => "More From Your Library", // discovery.similarAlbums
|
||||
RediscoverLibrary => "Rediscover Your Library", // discovery.rediscoverLibrary
|
||||
EssentialsByGenre => "Essentials by Genre", // discovery.essentialsByGenre
|
||||
ArtistsToFollow => "Artists to Follow", // discovery.artistsToFollow
|
||||
ArtistSpotlight => "Artist Spotlight", // discovery.artistSpotlight
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Descriptor builders
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// A descriptor with no embedded album payload (For You arms dispatch on id and
|
||||
/// read the typed ForYouState fields). `section` is an empty default.
|
||||
fn bare_descriptor(id: DiscoverySectionId) -> SectionDescriptor {
|
||||
SectionDescriptor {
|
||||
id: SharedString::from(id.as_str()),
|
||||
kind: SharedString::from(render_kind(id)),
|
||||
section: DiscoverSection::default(),
|
||||
}
|
||||
}
|
||||
|
||||
/// For You ordered ENABLED descriptors. The For You delegate reads ForYouState
|
||||
/// by id and keeps its own `length > 0` self-hide gate (qobuzMixes excepted), so
|
||||
/// the descriptor list is the pure visibility+order driver and carries no album
|
||||
/// payload. `essentialsByGenre` is DROPPED here: it is Slice-2c-blocked (no
|
||||
/// `ForYouState.essentials` field exists yet), so emitting it would mount a
|
||||
/// delegate with no matching arm. It re-appears automatically once Slice 2c adds
|
||||
/// the field and an arm.
|
||||
fn foryou_descriptors(prefs: &DiscoverPrefs) -> Vec<SectionDescriptor> {
|
||||
prefs
|
||||
.enabled_ordered(DiscoveryTab::ForYou)
|
||||
.into_iter()
|
||||
.filter(|id| *id != DiscoverySectionId::EssentialsByGenre)
|
||||
.map(bare_descriptor)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Push the descriptor lists for ALL three tabs. Home / Editor's Picks lists are
|
||||
/// built by `crate::home` from the cached section data (the album-carousel arms
|
||||
/// embed it); For You is built here. When the active tab is For You the Home /
|
||||
/// Editor lists are pushed EMPTY so the Home repeater renders nothing for that
|
||||
/// tab — content is controlled purely via the model, avoiding a conditional
|
||||
/// repeater (preferred unconditional-repeater form; see HomeView).
|
||||
pub fn push_descriptors(window: &AppWindow, prefs: &DiscoverPrefs) {
|
||||
let state = window.global::<DiscoverState>();
|
||||
let active = state.get_active_tab().to_string();
|
||||
|
||||
// For You list (always pushed; the For You view is mounted only when active).
|
||||
state.set_foryou_sections(ModelRc::new(VecModel::from(foryou_descriptors(prefs))));
|
||||
|
||||
if active == "forYou" {
|
||||
// Drive the Home repeater empty for the For You tab.
|
||||
state.set_home_sections(ModelRc::new(VecModel::from(Vec::<SectionDescriptor>::new())));
|
||||
state.set_editor_sections(ModelRc::new(VecModel::from(Vec::<SectionDescriptor>::new())));
|
||||
} else {
|
||||
// Home + Editor descriptors come from the cached section data.
|
||||
let (home, editor) = crate::home::tab_descriptors(prefs);
|
||||
state.set_home_sections(ModelRc::new(VecModel::from(home)));
|
||||
state.set_editor_sections(ModelRc::new(VecModel::from(editor)));
|
||||
}
|
||||
}
|
||||
|
||||
/// Push the configurator modal payload for one tab: the FULL ordered list
|
||||
/// (enabled AND disabled), with labels resolved in Rust, plus the enabled/total
|
||||
/// counts. `can-move-up/down` are NOT struct fields — the modal computes boundary
|
||||
/// state from the row index, so the struct stays minimal.
|
||||
pub fn push_config_rows(window: &AppWindow, prefs: &DiscoverPrefs, tab: DiscoveryTab) {
|
||||
let rows: Vec<ConfigRow> = prefs
|
||||
.tab(tab)
|
||||
.iter()
|
||||
.map(|p| ConfigRow {
|
||||
id: SharedString::from(p.id.as_str()),
|
||||
label: SharedString::from(label_for(p.id)),
|
||||
enabled: p.enabled,
|
||||
})
|
||||
.collect();
|
||||
let total = rows.len() as i32;
|
||||
let enabled = prefs.enabled_count(tab) as i32;
|
||||
let state = window.global::<DiscoverState>();
|
||||
state.set_config_rows(ModelRc::new(VecModel::from(rows)));
|
||||
state.set_enabled_count(enabled);
|
||||
state.set_total_count(total);
|
||||
}
|
||||
|
||||
/// Seed the descriptor lists at shell entry so the render loop has data before
|
||||
/// the first `apply_home`. Mirrors `myqbz_prefs::seed`.
|
||||
pub fn seed(window: &AppWindow) {
|
||||
let prefs = current();
|
||||
push_descriptors(window, &prefs);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mutation handlers (mutate -> persist -> re-push -> re-render)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// After any mutation: re-push the descriptor lists (visibility + order),
|
||||
/// refresh the live modal rows for the active tab, and re-render Home / Editor
|
||||
/// from the cache (For You's data already lives in ForYouState — descriptors are
|
||||
/// its sole driver). Returns artwork jobs to re-fire for newly-shown Home album
|
||||
/// sections (mirrors `select_tab`'s job return); empty for For You.
|
||||
fn apply_after_mutation(window: &AppWindow, mutated: DiscoveryTab) -> Vec<crate::artwork::ArtworkJob> {
|
||||
let prefs = current();
|
||||
push_descriptors(window, &prefs);
|
||||
if let Some(active) =
|
||||
DiscoveryTab::from_key(window.global::<DiscoverState>().get_active_tab().as_str())
|
||||
{
|
||||
push_config_rows(window, &prefs, active);
|
||||
}
|
||||
match mutated {
|
||||
DiscoveryTab::Home | DiscoveryTab::EditorPicks => {
|
||||
crate::home::rerender_active_tab(window, &prefs)
|
||||
}
|
||||
// For You: descriptor list is the sole driver; data already in ForYouState.
|
||||
DiscoveryTab::ForYou => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_open_configurator(window: &AppWindow) {
|
||||
let prefs = current();
|
||||
if let Some(active) =
|
||||
DiscoveryTab::from_key(window.global::<DiscoverState>().get_active_tab().as_str())
|
||||
{
|
||||
push_config_rows(window, &prefs, active);
|
||||
}
|
||||
window.global::<DiscoverState>().set_configurator_open(true);
|
||||
}
|
||||
|
||||
pub fn on_close_configurator(window: &AppWindow) {
|
||||
window.global::<DiscoverState>().set_configurator_open(false);
|
||||
}
|
||||
|
||||
pub fn on_toggle(window: &AppWindow, tab: &str, id: &str, cache: &ImageCache) {
|
||||
let (Some(tab), Some(id)) = (DiscoveryTab::from_key(tab), DiscoverySectionId::from_str(id))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
if let Some(p) = PREFS.lock().unwrap().as_mut() {
|
||||
p.toggle(tab, id);
|
||||
}
|
||||
persist();
|
||||
let jobs = apply_after_mutation(window, tab);
|
||||
spawn_loads(jobs, window.as_weak(), cache.clone());
|
||||
}
|
||||
|
||||
pub fn on_move(window: &AppWindow, tab: &str, id: &str, dir: i32, cache: &ImageCache) {
|
||||
let (Some(tab), Some(id)) = (DiscoveryTab::from_key(tab), DiscoverySectionId::from_str(id))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let dir = dir.clamp(-1, 1) as i8;
|
||||
if let Some(p) = PREFS.lock().unwrap().as_mut() {
|
||||
p.move_section(tab, id, dir);
|
||||
}
|
||||
persist();
|
||||
let jobs = apply_after_mutation(window, tab);
|
||||
spawn_loads(jobs, window.as_weak(), cache.clone());
|
||||
}
|
||||
|
||||
pub fn on_reset(window: &AppWindow, tab: &str, cache: &ImageCache) {
|
||||
let Some(tab) = DiscoveryTab::from_key(tab) else {
|
||||
return;
|
||||
};
|
||||
if let Some(p) = PREFS.lock().unwrap().as_mut() {
|
||||
p.reset_tab(tab);
|
||||
}
|
||||
persist();
|
||||
let jobs = apply_after_mutation(window, tab);
|
||||
spawn_loads(jobs, window.as_weak(), cache.clone());
|
||||
}
|
||||
|
||||
/// Read-through used by `crate::home::select_tab` so a tab switch recomputes the
|
||||
/// active tab's descriptors from the same prefs the controller owns.
|
||||
pub fn prefs_snapshot() -> DiscoverPrefs {
|
||||
current()
|
||||
}
|
||||
@@ -8,15 +8,19 @@
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
|
||||
use qbz_app::settings::discover_prefs::{DiscoverPrefs, DiscoverySectionId, DiscoveryTab};
|
||||
use qbz_app::shell::AppRuntime;
|
||||
use qbz_core::FrontendAdapter;
|
||||
use qbz_models::{
|
||||
AlbumAward, DiscoverAlbum, DiscoverAudioInfo, DiscoverContainer, DiscoverPlaylist,
|
||||
};
|
||||
use slint::{ComponentHandle, ModelRc, VecModel};
|
||||
use slint::{ComponentHandle, ModelRc, SharedString, VecModel};
|
||||
|
||||
use crate::artwork::{ArtworkJob, ArtworkTarget};
|
||||
use crate::{AlbumCardItem, AppWindow, DiscoverSection, HomeState, SearchPlaylistItem, SlimItem};
|
||||
use crate::{
|
||||
AlbumCardItem, AppWindow, DiscoverSection, DiscoverState, HomeState, SearchPlaylistItem,
|
||||
SectionDescriptor, SlimItem,
|
||||
};
|
||||
|
||||
/// Plain, `Send` home data produced on the worker thread.
|
||||
pub struct HomeData {
|
||||
@@ -49,6 +53,10 @@ struct TabSections {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SectionData {
|
||||
/// The configurator section id this album carousel maps to. Lets the
|
||||
/// prefs-driven render loop key a pref id to its cached section data
|
||||
/// (Slice 5). Album-carousel sections only.
|
||||
pub id: DiscoverySectionId,
|
||||
pub title: String,
|
||||
/// Discover endpoint path for the "View all" page ("" = no full-list page).
|
||||
pub endpoint: String,
|
||||
@@ -125,34 +133,38 @@ where
|
||||
// Home set and the most-streamed slim grid below. Order mirrors
|
||||
// Tauri's DEFAULT_PREFS.editorPicks.
|
||||
let mut editor_sections = Vec::new();
|
||||
push_section_ref(&mut editor_sections, "New Releases", "/discover/newReleases", &containers.new_releases);
|
||||
push_section_ref(&mut editor_sections, "Qobuzissimes", "/discover/qobuzissims", &containers.qobuzissims);
|
||||
push_section_ref(&mut editor_sections, "Press Accolades", "/discover/pressAward", &containers.press_awards);
|
||||
push_section_ref(&mut editor_sections, "Most Streamed", "/discover/mostStreamed", &containers.most_streamed);
|
||||
push_section_ref(&mut editor_sections, DiscoverySectionId::NewReleases, "New Releases", "/discover/newReleases", &containers.new_releases);
|
||||
push_section_ref(&mut editor_sections, DiscoverySectionId::Qobuzissimes, "Qobuzissimes", "/discover/qobuzissims", &containers.qobuzissims);
|
||||
push_section_ref(&mut editor_sections, DiscoverySectionId::PressAwards, "Press Accolades", "/discover/pressAward", &containers.press_awards);
|
||||
push_section_ref(&mut editor_sections, DiscoverySectionId::MostStreamed, "Most Streamed", "/discover/mostStreamed", &containers.most_streamed);
|
||||
push_section_ref(
|
||||
&mut editor_sections,
|
||||
DiscoverySectionId::IdealDiscography,
|
||||
"Ideal Discography",
|
||||
"/discover/idealDiscography",
|
||||
&containers.ideal_discography,
|
||||
);
|
||||
push_section_ref(
|
||||
&mut editor_sections,
|
||||
DiscoverySectionId::EditorPicks,
|
||||
"Albums of the Week",
|
||||
"/discover/albumOfTheWeek",
|
||||
&containers.album_of_the_week,
|
||||
);
|
||||
|
||||
let mut sections = Vec::new();
|
||||
push_section(&mut sections, "New Releases", "/discover/newReleases", containers.new_releases);
|
||||
push_section(&mut sections, "Press Accolades", "/discover/pressAward", containers.press_awards);
|
||||
push_section(&mut sections, DiscoverySectionId::NewReleases, "New Releases", "/discover/newReleases", containers.new_releases);
|
||||
push_section(&mut sections, DiscoverySectionId::PressAwards, "Press Accolades", "/discover/pressAward", containers.press_awards);
|
||||
push_section(
|
||||
&mut sections,
|
||||
DiscoverySectionId::IdealDiscography,
|
||||
"Ideal Discography",
|
||||
"/discover/idealDiscography",
|
||||
containers.ideal_discography,
|
||||
);
|
||||
push_section(
|
||||
&mut sections,
|
||||
DiscoverySectionId::EditorPicks,
|
||||
"Albums of the Week",
|
||||
"/discover/albumOfTheWeek",
|
||||
containers.album_of_the_week,
|
||||
@@ -241,6 +253,7 @@ where
|
||||
|
||||
fn push_section(
|
||||
out: &mut Vec<SectionData>,
|
||||
id: DiscoverySectionId,
|
||||
title: &str,
|
||||
endpoint: &str,
|
||||
container: Option<DiscoverContainer<DiscoverAlbum>>,
|
||||
@@ -252,6 +265,7 @@ fn push_section(
|
||||
return;
|
||||
}
|
||||
out.push(SectionData {
|
||||
id,
|
||||
title: title.to_string(),
|
||||
endpoint: endpoint.to_string(),
|
||||
albums: container.data.items.into_iter().map(map_album).collect(),
|
||||
@@ -262,6 +276,7 @@ fn push_section(
|
||||
/// so the same data can feed more than one tab's section set.
|
||||
fn push_section_ref(
|
||||
out: &mut Vec<SectionData>,
|
||||
id: DiscoverySectionId,
|
||||
title: &str,
|
||||
endpoint: &str,
|
||||
container: &Option<DiscoverContainer<DiscoverAlbum>>,
|
||||
@@ -273,6 +288,7 @@ fn push_section_ref(
|
||||
return;
|
||||
}
|
||||
out.push(SectionData {
|
||||
id,
|
||||
title: title.to_string(),
|
||||
endpoint: endpoint.to_string(),
|
||||
albums: container.data.items.iter().cloned().map(map_album).collect(),
|
||||
@@ -564,6 +580,154 @@ pub fn playlist_artwork_jobs(playlists: &[PlaylistCardData]) -> Vec<ArtworkJob>
|
||||
.collect()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Slice 5 — prefs-driven descriptor lists for Home / Editor's Picks.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Build one Slint `DiscoverSection` from cached album data (mirrors
|
||||
/// `build_sections` for a single entry).
|
||||
fn descriptor_section(data: &SectionData) -> DiscoverSection {
|
||||
DiscoverSection {
|
||||
title: data.title.clone().into(),
|
||||
endpoint: data.endpoint.clone().into(),
|
||||
albums: ModelRc::new(VecModel::from(
|
||||
data.albums.iter().cloned().map(card_to_item).collect::<Vec<_>>(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Build one tab's ordered ENABLED descriptor list from `prefs` + the cached
|
||||
/// section data. Album-carousel ids embed their `DiscoverSection` (Home/Editor
|
||||
/// share the Carousel component but have no per-id HomeState field). The
|
||||
/// fixed-data ids (qobuzPlaylists / continueListening / mostStreamed-slim) and
|
||||
/// the always-present-with-placeholder ids (recentlyPlayedAlbums on Home) bind
|
||||
/// HomeState fields in the view; they carry an empty `section`.
|
||||
///
|
||||
/// **Empty-section policy (b):** an album-carousel id with no cached data is
|
||||
/// DROPPED (no backing `SectionData` → nothing to render, and these have no
|
||||
/// placeholder). recentlyPlayedAlbums / continueListening / qobuzPlaylists /
|
||||
/// mostStreamed are KEPT (the view arm self-hides or shows a placeholder on
|
||||
/// empty data), preserving the 1:1 Home placeholders. This keeps every mounted
|
||||
/// album-carousel delegate non-empty (the documented anti-spacing-doubling form).
|
||||
fn descriptors_for(prefs: &DiscoverPrefs, tab: DiscoveryTab, cached: &[SectionData]) -> Vec<SectionDescriptor> {
|
||||
use DiscoverySectionId::*;
|
||||
let editor = tab == DiscoveryTab::EditorPicks;
|
||||
let mut out = Vec::new();
|
||||
for id in prefs.enabled_ordered(tab) {
|
||||
// mostStreamed renders as an album carousel on Editor's Picks, a slim
|
||||
// grid on Home — encode that in `kind` so the delegate dispatches it
|
||||
// without reading active-tab.
|
||||
let kind = if id == MostStreamed {
|
||||
if editor { "albumCarousel" } else { "slimGrid" }
|
||||
} else {
|
||||
crate::discover_prefs::render_kind(id)
|
||||
};
|
||||
// Album-carousel ids that pull from the cached SectionData.
|
||||
let is_album_cache = matches!(
|
||||
id,
|
||||
NewReleases | PressAwards | IdealDiscography | EditorPicks | Qobuzissimes
|
||||
) || (id == MostStreamed && editor);
|
||||
let section = if is_album_cache {
|
||||
match cached.iter().find(|s| s.id == id) {
|
||||
Some(data) => descriptor_section(data),
|
||||
// Empty-section policy (b): no data for this album id → drop it.
|
||||
None => continue,
|
||||
}
|
||||
} else {
|
||||
DiscoverSection::default()
|
||||
};
|
||||
out.push(SectionDescriptor {
|
||||
id: SharedString::from(id.as_str()),
|
||||
kind: SharedString::from(kind),
|
||||
section,
|
||||
});
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Build the Home + Editor's Picks descriptor lists from the cached section
|
||||
/// data (called by the configurator controller after a mutation and at seed).
|
||||
pub fn tab_descriptors(prefs: &DiscoverPrefs) -> (Vec<SectionDescriptor>, Vec<SectionDescriptor>) {
|
||||
TAB_SECTIONS.with(|cell| {
|
||||
let cache = cell.borrow();
|
||||
let home = descriptors_for(prefs, DiscoveryTab::Home, &cache.home);
|
||||
let editor = descriptors_for(prefs, DiscoveryTab::EditorPicks, &cache.editor);
|
||||
(home, editor)
|
||||
})
|
||||
}
|
||||
|
||||
/// Artwork jobs for a tab's descriptor list — they target the embedded album
|
||||
/// sections in `DiscoverState.home-sections` / `editor-sections` (NOT
|
||||
/// HomeState.sections), so covers paint on the prefs-driven Home/Editor loop.
|
||||
/// Built from the cached `SectionData` (CardData urls) keyed by the descriptor
|
||||
/// id, so `section_idx` aligns with the descriptor's position in the pushed
|
||||
/// list — no need to read back the Slint model.
|
||||
fn discover_section_artwork_jobs(
|
||||
descriptors: &[SectionDescriptor],
|
||||
cached: &[SectionData],
|
||||
editor: bool,
|
||||
) -> Vec<ArtworkJob> {
|
||||
let mut jobs = Vec::new();
|
||||
for (section_idx, desc) in descriptors.iter().enumerate() {
|
||||
// Only album-carousel descriptors map to a cached SectionData; the
|
||||
// fixed-data ids have no entry and contribute no jobs here.
|
||||
let Some(data) = cached.iter().find(|s| s.id.as_str() == desc.id.as_str()) else {
|
||||
continue;
|
||||
};
|
||||
for (album_idx, card) in data.albums.iter().enumerate() {
|
||||
if card.artwork_url.is_empty() {
|
||||
continue;
|
||||
}
|
||||
jobs.push(ArtworkJob {
|
||||
target: ArtworkTarget::DiscoverSectionAlbum {
|
||||
editor,
|
||||
section_idx,
|
||||
album_idx,
|
||||
},
|
||||
url: card.artwork_url.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
jobs
|
||||
}
|
||||
|
||||
/// Re-render the active Home / Editor's Picks tab from the cached section data
|
||||
/// (no network) after a configurator mutation: push the recomputed descriptor
|
||||
/// lists + the active tab's Qobuz Playlists row, and return the descriptor
|
||||
/// artwork jobs to re-fire for the active tab. For You is not handled here (its
|
||||
/// data lives in ForYouState; the descriptor list alone drives it).
|
||||
pub fn rerender_active_tab(window: &AppWindow, prefs: &DiscoverPrefs) -> Vec<ArtworkJob> {
|
||||
let active = window.global::<DiscoverState>().get_active_tab().to_string();
|
||||
if active == "forYou" {
|
||||
return Vec::new();
|
||||
}
|
||||
let editor = active == "editorPicks";
|
||||
let (home, editor_list) = tab_descriptors(prefs);
|
||||
let active_list = if editor { editor_list.clone() } else { home.clone() };
|
||||
|
||||
let dstate = window.global::<DiscoverState>();
|
||||
dstate.set_home_sections(ModelRc::new(VecModel::from(home)));
|
||||
dstate.set_editor_sections(ModelRc::new(VecModel::from(editor_list)));
|
||||
|
||||
// Re-push the active tab's Qobuz Playlists row + build the album-section
|
||||
// artwork jobs from the same cached data (one borrow of the cache).
|
||||
let hstate = window.global::<HomeState>();
|
||||
let (pls, jobs) = TAB_SECTIONS.with(|cell| {
|
||||
let cache = cell.borrow();
|
||||
let (album_cache, pls) = if editor {
|
||||
(&cache.editor, &cache.editor_playlists)
|
||||
} else {
|
||||
(&cache.home, &cache.home_playlists)
|
||||
};
|
||||
let mut jobs = discover_section_artwork_jobs(&active_list, album_cache, editor);
|
||||
jobs.extend(playlist_artwork_jobs(pls));
|
||||
(pls.iter().map(playlist_to_item).collect::<Vec<_>>(), jobs)
|
||||
});
|
||||
hstate.set_playlists(ModelRc::new(VecModel::from(pls)));
|
||||
|
||||
jobs
|
||||
}
|
||||
|
||||
/// Switch the visible Discover tab. Reads the cached section set for
|
||||
/// `tab` ("home" | "editorPicks" | "forYou"), swaps it into
|
||||
/// HomeState.sections, and returns the artwork jobs to re-fire. No
|
||||
|
||||
@@ -24,6 +24,7 @@ mod commands;
|
||||
mod custom_artwork;
|
||||
mod dates;
|
||||
mod discover_browse;
|
||||
mod discover_prefs;
|
||||
mod discovery_dismiss;
|
||||
mod fav_cache;
|
||||
mod favorites;
|
||||
@@ -260,6 +261,9 @@ async fn enter_shell(
|
||||
// Seed the My QBZ branding (label + icon) from the per-user store so
|
||||
// the sidebar row + Settings row paint the custom values immediately.
|
||||
myqbz_prefs::seed(&w);
|
||||
// Seed the Discover configurator descriptor lists so the prefs-driven
|
||||
// render loop has order/visibility data before the first apply_home.
|
||||
discover_prefs::seed(&w);
|
||||
w.global::<HomeState>().set_loading(true);
|
||||
w.set_screen(AppScreen::Shell);
|
||||
});
|
||||
@@ -370,6 +374,7 @@ async fn enter_shell_offline(
|
||||
if let Some(dir) = crate::offline_mode::user_data_dir(user_id) {
|
||||
crate::offline_mode::init_for_user(&dir);
|
||||
crate::fav_cache::init_for_user(&dir);
|
||||
crate::discover_prefs::init_for_user(&dir);
|
||||
}
|
||||
// Lyrics cache (per-user, shared file with Tauri) — offline sessions
|
||||
// serve cached lyrics (deviation D3, cache-first offline contract).
|
||||
@@ -381,6 +386,9 @@ async fn enter_shell_offline(
|
||||
let _ = weak.clone().upgrade_in_event_loop(move |w| {
|
||||
seed_tray_appearance(&w, &tray);
|
||||
myqbz_prefs::seed(&w);
|
||||
// Seed the Discover configurator descriptor lists (works offline —
|
||||
// the prefs store is per-user and bound at session activation).
|
||||
discover_prefs::seed(&w);
|
||||
// No HomeState loading spinner: the discover load is skipped offline
|
||||
// (the gating slice adds the placeholder views).
|
||||
w.set_screen(AppScreen::Shell);
|
||||
@@ -7846,6 +7854,64 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
}
|
||||
|
||||
// Discover section configurator (Slice 5) — gear opens the modal; toggle /
|
||||
// move / reset mutate the per-user prefs, persist, and re-render the active
|
||||
// tab from the cache (no refetch). The mutation handlers re-fire artwork for
|
||||
// newly-shown Home/Editor album sections, mirroring on_select_tab.
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
window
|
||||
.global::<DiscoverActions>()
|
||||
.on_open_configurator(move || {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
discover_prefs::on_open_configurator(&w);
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
window
|
||||
.global::<DiscoverActions>()
|
||||
.on_close_configurator(move || {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
discover_prefs::on_close_configurator(&w);
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let image_cache = image_cache.clone();
|
||||
window
|
||||
.global::<DiscoverActions>()
|
||||
.on_toggle_section(move |tab, id| {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
discover_prefs::on_toggle(&w, tab.as_str(), id.as_str(), &image_cache);
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let image_cache = image_cache.clone();
|
||||
window
|
||||
.global::<DiscoverActions>()
|
||||
.on_move_section(move |tab, id, dir| {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
discover_prefs::on_move(&w, tab.as_str(), id.as_str(), dir, &image_cache);
|
||||
}
|
||||
});
|
||||
}
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
let image_cache = image_cache.clone();
|
||||
window
|
||||
.global::<DiscoverActions>()
|
||||
.on_reset_tab(move |tab| {
|
||||
if let Some(w) = weak.upgrade() {
|
||||
discover_prefs::on_reset(&w, tab.as_str(), &image_cache);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Case-insensitive substring test backing the searchable QbzSelect
|
||||
// (Slint 1.16 has no `contains` builtin). Pure + stateless, so a single
|
||||
// registration at setup serves every searchable list.
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Toast } from "primitives/Toast.slint";
|
||||
import { ShellState } from "state.slint";
|
||||
|
||||
// Re-export the state globals so the Rust layer can populate them.
|
||||
export { HomeState, HomeActions, 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, 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, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState } 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, 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, 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, AppearanceState, MyQbzBrandingState, EphemeralPlayChoiceState, EphemeralPlayChoiceActions, PlexSettingsState, PlexAuthActions, PlexSectionItem, ScrobbleState, ScrobbleActions, OfflineState, OfflineModeActions, OfflineFavoritesState, OfflineFavoritesActions, ImportLogEntry, PlaylistImportState, PlaylistImportActions, InfoCreditRow, InfoCreditPair, AlbumCreditPerformer, AlbumCreditTrack, TrackInfoState, TrackInfoActions, AlbumInfoState, AlbumInfoActions, VisualizerState, ImmersiveState } 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`.
|
||||
|
||||
@@ -108,6 +108,67 @@ export global HomeActions {
|
||||
callback select-tab(string);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Discover section configurator (Slice 5) — prefs-driven render loop + modal.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// One Discover section as a render-loop descriptor. Rust emits the ordered
|
||||
// ENABLED list per tab (DiscoverState.home-sections / editor-sections /
|
||||
// foryou-sections); each surface iterates and dispatches on `id`
|
||||
// (DiscoverySectionId::as_str). `kind` is a coarse render family used by the
|
||||
// one tab-dependent arm (mostStreamed renders as a slim grid on Home, an album
|
||||
// carousel on Editor's Picks). `section` carries the album-carousel payload for
|
||||
// Home arms that share the Carousel component but have no dedicated HomeState
|
||||
// field (newReleases / pressAwards / idealDiscography / editorPicks /
|
||||
// qobuzissimes / mostStreamed-album / recentlyPlayedAlbums); For You arms read
|
||||
// the typed ForYouState fields by id and ignore `section`.
|
||||
export struct SectionDescriptor {
|
||||
id: string, // "newReleases" | "qobuzPlaylists" | "qobuzMixes" | ...
|
||||
kind: string, // "albumCarousel" | "slimGrid" | "playlistCarousel" | ...
|
||||
section: DiscoverSection,
|
||||
}
|
||||
|
||||
// One row in the configurator modal: a section in the active tab's FULL ordered
|
||||
// list (enabled AND disabled — reorder applies to disabled rows too). `label`
|
||||
// is resolved in Rust from the id->key map (Slint @tr cannot take a runtime
|
||||
// key), returning the English string until the Slint gettext pipeline lands.
|
||||
export struct ConfigRow {
|
||||
id: string,
|
||||
label: string,
|
||||
enabled: bool,
|
||||
}
|
||||
|
||||
// Single owner of the configurator render-driver lists AND the modal payload.
|
||||
// `active-tab` lives here once (render loop + modal target read it); the Slice-3
|
||||
// tab pill keeps writing HomeState.active-tab and crate::home::select_tab mirrors
|
||||
// it into here (one extra set, no second tab-switch path).
|
||||
export global DiscoverState {
|
||||
// "home" | "editorPicks" | "forYou". home::select_tab writes this.
|
||||
in-out property <string> active-tab: "home";
|
||||
|
||||
// Ordered ENABLED descriptors per tab (Rust recomputes on every mutation +
|
||||
// on tab switch). Per-tab so a tab flip is a pure binding read. When
|
||||
// active-tab is "forYou" the home/editor lists are pushed empty so the Home
|
||||
// repeater renders nothing for that tab (unconditional-repeater form).
|
||||
in property <[SectionDescriptor]> home-sections: [];
|
||||
in property <[SectionDescriptor]> editor-sections: [];
|
||||
in property <[SectionDescriptor]> foryou-sections: [];
|
||||
|
||||
// Configurator modal payload (for the modal's current target = active-tab).
|
||||
in-out property <bool> configurator-open: false;
|
||||
in property <[ConfigRow]> config-rows: []; // FULL list (enabled+disabled).
|
||||
in property <int> enabled-count: 0;
|
||||
in property <int> total-count: 0;
|
||||
}
|
||||
|
||||
export global DiscoverActions {
|
||||
callback open-configurator(); // gear -> opens for active-tab
|
||||
callback close-configurator();
|
||||
callback toggle-section(/* tab */ string, /* id */ string);
|
||||
callback move-section(/* tab */ string, /* id */ string, /* dir -1|+1 */ int);
|
||||
callback reset-tab(/* tab */ string);
|
||||
}
|
||||
|
||||
// Discover "View all" full-list page — one album module (new releases,
|
||||
// qobuzissimes, ...) opened from a Carousel's See-All link. Paginated.
|
||||
export global DiscoverBrowseState {
|
||||
|
||||
Reference in new issue
Block a user