Add playlist and favorites commands, update sidebar
Backend: - Add playlist.rs commands: get_user_playlists, get_playlist, search_playlists - Add favorites.rs commands: get_favorites, add_favorite, remove_favorite - Add API client methods: search_playlists, add_favorite, remove_favorite Frontend: - Remove Radio and New from sidebar (no API support) - Sidebar now loads and displays user playlists dynamically - Add playlist and favorites views (placeholder for now) - Pass selectedPlaylistId and onPlaylistSelect to Sidebar
This commit is contained in:
1 parent
dd2600feaa
commit
bda4ea5b76
7 files changed
+276
-50
No files matched your search
+24
-1
@@ -119,10 +119,11 @@
|
||||
let userInfo = $state<{ userName: string; subscription: string } | null>(null);
|
||||
|
||||
// View State
|
||||
type ViewType = 'home' | 'search' | 'library' | 'settings' | 'album';
|
||||
type ViewType = 'home' | 'search' | 'library' | 'settings' | 'album' | 'playlist' | 'favorites';
|
||||
let activeView = $state<ViewType>('home');
|
||||
let viewHistory = $state<ViewType[]>(['home']);
|
||||
let selectedAlbum = $state<AlbumDetail | null>(null);
|
||||
let selectedPlaylistId = $state<number | null>(null);
|
||||
|
||||
// Overlay States
|
||||
let isQueueOpen = $state(false);
|
||||
@@ -166,9 +167,17 @@
|
||||
if (activeView !== 'album') {
|
||||
selectedAlbum = null;
|
||||
}
|
||||
if (activeView !== 'playlist') {
|
||||
selectedPlaylistId = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlaylistSelect(playlistId: number) {
|
||||
selectedPlaylistId = playlistId;
|
||||
navigateTo('playlist');
|
||||
}
|
||||
|
||||
async function handleAlbumClick(albumId: string) {
|
||||
try {
|
||||
showToast('Loading album...', 'info');
|
||||
@@ -760,7 +769,9 @@
|
||||
<!-- Sidebar -->
|
||||
<Sidebar
|
||||
{activeView}
|
||||
{selectedPlaylistId}
|
||||
onNavigate={navigateTo}
|
||||
onPlaylistSelect={handlePlaylistSelect}
|
||||
onSettingsClick={() => navigateTo('settings')}
|
||||
onLogout={handleLogout}
|
||||
userName={userInfo?.userName || 'User'}
|
||||
@@ -794,6 +805,18 @@
|
||||
<h1>Library</h1>
|
||||
<p>Your library will appear here...</p>
|
||||
</div>
|
||||
{:else if activeView === 'playlist' && selectedPlaylistId}
|
||||
<div class="placeholder-view">
|
||||
<h1>Playlist</h1>
|
||||
<p>Playlist view coming soon... (ID: {selectedPlaylistId})</p>
|
||||
<button class="back-btn" onclick={goBack}>Go Back</button>
|
||||
</div>
|
||||
{:else if activeView === 'favorites'}
|
||||
<div class="placeholder-view">
|
||||
<h1>Favorites</h1>
|
||||
<p>Your favorite tracks and albums will appear here...</p>
|
||||
<button class="back-btn" onclick={goBack}>Go Back</button>
|
||||
</div>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
|
||||
Reference in new issue
Block a user