diff --git a/JellyfinPlayer.xcodeproj/project.pbxproj b/JellyfinPlayer.xcodeproj/project.pbxproj index 6815d46b..84a6349b 100644 --- a/JellyfinPlayer.xcodeproj/project.pbxproj +++ b/JellyfinPlayer.xcodeproj/project.pbxproj @@ -263,8 +263,8 @@ E18845F626DD631E00B0C5B7 /* BaseItemDto+Stackable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E18845F426DD631E00B0C5B7 /* BaseItemDto+Stackable.swift */; }; E18845F826DEA9C900B0C5B7 /* ItemViewBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = E18845F726DEA9C900B0C5B7 /* ItemViewBody.swift */; }; E188460026DECB9E00B0C5B7 /* ItemLandscapeTopBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E18845FF26DECB9E00B0C5B7 /* ItemLandscapeTopBarView.swift */; }; - E188460426DEF04800B0C5B7 /* CardVStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E188460326DEF04800B0C5B7 /* CardVStackView.swift */; }; - E188460526DEF04800B0C5B7 /* CardVStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E188460326DEF04800B0C5B7 /* CardVStackView.swift */; }; + E188460426DEF04800B0C5B7 /* EpisodeCardVStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E188460326DEF04800B0C5B7 /* EpisodeCardVStackView.swift */; }; + E188460526DEF04800B0C5B7 /* EpisodeCardVStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E188460326DEF04800B0C5B7 /* EpisodeCardVStackView.swift */; }; E1AD104A26D94822003E4A08 /* DetailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AD104926D94822003E4A08 /* DetailItem.swift */; }; E1AD104B26D94822003E4A08 /* DetailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AD104926D94822003E4A08 /* DetailItem.swift */; }; E1AD104D26D96CE3003E4A08 /* BaseItemDtoExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AD104C26D96CE3003E4A08 /* BaseItemDtoExtensions.swift */; }; @@ -497,7 +497,7 @@ E18845F426DD631E00B0C5B7 /* BaseItemDto+Stackable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BaseItemDto+Stackable.swift"; sourceTree = ""; }; E18845F726DEA9C900B0C5B7 /* ItemViewBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemViewBody.swift; sourceTree = ""; }; E18845FF26DECB9E00B0C5B7 /* ItemLandscapeTopBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemLandscapeTopBarView.swift; sourceTree = ""; }; - E188460326DEF04800B0C5B7 /* CardVStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardVStackView.swift; sourceTree = ""; }; + E188460326DEF04800B0C5B7 /* EpisodeCardVStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EpisodeCardVStackView.swift; sourceTree = ""; }; E1AD104926D94822003E4A08 /* DetailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailItem.swift; sourceTree = ""; }; E1AD104C26D96CE3003E4A08 /* BaseItemDtoExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseItemDtoExtensions.swift; sourceTree = ""; }; E1AD105526D981CE003E4A08 /* PortraitHStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PortraitHStackView.swift; sourceTree = ""; }; @@ -962,7 +962,7 @@ E1AD105B26D9ABDD003E4A08 /* PillHStackView.swift */, E1AD105526D981CE003E4A08 /* PortraitHStackView.swift */, 53F866432687A45F00DCD1D7 /* PortraitItemView.swift */, - E188460326DEF04800B0C5B7 /* CardVStackView.swift */, + E188460326DEF04800B0C5B7 /* EpisodeCardVStackView.swift */, ); path = Components; sourceTree = ""; @@ -1533,7 +1533,7 @@ 53ABFDE4267974EF00886593 /* LibraryListViewModel.swift in Sources */, 5364F456266CA0DC0026ECBA /* BaseItemPersonExtensions.swift in Sources */, E1AD105D26D9ABDD003E4A08 /* PillHStackView.swift in Sources */, - E188460526DEF04800B0C5B7 /* CardVStackView.swift in Sources */, + E188460526DEF04800B0C5B7 /* EpisodeCardVStackView.swift in Sources */, 5364F456266CA0DC0026ECBA /* BaseItemPersonExtensions.swift in Sources */, 6220D0BE26D60D6600B8E046 /* ItemViewModel.swift in Sources */, 531690FA267AD6EC005D8AB9 /* PlainNavigationLinkButton.swift in Sources */, @@ -1575,7 +1575,7 @@ E1FCD08826C35A0D007C8DCF /* NetworkError.swift in Sources */, E18845F826DEA9C900B0C5B7 /* ItemViewBody.swift in Sources */, E173DA5426D050F500CC4EB7 /* ServerDetailViewModel.swift in Sources */, - E188460426DEF04800B0C5B7 /* CardVStackView.swift in Sources */, + E188460426DEF04800B0C5B7 /* EpisodeCardVStackView.swift in Sources */, 53F8377D265FF67C00F456B3 /* VideoPlayerSettingsView.swift in Sources */, 53192D5D265AA78A008A4215 /* DeviceProfileBuilder.swift in Sources */, 62133890265F83A900A81A2A /* LibraryListView.swift in Sources */, diff --git a/JellyfinPlayer/Components/CardVStackView.swift b/JellyfinPlayer/Components/EpisodeCardVStackView.swift similarity index 95% rename from JellyfinPlayer/Components/CardVStackView.swift rename to JellyfinPlayer/Components/EpisodeCardVStackView.swift index 84583dd9..b7f2bac8 100644 --- a/JellyfinPlayer/Components/CardVStackView.swift +++ b/JellyfinPlayer/Components/EpisodeCardVStackView.swift @@ -10,9 +10,10 @@ import SwiftUI import JellyfinAPI -struct CardVStackView: View { +struct EpisodeCardVStackView: View { let items: [BaseItemDto] + let selectedAction: (BaseItemDto) -> Void private func buildCardOverlayView(item: BaseItemDto) -> some View { HStack { @@ -45,8 +46,9 @@ struct CardVStackView: View { var body: some View { VStack { ForEach(items, id: \.id) { item in - NavigationLink(destination: ItemNavigationView(item: item)) { - + Button { + selectedAction(item) + } label: { HStack { // MARK: Image diff --git a/JellyfinPlayer/Components/PillHStackView.swift b/JellyfinPlayer/Components/PillHStackView.swift index 3c6fcf06..e0b5d0fc 100644 --- a/JellyfinPlayer/Components/PillHStackView.swift +++ b/JellyfinPlayer/Components/PillHStackView.swift @@ -13,11 +13,12 @@ protocol PillStackable { var title: String { get } } -struct PillHStackView: View { +struct PillHStackView: View { let title: String let items: [ItemType] - let navigationView: (ItemType) -> NavigationView +// let navigationView: (ItemType) -> NavigationView + let selectedAction: (ItemType) -> Void var body: some View { VStack(alignment: .leading) { @@ -30,14 +31,14 @@ struct PillHStackView: View { ScrollView(.horizontal, showsIndicators: false) { HStack { ForEach(items, id: \.title) { item in - NavigationLink(destination: LazyView { - navigationView(item) - }) { + Button { + selectedAction(item) + } label: { ZStack { Color(UIColor.systemFill) .frame(maxWidth: .infinity, maxHeight: .infinity) .cornerRadius(10) - + Text(item.title) .font(.caption) .fontWeight(.semibold) diff --git a/JellyfinPlayer/Components/PortraitHStackView.swift b/JellyfinPlayer/Components/PortraitHStackView.swift index 96e32645..4d97d34a 100644 --- a/JellyfinPlayer/Components/PortraitHStackView.swift +++ b/JellyfinPlayer/Components/PortraitHStackView.swift @@ -17,20 +17,20 @@ public protocol PortraitImageStackable { var failureInitials: String { get } } -struct PortraitImageHStackView: View { +struct PortraitImageHStackView: View { let items: [ItemType] let maxWidth: Int let horizontalAlignment: HorizontalAlignment let topBarView: () -> TopBarView - let navigationView: (ItemType) -> NavigationView + let selectedAction: (ItemType) -> Void - init(items: [ItemType], maxWidth: Int, horizontalAlignment: HorizontalAlignment = .leading, topBarView: @escaping () -> TopBarView, navigationView: @escaping (ItemType) -> NavigationView) { + init(items: [ItemType], maxWidth: Int, horizontalAlignment: HorizontalAlignment = .leading, topBarView: @escaping () -> TopBarView, selectedAction: @escaping (ItemType) -> Void) { self.items = items self.maxWidth = maxWidth self.horizontalAlignment = horizontalAlignment self.topBarView = topBarView - self.navigationView = navigationView + self.selectedAction = selectedAction } var body: some View { @@ -45,38 +45,36 @@ struct PortraitImageHStackView