summaryrefslogtreecommitdiff
path: root/Jel/Views/Item/Series/ItemSeriesSeasonsView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Jel/Views/Item/Series/ItemSeriesSeasonsView.swift')
-rw-r--r--Jel/Views/Item/Series/ItemSeriesSeasonsView.swift58
1 files changed, 58 insertions, 0 deletions
diff --git a/Jel/Views/Item/Series/ItemSeriesSeasonsView.swift b/Jel/Views/Item/Series/ItemSeriesSeasonsView.swift
new file mode 100644
index 0000000..a559174
--- /dev/null
+++ b/Jel/Views/Item/Series/ItemSeriesSeasonsView.swift
@@ -0,0 +1,58 @@
+//
+// ItemSeriesSeasonsView.swift
+// Jel
+//
+// Created by zerocool on 2/12/24.
+//
+
+import SwiftUI
+import JellyfinKit
+
+struct ItemSeriesSeasonsView: 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("Seasons")
+ .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()
+//}