mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 05:53:41 +00:00
Fix chapters layout
This commit is contained in:
parent
383bb32215
commit
77fde219e0
@ -9,6 +9,10 @@ struct ChaptersView: View {
|
|||||||
player.videoForDisplay?.chapters ?? []
|
player.videoForDisplay?.chapters ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var chaptersHaveImages: Bool {
|
||||||
|
chapters.allSatisfy { $0.image != nil }
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if !chapters.isEmpty {
|
if !chapters.isEmpty {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
@ -22,15 +26,24 @@ struct ChaptersView: View {
|
|||||||
}
|
}
|
||||||
.listStyle(.plain)
|
.listStyle(.plain)
|
||||||
#else
|
#else
|
||||||
ScrollView(.horizontal) {
|
if chaptersHaveImages {
|
||||||
LazyHStack(spacing: 20) {
|
ScrollView(.horizontal) {
|
||||||
|
LazyHStack(spacing: 20) {
|
||||||
|
ForEach(chapters) { chapter in
|
||||||
|
ChapterView(chapter: chapter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 15)
|
||||||
|
}
|
||||||
|
.frame(minHeight: ChapterView.thumbnailHeight + 100)
|
||||||
|
} else {
|
||||||
|
Section {
|
||||||
ForEach(chapters) { chapter in
|
ForEach(chapters) { chapter in
|
||||||
ChapterView(chapter: chapter)
|
ChapterView(chapter: chapter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 15)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
.frame(minHeight: ChapterView.thumbnailHeight + 100)
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
NoCommentsView(text: "No chapters information available".localized(), systemImage: "xmark.circle.fill")
|
NoCommentsView(text: "No chapters information available".localized(), systemImage: "xmark.circle.fill")
|
||||||
|
Loading…
Reference in New Issue
Block a user