yattee/Shared/Player/Video Details/ChaptersView.swift

43 lines
1.3 KiB
Swift
Raw Normal View History

import Foundation
import SDWebImageSwiftUI
import SwiftUI
struct ChaptersView: View {
@EnvironmentObject<PlayerModel> private var player
var body: some View {
2022-06-24 23:39:29 +00:00
if let chapters = player.currentVideo?.chapters, !chapters.isEmpty {
List {
Section(header: Text("Chapters")) {
ForEach(chapters) { chapter in
2022-08-20 21:05:40 +00:00
ChapterView(chapter: chapter)
}
2022-11-13 20:52:29 +00:00
Color.clear.frame(height: 50)
.listRowBackground(Color.clear)
2022-11-18 21:27:13 +00:00
.backport
.listRowSeparator(false)
}
2022-08-09 17:28:16 +00:00
.listRowBackground(Color.clear)
}
2022-06-24 23:39:29 +00:00
#if os(macOS)
.listStyle(.inset)
2022-06-24 23:39:29 +00:00
#elseif os(iOS)
.listStyle(.grouped)
2022-08-09 17:28:16 +00:00
.backport
.scrollContentBackground(false)
2022-06-24 23:39:29 +00:00
#else
.listStyle(.plain)
2022-06-24 23:39:29 +00:00
#endif
} else {
2022-09-28 15:45:05 +00:00
NoCommentsView(text: "No chapters information available".localized(), systemImage: "xmark.circle.fill")
2022-06-24 23:39:29 +00:00
}
}
}
2022-08-20 21:05:40 +00:00
struct ChaptersView_Previews: PreviewProvider {
static var previews: some View {
ChaptersView()
.injectFixtureEnvironmentObjects()
}
}