2021-11-03 04:32:02 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct RelatedView: View {
|
|
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
List {
|
|
|
|
if !player.currentVideo.isNil, !player.currentVideo!.related.isEmpty {
|
|
|
|
Section(header: Text("Related")) {
|
|
|
|
ForEach(player.currentVideo!.related) { video in
|
|
|
|
PlayerQueueRow(item: PlayerQueueItem(video), fullScreen: .constant(false))
|
2021-12-01 16:52:19 +05:30
|
|
|
.contextMenu {
|
|
|
|
Button {
|
|
|
|
player.playNext(video)
|
|
|
|
} label: {
|
|
|
|
Label("Play Next", systemImage: "text.insert")
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
player.enqueueVideo(video)
|
|
|
|
} label: {
|
|
|
|
Label("Play Last", systemImage: "text.append")
|
|
|
|
}
|
|
|
|
}
|
2021-11-03 04:32:02 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if os(macOS)
|
2021-11-08 21:59:35 +05:30
|
|
|
.listStyle(.inset)
|
2021-11-03 04:32:02 +05:30
|
|
|
#elseif os(iOS)
|
2021-11-08 21:59:35 +05:30
|
|
|
.listStyle(.grouped)
|
2021-11-03 04:32:02 +05:30
|
|
|
#else
|
2021-11-08 21:59:35 +05:30
|
|
|
.listStyle(.plain)
|
2021-11-03 04:32:02 +05:30
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct RelatedView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
RelatedView()
|
|
|
|
}
|
|
|
|
}
|