1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Player/ChaptersView.swift

39 lines
1.1 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-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-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()
}
}