diff options
author | Shav Kinderlehrer <[email protected]> | 2023-12-23 00:53:44 -0500 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2023-12-23 00:53:44 -0500 |
commit | 885615d1dd029138700c36bb8b23d211cf713811 (patch) | |
tree | d358d87926a8b5b73db87e9b87f3c46dfb35a435 /Jel/Views/Dashboard/DashboardLibraryView.swift | |
parent | 73c40b5aa0142ed89082214f790df539174e4dac (diff) | |
download | jel-885615d1dd029138700c36bb8b23d211cf713811.tar.gz jel-885615d1dd029138700c36bb8b23d211cf713811.zip |
Refactor LibraryIconView
Diffstat (limited to 'Jel/Views/Dashboard/DashboardLibraryView.swift')
-rw-r--r-- | Jel/Views/Dashboard/DashboardLibraryView.swift | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Jel/Views/Dashboard/DashboardLibraryView.swift b/Jel/Views/Dashboard/DashboardLibraryView.swift new file mode 100644 index 0000000..98c92c0 --- /dev/null +++ b/Jel/Views/Dashboard/DashboardLibraryView.swift @@ -0,0 +1,48 @@ +// +// DashboardLibraryView.swift +// Jel +// +// Created by zerocool on 12/15/23. +// + +import SwiftUI +import JellyfinKit + +struct DashboardLibraryView: View { + @EnvironmentObject var jellyfinClient: JellyfinClientController + + @StateObject var authState: AuthStateController = AuthStateController.shared + + @State var libraries: [BaseItemDto] = [] + var body: some View { + ScrollView(.horizontal, showsIndicators: false) { + HStack { + ForEach(libraries) {library in + if library.collectionType == "movies" || library.collectionType == "tvshows" { + NavigationLink { + LibraryDetailView(library: library) + } label: { + LibraryIconView(library: library, height: 200) + .padding() + } + } + } + } + } + .onAppear { + Task { + do { + let request = Paths.getUserViews(userID: authState.userId ?? "") + if let results = try await jellyfinClient.send(request).value.items { + libraries = results + } + } catch { + } + } + } + } +} + +//#Preview { +// LibraryView() +//} |