summaryrefslogtreecommitdiff
path: root/Jel/Views/Item/Series/ItemSeriesSeriesView.swift
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2024-02-13 21:37:02 -0500
committerShav Kinderlehrer <[email protected]>2024-02-13 21:37:02 -0500
commit5c0aeedc3d9b2f7a8427fb7973d2ce8ec24ae257 (patch)
tree99c98fbe6c0164c9834ea76d636293ba70e44247 /Jel/Views/Item/Series/ItemSeriesSeriesView.swift
parent2d9d946bae8e2fa2dd0daea741442c7fa8350ad5 (diff)
downloadjel-5c0aeedc3d9b2f7a8427fb7973d2ce8ec24ae257.tar.gz
jel-5c0aeedc3d9b2f7a8427fb7973d2ce8ec24ae257.zip
Create ItemSeriesView + start ItemSeasonView
Diffstat (limited to 'Jel/Views/Item/Series/ItemSeriesSeriesView.swift')
-rw-r--r--Jel/Views/Item/Series/ItemSeriesSeriesView.swift58
1 files changed, 58 insertions, 0 deletions
diff --git a/Jel/Views/Item/Series/ItemSeriesSeriesView.swift b/Jel/Views/Item/Series/ItemSeriesSeriesView.swift
new file mode 100644
index 0000000..1e54185
--- /dev/null
+++ b/Jel/Views/Item/Series/ItemSeriesSeriesView.swift
@@ -0,0 +1,58 @@
+//
+// ItemSeriesSeriesView.swift
+// Jel
+//
+// Created by zerocool on 2/12/24.
+//
+
+import SwiftUI
+import JellyfinKit
+
+struct ItemSeriesSeriesView: View {
+ var item: BaseItemDto
+
+ @EnvironmentObject var jellyfinClient: JellyfinClientController
+ @StateObject var authState: AuthStateController = AuthStateController.shared
+
+ @State var seriesItems: [BaseItemDto] = []
+
+ var body: some View {
+ VStack(alignment: .leading) {
+ Text("Series")
+ .font(.title2)
+ .padding(.horizontal)
+
+ ScrollView(.horizontal) {
+ LazyHStack {
+ ForEach(seriesItems) {series in
+ NavigationLink {
+ ItemView(item: series)
+ } label: {
+ ItemIconView(item: series, height: 170)
+ .setAspectRatio(series.primaryImageAspectRatio ?? 0.6)
+ .showCaption()
+ }
+ }
+ }.padding(.horizontal)
+ }
+ }
+ .onAppear{
+ Task {
+ let parameters = Paths.GetItemsParameters(
+ userID: authState.userId ?? "",
+ parentID: item.id ?? ""
+ )
+ let req = Paths.getItems(parameters: parameters)
+
+ do {
+ let res = try await jellyfinClient.send(req)
+ seriesItems = res.value.items ?? []
+ } catch {}
+ }
+ }
+ }
+}
+
+//#Preview {
+// ItemSeriesSeriesView()
+//}