Implement ItemPersonView media links

This commit is contained in:
Shav Kinderlehrer 2024-01-30 16:52:53 -05:00
parent 4c98eef120
commit 092084cb56
2 changed files with 27 additions and 17 deletions

View File

@ -8,6 +8,29 @@
import SwiftUI import SwiftUI
import JellyfinKit import JellyfinKit
struct ItemPersonViewItemsRow: View {
var items: [BaseItemDto]
var body: some View {
ScrollView(.horizontal) {
LazyHStack {
ForEach(items) {item in
NavigationLink {
ItemView(item: item)
} label: {
ItemIconView(item: item, width: 150)
.showCaption()
.setAspectRatio(item.primaryImageAspectRatio ?? 0.6)
.padding()
}
.buttonStyle(PlainButtonStyle())
}
}
.padding(.horizontal)
}
}
}
struct ItemPersonView: View { struct ItemPersonView: View {
@EnvironmentObject var jellyfinClient: JellyfinClientController @EnvironmentObject var jellyfinClient: JellyfinClientController
@ -33,14 +56,7 @@ struct ItemPersonView: View {
Text("Movies") Text("Movies")
.font(.title2) .font(.title2)
.padding(.horizontal) .padding(.horizontal)
ScrollView(.horizontal) { ItemPersonViewItemsRow(items: movies)
LazyHStack {
ForEach(movies) {movie in
Text(movie.name ?? "")
}
}
.padding(.horizontal)
}
} }
let shows = items.filter({$0.type == .series}) let shows = items.filter({$0.type == .series})
@ -48,14 +64,7 @@ struct ItemPersonView: View {
Text("Shows") Text("Shows")
.font(.title2) .font(.title2)
.padding(.horizontal) .padding(.horizontal)
ScrollView(.horizontal) { ItemPersonViewItemsRow(items: shows)
LazyHStack {
ForEach(shows) {show in
Text(show.name ?? "")
}
}
.padding(.horizontal)
}
} }
} }
} }
@ -70,6 +79,7 @@ struct ItemPersonView: View {
do { do {
let res = try await jellyfinClient.send(request) let res = try await jellyfinClient.send(request)
items = res.value.items ?? [] items = res.value.items ?? []
print(items![0])
} catch {} } catch {}
} }
} }

View File

@ -40,7 +40,7 @@ struct LibraryDetailView: View {
NavigationLink { NavigationLink {
ItemView(item: item) ItemView(item: item)
} label: { } label: {
ItemIconView(item: item, imageType: "Primary", width: 150) ItemIconView(item: item, width: 150)
.showCaption() .showCaption()
.setAspectRatio(item.primaryImageAspectRatio ?? 0.6) .setAspectRatio(item.primaryImageAspectRatio ?? 0.6)
.padding() .padding()