2022-06-18 14:39:49 +02:00
|
|
|
import Defaults
|
2021-11-03 00:02:02 +01:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct RelatedView: View {
|
2022-11-24 21:36:05 +01:00
|
|
|
@ObservedObject private var player = PlayerModel.shared
|
2021-11-03 00:02:02 +01:00
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
List {
|
2022-06-18 14:39:49 +02:00
|
|
|
if let related = player.currentVideo?.related {
|
2021-11-03 00:02:02 +01:00
|
|
|
Section(header: Text("Related")) {
|
2022-06-18 14:39:49 +02:00
|
|
|
ForEach(related) { video in
|
|
|
|
PlayerQueueRow(item: PlayerQueueItem(video))
|
2022-07-10 19:51:46 +02:00
|
|
|
.listRowBackground(Color.clear)
|
2021-12-01 12:22:19 +01:00
|
|
|
.contextMenu {
|
2022-08-14 19:01:22 +02:00
|
|
|
VideoContextMenuView(video: video)
|
2021-12-01 12:22:19 +01:00
|
|
|
}
|
2021-11-03 00:02:02 +01:00
|
|
|
}
|
2022-11-18 22:27:13 +01:00
|
|
|
|
2022-11-13 21:52:29 +01:00
|
|
|
Color.clear.padding(.bottom, 50)
|
|
|
|
.listRowBackground(Color.clear)
|
2022-11-18 22:27:13 +01:00
|
|
|
.backport
|
|
|
|
.listRowSeparator(false)
|
2021-11-03 00:02:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if os(macOS)
|
2021-11-08 17:29:35 +01:00
|
|
|
.listStyle(.inset)
|
2021-11-03 00:02:02 +01:00
|
|
|
#elseif os(iOS)
|
2021-11-08 17:29:35 +01:00
|
|
|
.listStyle(.grouped)
|
2022-07-10 19:51:46 +02:00
|
|
|
.backport
|
|
|
|
.scrollContentBackground(false)
|
2021-11-03 00:02:02 +01:00
|
|
|
#else
|
2021-11-08 17:29:35 +01:00
|
|
|
.listStyle(.plain)
|
2021-11-03 00:02:02 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct RelatedView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
RelatedView()
|
2022-11-18 22:27:13 +01:00
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-11-03 00:02:02 +01:00
|
|
|
}
|
|
|
|
}
|