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