remove toggle for vertical chapters

This commit is contained in:
Toni Förster 2023-11-27 13:34:18 +01:00
parent 8f08674527
commit 3feafc153c
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
2 changed files with 39 additions and 26 deletions

View File

@ -37,7 +37,6 @@ struct ChaptersView: View {
} }
.padding(.horizontal, 15) .padding(.horizontal, 15)
} }
.frame(minHeight: ChapterView.thumbnailHeight + 100)
} else { } else {
contents contents
} }

View File

@ -441,34 +441,48 @@ struct VideoDetails: View {
#endif #endif
} }
var chaptersHaveImages: Bool {
player.videoForDisplay?.chapters.allSatisfy { $0.image != nil } ?? false
}
var chaptersHeader: some View { var chaptersHeader: some View {
#if canImport(UIKit) Group {
Button(action: { if !chaptersHaveImages {
chaptersExpanded.toggle() #if canImport(UIKit)
}) { Button(action: {
HStack { chaptersExpanded.toggle()
Text("Chapters".localized()) }) {
Spacer() HStack {
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down") Text("Chapters".localized())
.imageScale(.small) Spacer()
} Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down")
.padding(.horizontal) .imageScale(.small)
.font(.caption) }
.foregroundColor(.secondary) .padding(.horizontal)
} .font(.caption)
#elseif canImport(AppKit) .foregroundColor(.secondary)
HStack { }
#elseif canImport(AppKit)
HStack {
Text("Chapters".localized())
Spacer()
Button(action: { chaptersExpanded.toggle() }) {
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down")
.imageScale(.small)
}
}
.padding(.horizontal)
.font(.caption)
.foregroundColor(.secondary)
#endif
} else {
// No button, just the title when there are images
Text("Chapters".localized()) Text("Chapters".localized())
Spacer() .font(.caption)
Button(action: { chaptersExpanded.toggle() }) { .foregroundColor(.secondary)
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down") .padding(.horizontal)
.imageScale(.small)
}
} }
.padding(.horizontal) }
.font(.caption)
.foregroundColor(.secondary)
#endif
} }
} }