import Foundation import SwiftData /// Which section of the sidebar is selected — drives the central content area. /// /// A single `@State var sidebarSelection: SidebarSection?` in ContentView replaces /// the old triple-state model (selectedPlaylist + isBrowsePanelOpen + browsePanelTab). enum SidebarSection: Hashable { /// Cloud library browsing — shows CloudBrowserView in center. case library(LibraryDestination) /// Playback queue — shows QueueView in center. case queue /// Soulseek downloads — shows DownloadsView in center. case downloads /// A user playlist — shows PlaylistView in center. case playlist(Playlist) } /// Which library view to show in the center area. enum LibraryDestination: String, Hashable, CaseIterable { case browse // root category grid case albums case artists case genres case years case search /// Map to CloudBrowserView's internal navigation. var initialNavStack: [CloudNavDestination] { switch self { case .browse: return [] case .albums: return [.category(.album)] case .artists: return [.category(.artist)] case .genres: return [.category(.genre)] case .years: return [.category(.year)] case .search: return [.search(query: "")] } } var displayName: String { switch self { case .browse: return "Browse" case .albums: return "Albums" case .artists: return "Artists" case .genres: return "Genres" case .years: return "Years" case .search: return "Search" } } var icon: String { switch self { case .browse: return "globe" case .albums: return "square.stack" case .artists: return "music.mic" case .genres: return "guitars" case .years: return "calendar" case .search: return "magnifyingglass" } } }