From e5d2c84f4528e6fcbe388c6d5dca6066642a1698 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 8 Jan 2025 16:53:00 -0700 Subject: [PATCH] WIP --- .../BaseItemDto/BaseItemDto+Poster.swift | 7 +- .../EpisodeItemContentView.swift | 104 +++++++++++------- .../ScrollViews/CinematicScrollView.swift | 2 +- 3 files changed, 70 insertions(+), 43 deletions(-) diff --git a/Shared/Extensions/JellyfinAPI/BaseItemDto/BaseItemDto+Poster.swift b/Shared/Extensions/JellyfinAPI/BaseItemDto/BaseItemDto+Poster.swift index 03c20900d..54baedf6a 100644 --- a/Shared/Extensions/JellyfinAPI/BaseItemDto/BaseItemDto+Poster.swift +++ b/Shared/Extensions/JellyfinAPI/BaseItemDto/BaseItemDto+Poster.swift @@ -20,7 +20,12 @@ extension BaseItemDto: Poster { case .episode: seasonEpisodeLabel case .video: - extraType?.displayTitle + /// Don't show any subtitle if it's unknown + if let extraType, extraType != .unknown { + extraType.displayTitle + } else { + nil + } default: nil } diff --git a/Swiftfin tvOS/Views/ItemView/EpisodeItemView/EpisodeItemContentView.swift b/Swiftfin tvOS/Views/ItemView/EpisodeItemView/EpisodeItemContentView.swift index 4bfdf9331..49c5ff0d8 100644 --- a/Swiftfin tvOS/Views/ItemView/EpisodeItemView/EpisodeItemContentView.swift +++ b/Swiftfin tvOS/Views/ItemView/EpisodeItemView/EpisodeItemContentView.swift @@ -89,60 +89,82 @@ extension EpisodeItemView.ContentView { .focusable() .focused($focusedLayer, equals: .top) - HStack(alignment: .bottom) { + VStack(alignment: .leading, spacing: 16) { - VStack(alignment: .leading, spacing: 20) { + if let seriesName = viewModel.item.seriesName { + Text(seriesName) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.secondary) + } - if let seriesName = viewModel.item.seriesName { - Text(seriesName) - .font(.headline) - .fontWeight(.semibold) - .foregroundColor(.secondary) - } + HStack(alignment: .bottom) { - Text(viewModel.item.displayTitle) - .font(.title2) - .fontWeight(.semibold) - .lineLimit(1) - .multilineTextAlignment(.leading) - .foregroundColor(.white) - - if let overview = viewModel.item.overview { - Text(overview) - .font(.subheadline) - .lineLimit(3) - } else { - L10n.noOverviewAvailable.text - } + HStack(alignment: .bottom, spacing: 16) { - HStack { - DotHStack { - if let premiereYear = viewModel.item.premiereDateYear { - Text(premiereYear) + ImageView(viewModel.item.imageSource( + .primary, + maxHeight: 250 + )) + .placeholder { _ in + EmptyView() + } + .failure { + EmptyView() + } + .aspectRatio(contentMode: .fit) + .posterShadow() + .frame(maxHeight: 250, alignment: .bottomLeading) + .clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous)) + + VStack(alignment: .leading, spacing: 20) { + + Text(viewModel.item.displayTitle) + .font(.title2) + .fontWeight(.semibold) + .lineLimit(1) + .multilineTextAlignment(.leading) + .foregroundColor(.white) + + if let overview = viewModel.item.overview { + Text(overview) + .font(.subheadline) + .multilineTextAlignment(.leading) + .lineLimit(3) + } else { + L10n.noOverviewAvailable.text } - if let playButtonitem = viewModel.playButtonItem, let runtime = playButtonitem.runTimeLabel { - Text(runtime) + HStack { + DotHStack { + if let premiereYear = viewModel.item.premiereDateYear { + Text(premiereYear) + } + + if let playButtonitem = viewModel.playButtonItem, let runtime = playButtonitem.runTimeLabel { + Text(runtime) + } + } + .font(.caption) + .foregroundColor(Color(UIColor.lightGray)) + + ItemView.AttributesHStack(viewModel: viewModel) } } - .font(.caption) - .foregroundColor(Color(UIColor.lightGray)) - - ItemView.AttributesHStack(viewModel: viewModel) } - } - Spacer() + Spacer() - VStack { - ItemView.PlayButton(viewModel: viewModel) - .focused($focusedLayer, equals: .playButton) + VStack { + ItemView.PlayButton(viewModel: viewModel) + .focused($focusedLayer, equals: .playButton) - ItemView.ActionButtonHStack(viewModel: viewModel) - .frame(width: 400) + ItemView.ActionButtonHStack(viewModel: viewModel) + .frame(width: 400) + } + .frame(width: 450) + .padding(.leading, 150) } - .frame(width: 450) - .padding(.leading, 150) } } .padding(.horizontal, 50) diff --git a/Swiftfin tvOS/Views/ItemView/ScrollViews/CinematicScrollView.swift b/Swiftfin tvOS/Views/ItemView/ScrollViews/CinematicScrollView.swift index 33384541f..756e5e0e6 100644 --- a/Swiftfin tvOS/Views/ItemView/ScrollViews/CinematicScrollView.swift +++ b/Swiftfin tvOS/Views/ItemView/ScrollViews/CinematicScrollView.swift @@ -21,7 +21,7 @@ extension ItemView { var body: some View { ZStack { if viewModel.item.type == .episode { - ImageView(viewModel.item.imageSource(.primary, maxWidth: 1920)) + ImageView(viewModel.item.seriesImageSource(.backdrop, maxWidth: 1920)) } else { ImageView(viewModel.item.imageSource(.backdrop, maxWidth: 1920)) }