diff options
author | Shav Kinderlehrer <[email protected]> | 2023-12-22 17:14:21 -0500 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2023-12-22 17:14:21 -0500 |
commit | 5b78933de774fcf9291ba40e74dd928925699b0c (patch) | |
tree | ea256f35be0d2ef158306cd9a5dad1c72b4d6efd /Jel/Views/Dashboard/Library/LibraryView.swift | |
parent | 62a8e5704edb604d41af34df7607adf6492ca855 (diff) | |
download | jel-5b78933de774fcf9291ba40e74dd928925699b0c.tar.gz jel-5b78933de774fcf9291ba40e74dd928925699b0c.zip |
Start implementing dashboard view + async image loader
Diffstat (limited to 'Jel/Views/Dashboard/Library/LibraryView.swift')
-rw-r--r-- | Jel/Views/Dashboard/Library/LibraryView.swift | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Jel/Views/Dashboard/Library/LibraryView.swift b/Jel/Views/Dashboard/Library/LibraryView.swift new file mode 100644 index 0000000..39ca6ba --- /dev/null +++ b/Jel/Views/Dashboard/Library/LibraryView.swift @@ -0,0 +1,44 @@ +// +// LibraryView.swift +// Jel +// +// Created by zerocool on 12/15/23. +// + +import SwiftUI +import JellyfinKit + +struct LibraryView: View { + @EnvironmentObject var jellyfinClient: JellyfinClientController + + @StateObject var authState: AuthStateController = AuthStateController.shared + + @State var libraries: [BaseItemDto] = [] + var body: some View { + ScrollView(.horizontal, showsIndicators: false) { + LazyHStack { + ForEach(libraries) {library in + if library.collectionType == "movies" || library.collectionType == "tvshows" { + LibraryIconView(library: library) + } + } + } + } + .onAppear { + Task { + do { + let request = Paths.getUserViews(userID: authState.userId ?? "") + if let results = try await jellyfinClient.send(request).value.items { + libraries = results + } + } catch { + print(error) + } + } + } + } +} + +//#Preview { +// LibraryView() +//} |