fix: multiple UX improvements and bug fixes
Playlist & Favorites: - Fix playlist loading error (missing field `id` in JSON parsing) - Add serde defaults for Track and PlaylistOwner optional fields - Fix track favorites toggle to actually call backend API - Add "Add to playlist" button on track rows in album view Sidebar UI improvements: - Increase sidebar width to 280px - Reduce text size and margins throughout - Normalize all icons to 14px (matching + and refresh buttons) - Add text overflow with ellipsis and tooltip for playlist names User card: - Make user card more compact (smaller avatar, fonts, icons) - Add collapsible toggle - when collapsed shows mini QBZ logo + username Queue & Playback: - Fix next_track spam when queue has only one song (queueEnded flag) Other fixes: - Fix TrackRow prop types (remove invalid hires, bitDepth, samplingRate props) - Fix FavoritesView and PlaylistDetailView component prop types - Add diagnostic logging to credential persistence
This commit is contained in:
1 parent
6eed045404
commit
cdc06d8759
10 files changed
+258
-115
No files matched your search
@@ -109,16 +109,23 @@ pub struct Track {
|
||||
pub id: u64,
|
||||
pub title: String,
|
||||
pub duration: u32,
|
||||
#[serde(default)]
|
||||
pub track_number: u32,
|
||||
pub media_number: Option<u32>,
|
||||
pub performer: Option<Artist>,
|
||||
pub album: Option<AlbumSummary>,
|
||||
#[serde(default)]
|
||||
pub hires: bool,
|
||||
#[serde(default)]
|
||||
pub hires_streamable: bool,
|
||||
pub maximum_sampling_rate: Option<f64>,
|
||||
pub maximum_bit_depth: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub streamable: bool,
|
||||
#[serde(default)]
|
||||
pub parental_warning: bool,
|
||||
/// Playlist-specific: ID within the playlist (for removal)
|
||||
pub playlist_track_id: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -180,6 +187,7 @@ pub struct Playlist {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PlaylistOwner {
|
||||
#[serde(default)]
|
||||
pub id: u64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
@@ -19,8 +19,13 @@ pub struct QobuzCredentials {
|
||||
|
||||
/// Save Qobuz credentials to system keyring
|
||||
pub fn save_qobuz_credentials(email: &str, password: &str) -> Result<(), String> {
|
||||
log::info!("Attempting to save credentials for: {}", email);
|
||||
|
||||
let entry = Entry::new(SERVICE_NAME, QOBUZ_CREDENTIALS_KEY)
|
||||
.map_err(|e| format!("Failed to create keyring entry: {}", e))?;
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to create keyring entry: {}", e);
|
||||
format!("Failed to create keyring entry: {}", e)
|
||||
})?;
|
||||
|
||||
let credentials = QobuzCredentials {
|
||||
email: email.to_string(),
|
||||
@@ -32,29 +37,40 @@ pub fn save_qobuz_credentials(email: &str, password: &str) -> Result<(), String>
|
||||
|
||||
entry
|
||||
.set_password(&json)
|
||||
.map_err(|e| format!("Failed to save to keyring: {}", e))?;
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to save to keyring: {}", e);
|
||||
format!("Failed to save to keyring: {}", e)
|
||||
})?;
|
||||
|
||||
log::info!("Qobuz credentials saved to system keyring");
|
||||
log::info!("Qobuz credentials saved to system keyring successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Load Qobuz credentials from system keyring
|
||||
pub fn load_qobuz_credentials() -> Result<Option<QobuzCredentials>, String> {
|
||||
log::info!("Attempting to load credentials from keyring");
|
||||
|
||||
let entry = Entry::new(SERVICE_NAME, QOBUZ_CREDENTIALS_KEY)
|
||||
.map_err(|e| format!("Failed to create keyring entry: {}", e))?;
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to create keyring entry for reading: {}", e);
|
||||
format!("Failed to create keyring entry: {}", e)
|
||||
})?;
|
||||
|
||||
match entry.get_password() {
|
||||
Ok(json) => {
|
||||
let credentials: QobuzCredentials = serde_json::from_str(&json)
|
||||
.map_err(|e| format!("Failed to parse credentials: {}", e))?;
|
||||
log::info!("Loaded Qobuz credentials from keyring for: {}", credentials.email);
|
||||
log::info!("Successfully loaded credentials from keyring for: {}", credentials.email);
|
||||
Ok(Some(credentials))
|
||||
}
|
||||
Err(keyring::Error::NoEntry) => {
|
||||
log::debug!("No saved Qobuz credentials found");
|
||||
log::info!("No saved credentials found in keyring");
|
||||
Ok(None)
|
||||
}
|
||||
Err(e) => Err(format!("Failed to load from keyring: {}", e)),
|
||||
Err(e) => {
|
||||
log::error!("Failed to load from keyring: {}", e);
|
||||
Err(format!("Failed to load from keyring: {}", e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user