mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 08:18:19 +00:00
47 lines
1.4 KiB
Swift
47 lines
1.4 KiB
Swift
import Defaults
|
|
import SwiftUI
|
|
|
|
struct RelatedView: View {
|
|
@EnvironmentObject<AccountsModel> private var accounts
|
|
@EnvironmentObject<NavigationModel> private var navigation
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
@EnvironmentObject<PlaylistsModel> private var playlists
|
|
|
|
var body: some View {
|
|
List {
|
|
if let related = player.currentVideo?.related {
|
|
Section(header: Text("Related")) {
|
|
ForEach(related) { video in
|
|
PlayerQueueRow(item: PlayerQueueItem(video))
|
|
.listRowBackground(Color.clear)
|
|
.contextMenu {
|
|
VideoContextMenuView(video: video)
|
|
}
|
|
}
|
|
|
|
Color.clear.padding(.bottom, 50)
|
|
.listRowBackground(Color.clear)
|
|
.backport
|
|
.listRowSeparator(false)
|
|
}
|
|
}
|
|
}
|
|
#if os(macOS)
|
|
.listStyle(.inset)
|
|
#elseif os(iOS)
|
|
.listStyle(.grouped)
|
|
.backport
|
|
.scrollContentBackground(false)
|
|
#else
|
|
.listStyle(.plain)
|
|
#endif
|
|
}
|
|
}
|
|
|
|
struct RelatedView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
RelatedView()
|
|
.injectFixtureEnvironmentObjects()
|
|
}
|
|
}
|