feat(track-info): add TrackInfoModal and context menu option
Phase 2 of track-info feature: - Add performers, composer, copyright fields to Track model - Add get_track_info command with parsed performers - Create TrackInfoModal component to display track details and credits - Add "Track info" option to TrackMenu context menu cc
This commit is contained in:
1 parent
eccadb6af9
commit
e767809857
6 files changed
+376
-3
No files matched your search
@@ -140,6 +140,12 @@ pub struct Track {
|
||||
pub parental_warning: bool,
|
||||
/// Playlist-specific: ID within the playlist (for removal)
|
||||
pub playlist_track_id: Option<u64>,
|
||||
/// Performers/credits string from Qobuz (format: "Name, Role - Name, Role")
|
||||
pub performers: Option<String>,
|
||||
/// Composer information
|
||||
pub composer: Option<Artist>,
|
||||
/// Copyright information
|
||||
pub copyright: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
//! Playlist-related Tauri commands
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::State;
|
||||
|
||||
use crate::api::models::{Playlist, SearchResultsPage};
|
||||
use crate::api::models::{Playlist, SearchResultsPage, Track};
|
||||
use crate::api::performers::{parse_performers, Performer};
|
||||
use crate::AppState;
|
||||
|
||||
/// Track info with parsed performers for display
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct TrackInfo {
|
||||
pub track: Track,
|
||||
pub performers: Vec<Performer>,
|
||||
}
|
||||
|
||||
/// Get user's playlists
|
||||
#[tauri::command]
|
||||
pub async fn get_user_playlists(
|
||||
@@ -218,3 +227,27 @@ pub async fn subscribe_playlist(
|
||||
..new_playlist
|
||||
})
|
||||
}
|
||||
|
||||
/// Get track info with parsed performers/credits
|
||||
#[tauri::command]
|
||||
pub async fn get_track_info(
|
||||
track_id: u64,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<TrackInfo, String> {
|
||||
log::info!("Command: get_track_info {}", track_id);
|
||||
|
||||
let client = state.client.lock().await;
|
||||
let track = client
|
||||
.get_track(track_id)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get track: {}", e))?;
|
||||
|
||||
// Parse the performers string if available
|
||||
let performers = track
|
||||
.performers
|
||||
.as_ref()
|
||||
.map(|p| parse_performers(p))
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(TrackInfo { track, performers })
|
||||
}
|
||||
@@ -484,6 +484,7 @@ pub fn run() {
|
||||
commands::get_tracks_by_ids,
|
||||
commands::get_current_user_id,
|
||||
commands::subscribe_playlist,
|
||||
commands::get_track_info,
|
||||
// Playlist import commands
|
||||
commands::playlist_import_preview,
|
||||
commands::playlist_import_execute,
|
||||
|
||||
Reference in new issue
Block a user