1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30
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 {
@ObservedObject private var player = PlayerModel.shared
var body: some View {
2022-06-25 05:09:29 +05:30
if let chapters = player.currentVideo?.chapters, !chapters.isEmpty {
List {
Section(header: Text("Chapters")) {
ForEach(chapters) { chapter in
2022-08-21 02:35:40 +05:30
ChapterView(chapter: chapter)
}
2022-11-14 02:22:29 +05:30
Color.clear.frame(height: 50)
.listRowBackground(Color.clear)
2022-11-19 02:57:13 +05:30
.backport
.listRowSeparator(false)
}
2022-08-09 22:58:16 +05:30
.listRowBackground(Color.clear)
}
2022-06-25 05:09:29 +05:30
#if os(macOS)
.listStyle(.inset)
2022-06-25 05:09:29 +05:30
#elseif os(iOS)
.listStyle(.grouped)
2022-08-09 22:58:16 +05:30
.backport
.scrollContentBackground(false)
2022-06-25 05:09:29 +05:30
#else
.listStyle(.plain)
2022-06-25 05:09:29 +05:30
#endif
} else {
2022-09-28 21:15:05 +05:30
NoCommentsView(text: "No chapters information available".localized(), systemImage: "xmark.circle.fill")
2022-06-25 05:09:29 +05:30
}
}
}
2022-08-21 02:35:40 +05:30
struct ChaptersView_Previews: PreviewProvider {
static var previews: some View {
ChaptersView()
.injectFixtureEnvironmentObjects()
}
}