yattee/Shared/Player/RelatedView.swift

43 lines
1.2 KiB
Swift
Raw Normal View History

import Defaults
2021-11-02 23:02:02 +00:00
import SwiftUI
struct RelatedView: View {
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<NavigationModel> private var navigation
2021-11-02 23:02:02 +00:00
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<PlaylistsModel> private var playlists
2021-11-02 23:02:02 +00:00
var body: some View {
List {
if let related = player.currentVideo?.related {
2021-11-02 23:02:02 +00:00
Section(header: Text("Related")) {
ForEach(related) { video in
PlayerQueueRow(item: PlayerQueueItem(video))
2022-07-10 17:51:46 +00:00
.listRowBackground(Color.clear)
.contextMenu {
2022-08-14 17:01:22 +00:00
VideoContextMenuView(video: video)
}
2021-11-02 23:02:02 +00:00
}
2022-11-13 20:52:29 +00:00
Color.clear.padding(.bottom, 50)
.listRowBackground(Color.clear)
2021-11-02 23:02:02 +00:00
}
}
}
#if os(macOS)
2021-11-08 16:29:35 +00:00
.listStyle(.inset)
2021-11-02 23:02:02 +00:00
#elseif os(iOS)
2021-11-08 16:29:35 +00:00
.listStyle(.grouped)
2022-07-10 17:51:46 +00:00
.backport
.scrollContentBackground(false)
2021-11-02 23:02:02 +00:00
#else
2021-11-08 16:29:35 +00:00
.listStyle(.plain)
2021-11-02 23:02:02 +00:00
#endif
}
}
struct RelatedView_Previews: PreviewProvider {
static var previews: some View {
RelatedView()
}
}