From fb5cd0f6814ed9b12b0c163ed5e91c87093f2802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Mon, 27 Nov 2023 14:18:43 +0100 Subject: [PATCH] vertical chapters are full width and max 3 lines --- Shared/Player/Video Details/ChapterView.swift | 4 ++-- .../Player/Video Details/ChaptersView.swift | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Shared/Player/Video Details/ChapterView.swift b/Shared/Player/Video Details/ChapterView.swift index 9ee184e4..ab5bcbd7 100644 --- a/Shared/Player/Video Details/ChapterView.swift +++ b/Shared/Player/Video Details/ChapterView.swift @@ -49,14 +49,14 @@ struct ChapterView: View { } VStack(alignment: .leading, spacing: 4) { Text(chapter.title) - .lineLimit(2) + .lineLimit(3) .multilineTextAlignment(.leading) .font(.headline) Text(chapter.start.formattedAsPlaybackTime(allowZero: true) ?? "") .font(.system(.subheadline).monospacedDigit()) .foregroundColor(.secondary) } - .frame(maxWidth: Self.thumbnailWidth, alignment: .leading) + .frame(maxWidth: !chapter.image.isNil ? Self.thumbnailWidth : nil, alignment: .leading) } } #endif diff --git a/Shared/Player/Video Details/ChaptersView.swift b/Shared/Player/Video Details/ChaptersView.swift index cabaabe0..5f2bb17f 100644 --- a/Shared/Player/Video Details/ChaptersView.swift +++ b/Shared/Player/Video Details/ChaptersView.swift @@ -16,7 +16,7 @@ struct ChaptersView: View { var body: some View { if !chapters.isEmpty { - if expand || chaptersHaveImages { + if chaptersHaveImages { #if os(tvOS) List { Section { @@ -28,19 +28,22 @@ struct ChaptersView: View { } .listStyle(.plain) #else - if chaptersHaveImages { - ScrollView(.horizontal) { - LazyHStack(spacing: 20) { - ForEach(chapters) { chapter in - ChapterView(chapter: chapter) - } + ScrollView(.horizontal) { + LazyHStack(spacing: 20) { + ForEach(chapters) { chapter in + ChapterView(chapter: chapter) } - .padding(.horizontal, 15) } - } else { - contents + .padding(.horizontal, 15) } #endif + } else if expand { + Section { + ForEach(chapters) { chapter in + ChapterView(chapter: chapter) + } + } + .padding(.horizontal) } else { #if os(iOS) Button(action: {