1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Shared/Player/Video Details/ChaptersView.swift

39 lines
1.0 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 {
2022-12-19 03:04:22 +05:30
Section {
ForEach(chapters) { chapter in
2022-08-21 02:35:40 +05:30
ChapterView(chapter: chapter)
}
}
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()
}
}