diff options
author | Shav Kinderlehrer <[email protected]> | 2024-01-30 16:52:53 -0500 |
---|---|---|
committer | Shav Kinderlehrer <[email protected]> | 2024-01-30 16:52:53 -0500 |
commit | 092084cb5645565b019d6af106474f290a22317e (patch) | |
tree | b55e39d8a0c899e288b3b073b92f26ebfb95bc58 | |
parent | 4c98eef1201c42100597d0093988db60b03b0e32 (diff) | |
download | jel-092084cb5645565b019d6af106474f290a22317e.tar.gz jel-092084cb5645565b019d6af106474f290a22317e.zip |
Implement ItemPersonView media links
-rw-r--r-- | Jel/Views/Item/Types/ItemPersonView.swift | 42 | ||||
-rw-r--r-- | Jel/Views/Library/LibraryDetailView.swift | 2 |
2 files changed, 27 insertions, 17 deletions
diff --git a/Jel/Views/Item/Types/ItemPersonView.swift b/Jel/Views/Item/Types/ItemPersonView.swift index b827480..ebbc52f 100644 --- a/Jel/Views/Item/Types/ItemPersonView.swift +++ b/Jel/Views/Item/Types/ItemPersonView.swift @@ -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 {} } } diff --git a/Jel/Views/Library/LibraryDetailView.swift b/Jel/Views/Library/LibraryDetailView.swift index 5f0d9a7..c75cf39 100644 --- a/Jel/Views/Library/LibraryDetailView.swift +++ b/Jel/Views/Library/LibraryDetailView.swift @@ -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() |