Version one on the App Store
This commit is contained in:
@@ -17,6 +17,7 @@ enum LibraryTab: String, CaseIterable {
|
||||
struct LibraryView: View {
|
||||
@Environment(MAService.self) private var service
|
||||
@State private var selectedTab: LibraryTab = .artists
|
||||
@State private var showSearch = false
|
||||
@State private var refreshError: String?
|
||||
@State private var showError = false
|
||||
|
||||
@@ -75,22 +76,28 @@ struct LibraryView: View {
|
||||
}
|
||||
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
NavigationLink {
|
||||
SearchView()
|
||||
Button {
|
||||
showSearch = true
|
||||
} label: {
|
||||
Label("Search", systemImage: "magnifyingglass")
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationDestination(for: MAArtist.self) { ArtistDetailView(artist: $0) }
|
||||
.navigationDestination(for: MAAlbum.self) { AlbumDetailView(album: $0) }
|
||||
.navigationDestination(for: MAPlaylist.self) { PlaylistDetailView(playlist: $0) }
|
||||
.withMANavigation()
|
||||
.alert("Refresh Failed", isPresented: $showError) {
|
||||
Button("OK", role: .cancel) { }
|
||||
} message: {
|
||||
if let refreshError { Text(refreshError) }
|
||||
}
|
||||
}
|
||||
// Search presented as isolated sheet with its own NavigationStack.
|
||||
// This prevents the main LibraryView stack from being affected by
|
||||
// search-internal navigation (artist/album/playlist detail).
|
||||
.sheet(isPresented: $showSearch) {
|
||||
NavigationStack {
|
||||
SearchView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
Reference in New Issue
Block a user