feat(slint): MusicianPageView (Port 3, first of three click targets)
Wires the sidebar's musician-clicked callback into a real
destination. Mirrors Tauri's MusicianPageView.svelte plus the
"jump to artist page when Confirmed" shortcut.
Slint:
- ContentView gains a `musician` variant; NavEntry mirrors with
`Musician { name, role }` so the back/forward history can
re-fire the page with the original payload.
- MusicianState / MusicianActions globals carry the resolved
musician metadata (name, role, confidence) + the paginated
Appears On grid (MusicianAppearanceItem mirrors the Tauri
interface — album_id, title, artist_name, year,
role_on_album, artwork URL/handle).
- New `ui/musician/MusicianPageView.slint`: header (avatar +
name + role), Bands & Projects chips when populated, and an
Appears On grid built from the same absolute-position pattern
the artist release grid uses. Load more button drives
MusicianActions::load-more.
- AppShell routes ContentView.musician to MusicianPageView and
forwards open-album.
Rust:
- `crate::musician` controller — load_musician, apply_musician,
load_more_appearances, append_appearances, reset_musician,
artwork_jobs. Pure data + UI plumbing; the orchestration lives
in qbz-core.
- artwork::ArtworkTarget gains MusicianAppearance { index } so
the existing artwork pipeline can target the new grid.
- main.rs gains `navigate_musician` (the navigation entry point
apply_entry now also routes to) and `on_musician_clicked`
(does the resolve, jumps to navigate_artist on Confirmed,
otherwise records + navigates to the Musician view).
- MusicianActions::on_load_more wired to load_more_appearances
+ append.
cc
This commit is contained in:
8 files changed
+699
-6
No files matched your search
@@ -52,6 +52,8 @@ pub enum ArtworkTarget {
|
|||||||
/// A release card in `ArtistState.release-sections[section_idx]
|
/// A release card in `ArtistState.release-sections[section_idx]
|
||||||
/// .albums[album_idx]`.
|
/// .albums[album_idx]`.
|
||||||
ArtistRelease { section_idx: usize, album_idx: usize },
|
ArtistRelease { section_idx: usize, album_idx: usize },
|
||||||
|
/// A card in MusicianState.appearances[index].
|
||||||
|
MusicianAppearance { index: usize },
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An artwork download job: which card, and the image URL.
|
/// An artwork download job: which card, and the image URL.
|
||||||
@@ -340,5 +342,12 @@ fn apply_artwork(
|
|||||||
item.artwork = image;
|
item.artwork = image;
|
||||||
section.albums.set_row_data(album_idx, item);
|
section.albums.set_row_data(album_idx, item);
|
||||||
}
|
}
|
||||||
|
ArtworkTarget::MusicianAppearance { index } => {
|
||||||
|
let model = window.global::<crate::MusicianState>().get_appearances();
|
||||||
|
if let Some(mut item) = model.row_data(index) {
|
||||||
|
item.artwork = image;
|
||||||
|
model.set_row_data(index, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@ mod commands;
|
|||||||
mod custom_artwork;
|
mod custom_artwork;
|
||||||
mod discovery_dismiss;
|
mod discovery_dismiss;
|
||||||
mod home;
|
mod home;
|
||||||
|
mod musician;
|
||||||
mod nav;
|
mod nav;
|
||||||
mod play_history;
|
mod play_history;
|
||||||
mod strip_html;
|
mod strip_html;
|
||||||
@@ -413,7 +414,53 @@ fn apply_entry(
|
|||||||
nav::NavEntry::Search(query) => {
|
nav::NavEntry::Search(query) => {
|
||||||
navigate_search(runtime.clone(), weak.clone(), handle, image_cache.clone(), query);
|
navigate_search(runtime.clone(), weak.clone(), handle, image_cache.clone(), query);
|
||||||
}
|
}
|
||||||
|
nav::NavEntry::Musician { name, role } => {
|
||||||
|
navigate_musician(
|
||||||
|
runtime.clone(),
|
||||||
|
weak.clone(),
|
||||||
|
handle,
|
||||||
|
image_cache.clone(),
|
||||||
|
name,
|
||||||
|
role,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Open a MusicianPageView for `name + role`. Routes to the artist
|
||||||
|
/// page instead when the resolved musician has a Confirmed Qobuz
|
||||||
|
/// match (Tauri's `confidence === 'confirmed'` shortcut). Fetches
|
||||||
|
/// the first page of appearances inline; subsequent pages come
|
||||||
|
/// through the MusicianActions::load-more handler.
|
||||||
|
fn navigate_musician(
|
||||||
|
runtime: Arc<AppRuntime<SlintAdapter>>,
|
||||||
|
weak: slint::Weak<AppWindow>,
|
||||||
|
handle: &tokio::runtime::Handle,
|
||||||
|
image_cache: artwork::ImageCache,
|
||||||
|
name: String,
|
||||||
|
role: String,
|
||||||
|
) {
|
||||||
|
handle.spawn(async move {
|
||||||
|
let _ = weak.upgrade_in_event_loop(|w| {
|
||||||
|
musician::reset_musician(&w);
|
||||||
|
w.global::<NavState>().set_view(ContentView::Musician);
|
||||||
|
});
|
||||||
|
match musician::load_musician(&runtime, &name, &role).await {
|
||||||
|
Ok(data) => {
|
||||||
|
let jobs = musician::artwork_jobs(&data);
|
||||||
|
let _ = weak.upgrade_in_event_loop(move |w| {
|
||||||
|
musician::apply_musician(&w, data);
|
||||||
|
});
|
||||||
|
artwork::spawn_loads(jobs, weak.clone(), image_cache.clone());
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("[qbz-slint] musician load failed: {e}");
|
||||||
|
let _ = weak.upgrade_in_event_loop(|w| {
|
||||||
|
w.global::<MusicianState>().set_loading(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve the desktop environment's UI font family. Reads the KDE
|
/// Resolve the desktop environment's UI font family. Reads the KDE
|
||||||
@@ -1261,13 +1308,67 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Musician click — resolve the (name, role) first; if Qobuz has
|
||||||
|
// a confirmed exact match, jump straight to that artist's page.
|
||||||
|
// Otherwise open MusicianPageView (Contextual / Weak / None).
|
||||||
|
{
|
||||||
|
let runtime = app_runtime.clone();
|
||||||
|
let weak = window.as_weak();
|
||||||
|
let handle = tokio_rt.handle().clone();
|
||||||
|
let image_cache = image_cache.clone();
|
||||||
window
|
window
|
||||||
.global::<NetworkSidebarActions>()
|
.global::<NetworkSidebarActions>()
|
||||||
.on_musician_clicked(|name, role| {
|
.on_musician_clicked(move |name, role| {
|
||||||
log::info!(
|
let name = name.to_string();
|
||||||
"[qbz-slint] network sidebar: musician clicked name={name} role={role}"
|
let role = role.to_string();
|
||||||
);
|
let runtime = runtime.clone();
|
||||||
|
let weak = weak.clone();
|
||||||
|
let handle = handle.clone();
|
||||||
|
let image_cache = image_cache.clone();
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let resolved =
|
||||||
|
runtime.core().musicbrainz_resolve_musician(&name, &role).await;
|
||||||
|
match resolved {
|
||||||
|
Ok(r) if matches!(
|
||||||
|
r.confidence,
|
||||||
|
qbz_integrations::musicbrainz::MusicianConfidence::Confirmed
|
||||||
|
) =>
|
||||||
|
{
|
||||||
|
if let Some(id) = r.qobuz_artist_id {
|
||||||
|
let artist_id = id.to_string();
|
||||||
|
let weak2 = weak.clone();
|
||||||
|
let _ = weak.clone().upgrade_in_event_loop(move |_| {
|
||||||
|
nav::record(nav::NavEntry::Artist(artist_id.clone()));
|
||||||
});
|
});
|
||||||
|
navigate_artist(
|
||||||
|
runtime,
|
||||||
|
weak2,
|
||||||
|
&handle,
|
||||||
|
image_cache,
|
||||||
|
id.to_string(),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log::warn!(
|
||||||
|
"[qbz-slint] musician confirmed but no qobuz id"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(_) => {
|
||||||
|
// Fall through to MusicianPageView for
|
||||||
|
// Contextual / Weak / None.
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("[qbz-slint] musician resolve failed: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nav::record(nav::NavEntry::Musician {
|
||||||
|
name: name.clone(),
|
||||||
|
role: role.clone(),
|
||||||
|
});
|
||||||
|
navigate_musician(runtime, weak, &handle, image_cache, name, role);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
// discovery-dismissed — persist the rejection under the current
|
// discovery-dismissed — persist the rejection under the current
|
||||||
// tag, then remove the row from the visible list.
|
// tag, then remove the row from the visible list.
|
||||||
{
|
{
|
||||||
@@ -1291,6 +1392,62 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Musician appearances pagination — Load more in
|
||||||
|
// MusicianPageView appends the next 20 albums onto the existing
|
||||||
|
// grid.
|
||||||
|
{
|
||||||
|
let runtime = app_runtime.clone();
|
||||||
|
let weak = window.as_weak();
|
||||||
|
let handle = tokio_rt.handle().clone();
|
||||||
|
let image_cache = image_cache.clone();
|
||||||
|
window
|
||||||
|
.global::<MusicianActions>()
|
||||||
|
.on_load_more(move || {
|
||||||
|
let Some(w) = weak.upgrade() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let state = w.global::<MusicianState>();
|
||||||
|
let name = state.get_name().to_string();
|
||||||
|
let role = state.get_role().to_string();
|
||||||
|
let offset = state.get_appearances().row_count() as u32;
|
||||||
|
if name.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.set_load_more_loading(true);
|
||||||
|
let runtime = runtime.clone();
|
||||||
|
let weak = weak.clone();
|
||||||
|
let handle = handle.clone();
|
||||||
|
let image_cache = image_cache.clone();
|
||||||
|
handle.clone().spawn(async move {
|
||||||
|
match musician::load_more_appearances(&runtime, &name, &role, offset).await {
|
||||||
|
Ok((data, total)) => {
|
||||||
|
let jobs: Vec<artwork::ArtworkJob> = data
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, a)| !a.artwork_url.is_empty())
|
||||||
|
.map(|(i, a)| artwork::ArtworkJob {
|
||||||
|
url: a.artwork_url.clone(),
|
||||||
|
target: artwork::ArtworkTarget::MusicianAppearance {
|
||||||
|
index: offset as usize + i,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let _ = weak.upgrade_in_event_loop(move |w| {
|
||||||
|
musician::append_appearances(&w, data, total);
|
||||||
|
});
|
||||||
|
artwork::spawn_loads(jobs, weak, image_cache);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("[qbz-slint] musician load-more failed: {e}");
|
||||||
|
let _ = weak.upgrade_in_event_loop(|w| {
|
||||||
|
w.global::<MusicianState>().set_load_more_loading(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Artwork right-click menu wiring — Open in browser / Save as /
|
// Artwork right-click menu wiring — Open in browser / Save as /
|
||||||
// Add custom / Remove custom. Mirrors the v2_library_* + native
|
// Add custom / Remove custom. Mirrors the v2_library_* + native
|
||||||
// dialog flow Tauri uses on artist portraits + album covers.
|
// dialog flow Tauri uses on artist portraits + album covers.
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
//! MusicianPageView controller — loads the resolved musician + the
|
||||||
|
//! "Appears On" album grid and pushes them into `MusicianState`.
|
||||||
|
//!
|
||||||
|
//! Mirrors the Tauri MusicianPageView.svelte flow:
|
||||||
|
//! 1. Resolve the (name, role) via QbzCore::musicbrainz_resolve_musician.
|
||||||
|
//! 2. Fetch the first page of appearances
|
||||||
|
//! (QbzCore::musicbrainz_get_musician_appearances).
|
||||||
|
//! 3. Subsequent pages come from the MusicianActions::load-more
|
||||||
|
//! callback the view emits at the bottom of the grid.
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use qbz_app::shell::AppRuntime;
|
||||||
|
use qbz_core::FrontendAdapter;
|
||||||
|
use qbz_integrations::musicbrainz::MusicianConfidence;
|
||||||
|
use slint::{ComponentHandle, Model, ModelRc, VecModel};
|
||||||
|
|
||||||
|
use crate::artwork::{ArtworkJob, ArtworkTarget};
|
||||||
|
use crate::{AppWindow, MusicianAppearanceItem, MusicianState};
|
||||||
|
|
||||||
|
/// Page size — kept in sync with the Tauri view's ITEMS_PER_PAGE.
|
||||||
|
pub const PAGE_SIZE: u32 = 20;
|
||||||
|
|
||||||
|
/// Resolved-musician metadata + the current page bookkeeping. Plain
|
||||||
|
/// `Send` so the load step can run on a worker.
|
||||||
|
pub struct MusicianData {
|
||||||
|
pub name: String,
|
||||||
|
pub role: String,
|
||||||
|
pub confidence: MusicianConfidence,
|
||||||
|
pub appearances: Vec<AppearanceData>,
|
||||||
|
pub total: usize,
|
||||||
|
pub offset: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct AppearanceData {
|
||||||
|
pub album_id: String,
|
||||||
|
pub album_title: String,
|
||||||
|
pub artist_name: String,
|
||||||
|
pub year: String,
|
||||||
|
pub role_on_album: String,
|
||||||
|
pub artwork_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Resolve the musician + fetch the first page of appearances.
|
||||||
|
pub async fn load_musician<A>(
|
||||||
|
runtime: &Arc<AppRuntime<A>>,
|
||||||
|
name: &str,
|
||||||
|
role: &str,
|
||||||
|
) -> Result<MusicianData, String>
|
||||||
|
where
|
||||||
|
A: FrontendAdapter + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
let resolved = runtime
|
||||||
|
.core()
|
||||||
|
.musicbrainz_resolve_musician(name, role)
|
||||||
|
.await
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
let page = runtime
|
||||||
|
.core()
|
||||||
|
.musicbrainz_get_musician_appearances(name, role, PAGE_SIZE, 0)
|
||||||
|
.await
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
let appearances: Vec<AppearanceData> = page
|
||||||
|
.albums
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| AppearanceData {
|
||||||
|
album_id: a.album_id,
|
||||||
|
album_title: a.album_title,
|
||||||
|
artist_name: a.artist_name,
|
||||||
|
year: a.year.unwrap_or_default(),
|
||||||
|
role_on_album: a.role_on_album,
|
||||||
|
artwork_url: a.album_artwork,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let count = appearances.len() as u32;
|
||||||
|
|
||||||
|
Ok(MusicianData {
|
||||||
|
name: resolved.name,
|
||||||
|
role: resolved.role,
|
||||||
|
confidence: resolved.confidence,
|
||||||
|
appearances,
|
||||||
|
total: page.total,
|
||||||
|
offset: count,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Fetch one more page of appearances, append to the current list.
|
||||||
|
pub async fn load_more_appearances<A>(
|
||||||
|
runtime: &Arc<AppRuntime<A>>,
|
||||||
|
name: &str,
|
||||||
|
role: &str,
|
||||||
|
offset: u32,
|
||||||
|
) -> Result<(Vec<AppearanceData>, usize), String>
|
||||||
|
where
|
||||||
|
A: FrontendAdapter + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
let page = runtime
|
||||||
|
.core()
|
||||||
|
.musicbrainz_get_musician_appearances(name, role, PAGE_SIZE, offset)
|
||||||
|
.await
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
let appearances = page
|
||||||
|
.albums
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| AppearanceData {
|
||||||
|
album_id: a.album_id,
|
||||||
|
album_title: a.album_title,
|
||||||
|
artist_name: a.artist_name,
|
||||||
|
year: a.year.unwrap_or_default(),
|
||||||
|
role_on_album: a.role_on_album,
|
||||||
|
artwork_url: a.album_artwork,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
Ok((appearances, page.total))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Apply the freshly loaded musician page to MusicianState.
|
||||||
|
pub fn apply_musician(window: &AppWindow, data: MusicianData) {
|
||||||
|
let items: Vec<MusicianAppearanceItem> = data
|
||||||
|
.appearances
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| MusicianAppearanceItem {
|
||||||
|
album_id: a.album_id.into(),
|
||||||
|
album_title: a.album_title.into(),
|
||||||
|
artist_name: a.artist_name.into(),
|
||||||
|
year: a.year.into(),
|
||||||
|
role_on_album: a.role_on_album.into(),
|
||||||
|
artwork_url: a.artwork_url.into(),
|
||||||
|
artwork: slint::Image::default(),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let state = window.global::<MusicianState>();
|
||||||
|
state.set_name(data.name.into());
|
||||||
|
state.set_role(data.role.into());
|
||||||
|
state.set_confidence(confidence_label(data.confidence).into());
|
||||||
|
state.set_appearances(ModelRc::new(VecModel::from(items)));
|
||||||
|
state.set_total(data.total as i32);
|
||||||
|
state.set_loading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Append a freshly fetched page of appearances onto the existing
|
||||||
|
/// model. Called by the MusicianActions::load-more handler.
|
||||||
|
pub fn append_appearances(
|
||||||
|
window: &AppWindow,
|
||||||
|
appearances: Vec<AppearanceData>,
|
||||||
|
total: usize,
|
||||||
|
) {
|
||||||
|
let state = window.global::<MusicianState>();
|
||||||
|
let model = state.get_appearances();
|
||||||
|
let mut combined: Vec<MusicianAppearanceItem> = (0..model.row_count())
|
||||||
|
.filter_map(|i| model.row_data(i))
|
||||||
|
.collect();
|
||||||
|
for a in appearances {
|
||||||
|
combined.push(MusicianAppearanceItem {
|
||||||
|
album_id: a.album_id.into(),
|
||||||
|
album_title: a.album_title.into(),
|
||||||
|
artist_name: a.artist_name.into(),
|
||||||
|
year: a.year.into(),
|
||||||
|
role_on_album: a.role_on_album.into(),
|
||||||
|
artwork_url: a.artwork_url.into(),
|
||||||
|
artwork: slint::Image::default(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
state.set_appearances(ModelRc::new(VecModel::from(combined)));
|
||||||
|
state.set_total(total as i32);
|
||||||
|
state.set_load_more_loading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reset_musician(window: &AppWindow) {
|
||||||
|
let state = window.global::<MusicianState>();
|
||||||
|
state.set_name("".into());
|
||||||
|
state.set_role("".into());
|
||||||
|
state.set_confidence("".into());
|
||||||
|
state.set_appearances(ModelRc::new(VecModel::from(
|
||||||
|
Vec::<MusicianAppearanceItem>::new(),
|
||||||
|
)));
|
||||||
|
state.set_total(0);
|
||||||
|
state.set_loading(true);
|
||||||
|
state.set_load_more_loading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Artwork download jobs for the appearance grid — same pipeline
|
||||||
|
/// the Discover album cards use, so covers fill in progressively.
|
||||||
|
pub fn artwork_jobs(data: &MusicianData) -> Vec<ArtworkJob> {
|
||||||
|
data.appearances
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, a)| !a.artwork_url.is_empty())
|
||||||
|
.map(|(i, a)| ArtworkJob {
|
||||||
|
url: a.artwork_url.clone(),
|
||||||
|
target: ArtworkTarget::MusicianAppearance { index: i },
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn confidence_label(c: MusicianConfidence) -> &'static str {
|
||||||
|
match c {
|
||||||
|
MusicianConfidence::Confirmed => "confirmed",
|
||||||
|
MusicianConfidence::Contextual => "contextual",
|
||||||
|
MusicianConfidence::Weak => "weak",
|
||||||
|
MusicianConfidence::None => "none",
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,14 @@ pub enum NavEntry {
|
|||||||
Settings,
|
Settings,
|
||||||
/// A search results page; the string is the query.
|
/// A search results page; the string is the query.
|
||||||
Search(String),
|
Search(String),
|
||||||
|
/// MusicianPageView — opened by the artist network sidebar when
|
||||||
|
/// the resolved musician does not have a confident Qobuz artist
|
||||||
|
/// match. Carries the musician name + the role for the
|
||||||
|
/// appearances query.
|
||||||
|
Musician {
|
||||||
|
name: String,
|
||||||
|
role: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
struct History {
|
struct History {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { LoginScreen } from "login/LoginScreen.slint";
|
|||||||
import { AppShell } from "shell/AppShell.slint";
|
import { AppShell } from "shell/AppShell.slint";
|
||||||
|
|
||||||
// Re-export the state globals so the Rust layer can populate them.
|
// Re-export the state globals so the Rust layer can populate them.
|
||||||
export { HomeState, AlbumState, ArtistState, NavState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions } from "state.slint";
|
export { HomeState, AlbumState, ArtistState, NavState, SessionState, SettingsState, AlbumActions, ArtistActions, ArtworkActions, NowPlayingState, QueueState, SearchState, SearchActions, NetworkSidebarState, NetworkSidebarActions, MusicianState, MusicianActions } from "state.slint";
|
||||||
|
|
||||||
// Which top-level screen is shown. The app starts on `splash` while it
|
// Which top-level screen is shown. The app starts on `splash` while it
|
||||||
// restores a saved session, then resolves to `shell` or `login`.
|
// restores a saved session, then resolves to `shell` or `login`.
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
// MusicianPageView — full page view opened from the artist network
|
||||||
|
// sidebar when a relationship row resolves with Contextual / Weak
|
||||||
|
// confidence (no exact Qobuz artist match). Mirrors Tauri's
|
||||||
|
// MusicianPageView.svelte: a small header (avatar + name + role)
|
||||||
|
// followed by Bands & Projects (when known) and the "Appears On"
|
||||||
|
// album grid with paginated load-more.
|
||||||
|
|
||||||
|
import { Theme } from "../foundation/semantic-colors.slint";
|
||||||
|
import { Typography } from "../foundation/typography.slint";
|
||||||
|
import { Radius } from "../foundation/radius.slint";
|
||||||
|
import {
|
||||||
|
MusicianState,
|
||||||
|
MusicianActions,
|
||||||
|
MusicianAppearanceItem,
|
||||||
|
} from "../state.slint";
|
||||||
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||||
|
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
|
||||||
|
import { NavButtons } from "../shell/NavButtons.slint";
|
||||||
|
|
||||||
|
component AppearanceCard inherits Rectangle {
|
||||||
|
in property <MusicianAppearanceItem> item;
|
||||||
|
callback clicked(string /* album-id */);
|
||||||
|
|
||||||
|
width: 200px;
|
||||||
|
height: 270px;
|
||||||
|
|
||||||
|
VerticalLayout {
|
||||||
|
spacing: 6px;
|
||||||
|
Rectangle {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: Theme.surface-elevated;
|
||||||
|
drop-shadow-blur: 18px;
|
||||||
|
drop-shadow-color: #00000060;
|
||||||
|
drop-shadow-offset-y: 6px;
|
||||||
|
clip: true;
|
||||||
|
Image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
source: root.item.artwork;
|
||||||
|
image-fit: cover;
|
||||||
|
}
|
||||||
|
TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
clicked => {
|
||||||
|
root.clicked(root.item.album-id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: root.item.album-title;
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
font-weight: Typography.medium;
|
||||||
|
overflow: elide;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: root.item.artist-name;
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
overflow: elide;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 8px;
|
||||||
|
if root.item.year != "": Text {
|
||||||
|
text: root.item.year;
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
}
|
||||||
|
if root.item.role-on-album != "": Text {
|
||||||
|
text: root.item.role-on-album;
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.legal;
|
||||||
|
font-weight: Typography.medium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export component MusicianPageView inherits Rectangle {
|
||||||
|
callback open-album(string);
|
||||||
|
|
||||||
|
property <length> card-width: 200px;
|
||||||
|
property <length> card-height: 270px;
|
||||||
|
property <length> card-gap: 24px;
|
||||||
|
|
||||||
|
background: Theme.surface-main;
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
viewport-width: self.width;
|
||||||
|
viewport-height: page.preferred-height;
|
||||||
|
|
||||||
|
page := VerticalLayout {
|
||||||
|
width: parent.width;
|
||||||
|
padding-left: 32px;
|
||||||
|
padding-right: 32px;
|
||||||
|
padding-top: 11px;
|
||||||
|
padding-bottom: 100px;
|
||||||
|
spacing: 0px;
|
||||||
|
alignment: start;
|
||||||
|
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: start;
|
||||||
|
NavButtons { }
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle { height: 22px; }
|
||||||
|
|
||||||
|
// --- Musician header ---------------------------------------
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 16px;
|
||||||
|
alignment: start;
|
||||||
|
Rectangle {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 28px;
|
||||||
|
background: Theme.surface-elevated;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/user.svg");
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
x: (parent.width - self.width) / 2;
|
||||||
|
y: (parent.height - self.height) / 2;
|
||||||
|
tint: Theme.text-muted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
spacing: 2px;
|
||||||
|
Text {
|
||||||
|
text: MusicianState.name;
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: Typography.title;
|
||||||
|
font-weight: Typography.bold;
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: MusicianState.role;
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.body;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle { height: 32px; }
|
||||||
|
|
||||||
|
// --- Bands & Projects (chips) ------------------------------
|
||||||
|
if MusicianState.bands.length > 0: VerticalLayout {
|
||||||
|
spacing: 10px;
|
||||||
|
Text {
|
||||||
|
text: @tr("Bands & Projects");
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
font-weight: Typography.semibold;
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 8px;
|
||||||
|
alignment: start;
|
||||||
|
for band in MusicianState.bands: Rectangle {
|
||||||
|
height: 32px;
|
||||||
|
border-radius: Radius.sm;
|
||||||
|
background: Theme.surface-card;
|
||||||
|
HorizontalLayout {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
spacing: 8px;
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
QbzIcon {
|
||||||
|
source: @image-url("../assets/icons/music.svg");
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
tint: Theme.text-muted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: band;
|
||||||
|
color: Theme.text-secondary;
|
||||||
|
font-size: Typography.body;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle { height: 24px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Appears On --------------------------------------------
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 8px;
|
||||||
|
Text {
|
||||||
|
text: @tr("Appears On");
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: Typography.heading;
|
||||||
|
font-weight: Typography.semibold;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
if MusicianState.total > 0: Text {
|
||||||
|
text: "(" + MusicianState.total + ")";
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.body;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle { height: 14px; }
|
||||||
|
|
||||||
|
if MusicianState.loading
|
||||||
|
&& MusicianState.appearances.length == 0: HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
LoadingSpinner { size: 36px; }
|
||||||
|
}
|
||||||
|
if !MusicianState.loading
|
||||||
|
&& MusicianState.appearances.length == 0: Text {
|
||||||
|
text: @tr("No album appearances found.");
|
||||||
|
color: Theme.text-muted;
|
||||||
|
font-size: Typography.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
if MusicianState.appearances.length > 0: appearances-grid := Rectangle {
|
||||||
|
property <int> columns: Math.max(
|
||||||
|
1,
|
||||||
|
Math.floor((self.width + root.card-gap) / (root.card-width + root.card-gap)));
|
||||||
|
property <int> rows: Math.ceil(MusicianState.appearances.length / self.columns);
|
||||||
|
height: self.rows > 0
|
||||||
|
? self.rows * root.card-height
|
||||||
|
+ Math.max(0, self.rows - 1) * root.card-gap
|
||||||
|
: 0px;
|
||||||
|
for item[i] in MusicianState.appearances: AppearanceCard {
|
||||||
|
x: Math.mod(i, appearances-grid.columns) * (root.card-width + root.card-gap);
|
||||||
|
y: Math.floor(i / appearances-grid.columns) * (root.card-height + root.card-gap);
|
||||||
|
item: item;
|
||||||
|
clicked(id) => {
|
||||||
|
root.open-album(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if MusicianState.appearances.length > 0
|
||||||
|
&& MusicianState.appearances.length < MusicianState.total:
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Rectangle {
|
||||||
|
width: load-more-text.preferred-width + 24px;
|
||||||
|
height: 32px;
|
||||||
|
load-more-text := Text {
|
||||||
|
text: MusicianState.load-more-loading
|
||||||
|
? @tr("Loading…")
|
||||||
|
: @tr("Load more");
|
||||||
|
color: load-more-ta.has-hover
|
||||||
|
? Theme.text-primary
|
||||||
|
: Theme.text-secondary;
|
||||||
|
font-size: 13px;
|
||||||
|
x: (parent.width - self.width) / 2;
|
||||||
|
y: (parent.height - self.height) / 2;
|
||||||
|
}
|
||||||
|
load-more-ta := TouchArea {
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
enabled: !MusicianState.load-more-loading;
|
||||||
|
clicked => {
|
||||||
|
MusicianActions.load-more();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import { LyricsSidebar } from "LyricsSidebar.slint";
|
|||||||
import { HomeView } from "../discover/HomeView.slint";
|
import { HomeView } from "../discover/HomeView.slint";
|
||||||
import { AlbumPageView } from "../album/AlbumPageView.slint";
|
import { AlbumPageView } from "../album/AlbumPageView.slint";
|
||||||
import { ArtistPageView } from "../artist/ArtistPageView.slint";
|
import { ArtistPageView } from "../artist/ArtistPageView.slint";
|
||||||
|
import { MusicianPageView } from "../musician/MusicianPageView.slint";
|
||||||
import { SettingsView } from "../settings/SettingsView.slint";
|
import { SettingsView } from "../settings/SettingsView.slint";
|
||||||
import { SearchResultsView } from "../search/SearchResultsView.slint";
|
import { SearchResultsView } from "../search/SearchResultsView.slint";
|
||||||
|
|
||||||
@@ -94,6 +95,11 @@ export component AppShell inherits Rectangle {
|
|||||||
root.media-action(kind, id, action);
|
root.media-action(kind, id, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if NavState.view == ContentView.musician: MusicianPageView {
|
||||||
|
open-album(id) => {
|
||||||
|
root.open-album(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
if NavState.view == ContentView.settings: SettingsView {
|
if NavState.view == ContentView.settings: SettingsView {
|
||||||
settings-bool(k, v) => {
|
settings-bool(k, v) => {
|
||||||
root.settings-bool(k, v);
|
root.settings-bool(k, v);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export global AlbumActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Which content view the shell shows.
|
// Which content view the shell shows.
|
||||||
export enum ContentView { home, album, artist, settings, search }
|
export enum ContentView { home, album, artist, settings, search, musician }
|
||||||
|
|
||||||
// Settings screen state. Audio and Playback preferences are loaded from
|
// Settings screen state. Audio and Playback preferences are loaded from
|
||||||
// the persistence stores by the Rust settings controller and pushed here;
|
// the persistence stores by the Rust settings controller and pushed here;
|
||||||
@@ -395,6 +395,44 @@ export global NetworkSidebarActions {
|
|||||||
callback toggle();
|
callback toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One row of MusicianPageView's "Appears On" grid — same shape as
|
||||||
|
// the album cards on Discover, plus a role label stamped onto each
|
||||||
|
// album by the Qobuz search wrapping (e.g. "Drums" / "Guitar").
|
||||||
|
export struct MusicianAppearanceItem {
|
||||||
|
album-id: string,
|
||||||
|
album-title: string,
|
||||||
|
artist-name: string,
|
||||||
|
year: string,
|
||||||
|
role-on-album: string,
|
||||||
|
artwork-url: string,
|
||||||
|
artwork: image,
|
||||||
|
}
|
||||||
|
|
||||||
|
// MusicianPageView state — opened by the artist network sidebar
|
||||||
|
// when a relationship row is clicked and the musician has no
|
||||||
|
// confident Qobuz artist match. Populated by `crate::musician`
|
||||||
|
// from the resolve + appearances backend calls.
|
||||||
|
export global MusicianState {
|
||||||
|
in property <string> name;
|
||||||
|
in property <string> role;
|
||||||
|
// "confirmed" | "contextual" | "weak" | "none" — the sidebar
|
||||||
|
// uses this to skip MusicianPageView entirely on Confirmed and
|
||||||
|
// navigate to the matched artist instead.
|
||||||
|
in property <string> confidence;
|
||||||
|
// Bands / projects from MusicBrainz; not yet populated but
|
||||||
|
// kept in the data shape so the section renders cleanly when
|
||||||
|
// wired.
|
||||||
|
in property <[string]> bands: [];
|
||||||
|
in property <[MusicianAppearanceItem]> appearances: [];
|
||||||
|
in property <int> total: 0;
|
||||||
|
in property <bool> loading: false;
|
||||||
|
in property <bool> load-more-loading: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export global MusicianActions {
|
||||||
|
callback load-more();
|
||||||
|
}
|
||||||
|
|
||||||
// Shell chrome state — collapsible left sidebar and right-side panels.
|
// Shell chrome state — collapsible left sidebar and right-side panels.
|
||||||
// Globals are imported directly by the shell components, so toggles
|
// Globals are imported directly by the shell components, so toggles
|
||||||
// need no callback plumbing.
|
// need no callback plumbing.
|
||||||
|
|||||||
Reference in new issue
Block a user