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)
}
.frame(minHeight: ChapterView.thumbnailHeight + 100)
} else {
contents
}

View File

@ -441,34 +441,48 @@ struct VideoDetails: View {
#endif
}
var chaptersHaveImages: Bool {
player.videoForDisplay?.chapters.allSatisfy { $0.image != nil } ?? false
}
var chaptersHeader: some View {
#if canImport(UIKit)
Button(action: {
chaptersExpanded.toggle()
}) {
HStack {
Text("Chapters".localized())
Spacer()
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down")
.imageScale(.small)
}
.padding(.horizontal)
.font(.caption)
.foregroundColor(.secondary)
}
#elseif canImport(AppKit)
HStack {
Group {
if !chaptersHaveImages {
#if canImport(UIKit)
Button(action: {
chaptersExpanded.toggle()
}) {
HStack {
Text("Chapters".localized())
Spacer()
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down")
.imageScale(.small)
}
.padding(.horizontal)
.font(.caption)
.foregroundColor(.secondary)
}
#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())
Spacer()
Button(action: { chaptersExpanded.toggle() }) {
Image(systemName: chaptersExpanded ? "chevron.up" : "chevron.down")
.imageScale(.small)
}
.font(.caption)
.foregroundColor(.secondary)
.padding(.horizontal)
}
.padding(.horizontal)
.font(.caption)
.foregroundColor(.secondary)
#endif
}
}
}