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:
vicrodh committed 2026-01-09 14:55:53 -06:00
1 parent 6eed045404
commit cdc06d8759
10 files changed
+258 -115

No files matched your search

+14 -6
View File
@@ -15,6 +15,7 @@
{onclick}
class="nav-item"
class:active
title={label}
>
<div class="icon-container">
{@render icon()}
@@ -25,17 +26,18 @@
<style>
.nav-item {
width: 100%;
height: 36px;
height: 32px;
display: flex;
align-items: center;
gap: 8px;
padding: 0 12px;
border-radius: 8px;
padding: 0 8px;
border-radius: 6px;
border: none;
background: transparent;
color: var(--text-muted);
cursor: pointer;
transition: all 150ms ease;
text-align: left;
}
.nav-item:hover {
@@ -48,15 +50,21 @@
}
.icon-container {
width: 18px;
height: 18px;
width: 14px;
height: 14px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.label {
font-size: 14px;
font-size: 13px;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
}
</style>
+25 -25
View File
@@ -97,7 +97,7 @@
active={activeView === 'home'}
onclick={() => handleViewChange('home')}
>
{#snippet icon()}<Home size={18} />{/snippet}
{#snippet icon()}<Home size={14} />{/snippet}
</NavigationItem>
</nav>
@@ -120,7 +120,7 @@
active={activeView === 'favorites'}
onclick={() => handleViewChange('favorites')}
>
{#snippet icon()}<Heart size={18} />{/snippet}
{#snippet icon()}<Heart size={14} />{/snippet}
</NavigationItem>
{#if playlistsLoading}
@@ -132,7 +132,7 @@
active={activeView === 'playlist' && selectedPlaylistId === playlist.id}
onclick={() => handlePlaylistClick(playlist)}
>
{#snippet icon()}<ListMusic size={18} />{/snippet}
{#snippet icon()}<ListMusic size={14} />{/snippet}
</NavigationItem>
{/each}
{:else}
@@ -148,7 +148,7 @@
active={activeView === 'library'}
onclick={() => handleViewChange('library')}
>
{#snippet icon()}<HardDrive size={18} />{/snippet}
{#snippet icon()}<HardDrive size={14} />{/snippet}
</NavigationItem>
</div>
</div>
@@ -166,8 +166,8 @@
<style>
.sidebar {
width: 240px;
min-width: 240px;
width: 280px;
min-width: 280px;
flex-shrink: 0;
background-color: var(--bg-secondary);
display: flex;
@@ -178,22 +178,22 @@
.content {
flex: 1;
overflow-y: auto;
padding: 16px;
padding: 12px;
padding-bottom: 0;
display: flex;
flex-direction: column;
gap: 24px;
gap: 16px;
}
.search-container {
display: flex;
align-items: center;
gap: 12px;
gap: 10px;
width: 100%;
height: 36px;
height: 32px;
background-color: var(--bg-tertiary);
border-radius: 8px;
padding: 0 12px;
border-radius: 6px;
padding: 0 10px;
border: none;
cursor: pointer;
transition: background-color 150ms ease;
@@ -210,7 +210,7 @@
}
.search-placeholder {
font-size: 14px;
font-size: 13px;
color: var(--text-muted);
pointer-events: none;
}
@@ -218,36 +218,36 @@
.nav-section {
display: flex;
flex-direction: column;
gap: 4px;
gap: 2px;
}
.section {
display: flex;
flex-direction: column;
gap: 4px;
gap: 2px;
}
.section-header {
font-size: 11px;
font-size: 10px;
text-transform: uppercase;
color: var(--text-muted);
font-weight: 600;
letter-spacing: 0.05em;
margin-bottom: 8px;
padding: 0 12px;
margin-bottom: 6px;
padding: 0 8px;
}
.playlists-section {
flex: 1;
padding-bottom: 16px;
padding-bottom: 12px;
}
.playlists-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
margin-bottom: 8px;
padding: 0 8px;
margin-bottom: 6px;
}
.playlists-header .section-header {
@@ -258,7 +258,7 @@
.header-actions {
display: flex;
align-items: center;
gap: 4px;
gap: 2px;
}
.icon-btn {
@@ -276,13 +276,13 @@
.playlists-loading,
.no-playlists {
font-size: 13px;
font-size: 12px;
color: var(--text-muted);
padding: 8px 12px;
padding: 6px 8px;
}
.user-section {
border-top: 1px solid var(--bg-tertiary);
padding: 12px;
padding: 8px;
}
</style>
+24 -14
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { Play, Plus, MoreHorizontal } from 'lucide-svelte';
import { Play, Plus, ListPlus, MoreHorizontal } from 'lucide-svelte';
interface Props {
number: number;
@@ -9,6 +9,8 @@
quality?: string;
isPlaying?: boolean;
onPlay?: () => void;
onAddToPlaylist?: () => void;
onAddToQueue?: () => void;
}
let {
@@ -18,7 +20,9 @@
duration,
quality,
isPlaying = false,
onPlay
onPlay,
onAddToPlaylist,
onAddToQueue
}: Props = $props();
let isHovered = $state(false);
@@ -69,18 +73,24 @@
<!-- Hover Actions -->
{#if isHovered && !isPlaying}
<div class="track-actions">
<button
class="action-btn"
onclick={(e) => e.stopPropagation()}
>
<Plus size={20} />
</button>
<button
class="action-btn"
onclick={(e) => e.stopPropagation()}
>
<MoreHorizontal size={20} />
</button>
{#if onAddToQueue}
<button
class="action-btn"
onclick={(e) => { e.stopPropagation(); onAddToQueue(); }}
title="Add to queue"
>
<Plus size={18} />
</button>
{/if}
{#if onAddToPlaylist}
<button
class="action-btn"
onclick={(e) => { e.stopPropagation(); onAddToPlaylist(); }}
title="Add to playlist"
>
<ListPlus size={18} />
</button>
{/if}
</div>
{/if}
</div>
+116 -46
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { Settings, LogOut } from 'lucide-svelte';
import { Settings, LogOut, ChevronDown, ChevronUp } from 'lucide-svelte';
interface Props {
username: string;
@@ -10,58 +10,80 @@
}
let { username, subscription, avatarUrl, onSettingsClick, onLogout }: Props = $props();
let isCollapsed = $state(false);
</script>
<div class="user-card">
<!-- Avatar -->
<div class="avatar">
{#if avatarUrl}
<img src={avatarUrl} alt={username} />
{:else}
{username.charAt(0).toUpperCase()}
{/if}
</div>
{#if isCollapsed}
<!-- Collapsed view -->
<button class="collapsed-card" onclick={() => isCollapsed = false}>
<div class="mini-logo">Q</div>
<span class="collapsed-username">{username}</span>
<ChevronDown size={12} />
</button>
{:else}
<!-- Expanded view -->
<div class="user-card">
<!-- Avatar -->
<div class="avatar">
{#if avatarUrl}
<img src={avatarUrl} alt={username} />
{:else}
{username.charAt(0).toUpperCase()}
{/if}
</div>
<!-- User Info -->
<div class="user-info">
<div class="username">{username}</div>
<div class="subscription">{subscription}</div>
</div>
<!-- User Info -->
<div class="user-info">
<div class="username">{username}</div>
<div class="subscription">{subscription}</div>
</div>
<!-- Action Buttons -->
<div class="action-buttons">
<button
class="action-btn"
onclick={(e) => {
e.stopPropagation();
onSettingsClick();
}}
title="Settings"
>
<Settings size={18} />
</button>
{#if onLogout}
<!-- Action Buttons -->
<div class="action-buttons">
<button
class="action-btn logout-btn"
class="action-btn"
onclick={(e) => {
e.stopPropagation();
onLogout();
onSettingsClick();
}}
title="Logout"
title="Settings"
>
<LogOut size={18} />
<Settings size={14} />
</button>
{/if}
{#if onLogout}
<button
class="action-btn logout-btn"
onclick={(e) => {
e.stopPropagation();
onLogout();
}}
title="Logout"
>
<LogOut size={14} />
</button>
{/if}
<button
class="action-btn collapse-btn"
onclick={(e) => {
e.stopPropagation();
isCollapsed = true;
}}
title="Collapse"
>
<ChevronUp size={14} />
</button>
</div>
</div>
</div>
{/if}
<style>
.user-card {
display: flex;
align-items: center;
gap: 12px;
padding: 8px;
border-radius: 8px;
gap: 8px;
padding: 6px;
border-radius: 6px;
cursor: pointer;
transition: background-color 150ms ease;
}
@@ -71,8 +93,8 @@
}
.avatar {
width: 40px;
height: 40px;
width: 28px;
height: 28px;
border-radius: 50%;
background-color: var(--accent-primary);
display: flex;
@@ -80,7 +102,7 @@
justify-content: center;
color: white;
font-weight: 600;
font-size: 14px;
font-size: 11px;
flex-shrink: 0;
overflow: hidden;
}
@@ -97,7 +119,7 @@
}
.username {
font-size: 14px;
font-size: 12px;
font-weight: 500;
color: var(--text-primary);
overflow: hidden;
@@ -106,7 +128,7 @@
}
.subscription {
font-size: 12px;
font-size: 10px;
color: var(--accent-primary);
overflow: hidden;
text-overflow: ellipsis;
@@ -116,12 +138,12 @@
.action-buttons {
display: flex;
align-items: center;
gap: 4px;
gap: 2px;
}
.action-btn {
width: 28px;
height: 28px;
width: 22px;
height: 22px;
display: flex;
align-items: center;
justify-content: center;
@@ -130,7 +152,7 @@
color: var(--text-muted);
cursor: pointer;
flex-shrink: 0;
border-radius: 6px;
border-radius: 4px;
transition: all 150ms ease;
}
@@ -142,4 +164,52 @@
.logout-btn:hover {
color: #ff6b6b;
}
/* Collapsed state */
.collapsed-card {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 6px 8px;
border-radius: 6px;
background: none;
border: none;
cursor: pointer;
transition: background-color 150ms ease;
color: var(--text-primary);
}
.collapsed-card:hover {
background-color: var(--bg-hover);
}
.mini-logo {
width: 20px;
height: 20px;
border-radius: 4px;
background-color: var(--accent-primary);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: 700;
font-size: 10px;
flex-shrink: 0;
}
.collapsed-username {
flex: 1;
font-size: 12px;
font-weight: 500;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.collapsed-card :global(svg) {
color: var(--text-muted);
flex-shrink: 0;
}
</style>
@@ -36,9 +36,10 @@
onPlayAll?: () => void;
onShuffleAll?: () => void;
onAddToQueue?: () => void;
onAddTrackToPlaylist?: (trackId: number) => void;
}
let { album, onBack, onArtistClick, onTrackPlay, onPlayAll, onShuffleAll, onAddToQueue }: Props = $props();
let { album, onBack, onArtistClick, onTrackPlay, onPlayAll, onShuffleAll, onAddToQueue, onAddTrackToPlaylist }: Props = $props();
let currentTrack = $state<number | null>(null);
let isFavorite = $state(false);
@@ -149,6 +150,7 @@
currentTrack = track.id;
onTrackPlay?.(track);
}}
onAddToPlaylist={onAddTrackToPlaylist ? () => onAddTrackToPlaylist(track.id) : undefined}
/>
{/each}
</div>
@@ -244,10 +244,8 @@
title={track.title}
artist={track.performer?.name}
duration={formatDuration(track.duration)}
hires={track.hires}
bitDepth={track.maximum_bit_depth}
samplingRate={track.maximum_sampling_rate}
onclick={() => handleTrackClick(track, index)}
quality={track.hires ? 'Hi-Res' : undefined}
onPlay={() => handleTrackClick(track, index)}
/>
{/each}
</div>
@@ -266,8 +264,7 @@
artwork={album.image?.large || album.image?.thumbnail || ''}
title={album.title}
artist={album.artist.name}
year={album.release_date_original?.slice(0, 4)}
hires={album.hires}
quality={album.hires ? 'Hi-Res' : undefined}
onclick={() => onAlbumClick?.(album.id)}
/>
{/each}
@@ -451,10 +451,8 @@
title={track.title}
artist={track.artist}
duration={track.duration}
hires={track.hires}
bitDepth={track.bitDepth}
samplingRate={track.samplingRate}
onclick={() => handleTrackClick(track)}
quality={track.hires ? 'Hi-Res' : undefined}
onPlay={() => handleTrackClick(track)}
/>
{/each}