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 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 {
@EnvironmentObject var jellyfinClient: JellyfinClientController
@ -33,14 +56,7 @@ struct ItemPersonView: View {
Text("Movies")
.font(.title2)
.padding(.horizontal)
ScrollView(.horizontal) {
LazyHStack {
ForEach(movies) {movie in
Text(movie.name ?? "")
}
}
.padding(.horizontal)
}
ItemPersonViewItemsRow(items: movies)
}
let shows = items.filter({$0.type == .series})
@ -48,14 +64,7 @@ struct ItemPersonView: View {
Text("Shows")
.font(.title2)
.padding(.horizontal)
ScrollView(.horizontal) {
LazyHStack {
ForEach(shows) {show in
Text(show.name ?? "")
}
}
.padding(.horizontal)
}
ItemPersonViewItemsRow(items: shows)
}
}
}
@ -70,6 +79,7 @@ struct ItemPersonView: View {
do {
let res = try await jellyfinClient.send(request)
items = res.value.items ?? []
print(items![0])
} catch {}
}
}

View File

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