2022-06-18 18:09:49 +05:30
|
|
|
import Defaults
|
2021-11-03 04:32:02 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct RelatedView: View {
|
2022-11-25 02:06:05 +05:30
|
|
|
@ObservedObject private var player = PlayerModel.shared
|
2021-11-03 04:32:02 +05:30
|
|
|
|
|
|
|
var body: some View {
|
2023-04-22 14:26:42 +05:30
|
|
|
LazyVStack {
|
|
|
|
if let related = player.videoForDisplay?.related {
|
|
|
|
Section(header: header) {
|
2022-06-18 18:09:49 +05:30
|
|
|
ForEach(related) { video in
|
|
|
|
PlayerQueueRow(item: PlayerQueueItem(video))
|
2022-07-10 23:21:46 +05:30
|
|
|
.listRowBackground(Color.clear)
|
2021-12-01 16:52:19 +05:30
|
|
|
.contextMenu {
|
2022-08-14 22:31:22 +05:30
|
|
|
VideoContextMenuView(video: video)
|
2021-12-01 16:52:19 +05:30
|
|
|
}
|
2021-11-03 04:32:02 +05:30
|
|
|
}
|
2022-11-19 02:57:13 +05:30
|
|
|
|
2022-11-14 02:22:29 +05:30
|
|
|
Color.clear.padding(.bottom, 50)
|
|
|
|
.listRowBackground(Color.clear)
|
2022-11-19 02:57:13 +05:30
|
|
|
.backport
|
|
|
|
.listRowSeparator(false)
|
2021-11-03 04:32:02 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-13 06:20:26 +05:30
|
|
|
.environment(\.inNavigationView, false)
|
2021-11-03 04:32:02 +05:30
|
|
|
#if os(macOS)
|
2022-12-13 06:20:26 +05:30
|
|
|
.listStyle(.inset)
|
2021-11-03 04:32:02 +05:30
|
|
|
#elseif os(iOS)
|
2022-12-13 06:20:26 +05:30
|
|
|
.listStyle(.grouped)
|
|
|
|
.backport
|
|
|
|
.scrollContentBackground(false)
|
2021-11-03 04:32:02 +05:30
|
|
|
#else
|
2022-12-13 06:20:26 +05:30
|
|
|
.listStyle(.plain)
|
2021-11-03 04:32:02 +05:30
|
|
|
#endif
|
|
|
|
}
|
2023-04-22 14:26:42 +05:30
|
|
|
|
|
|
|
var header: some View {
|
|
|
|
Text("Related")
|
|
|
|
#if !os(macOS)
|
|
|
|
.font(.caption)
|
|
|
|
.foregroundColor(.secondary)
|
|
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
#endif
|
|
|
|
}
|
2021-11-03 04:32:02 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
struct RelatedView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
RelatedView()
|
2022-11-19 02:57:13 +05:30
|
|
|
.injectFixtureEnvironmentObjects()
|
2021-11-03 04:32:02 +05:30
|
|
|
}
|
|
|
|
}
|