Improve open videos layouts

This commit is contained in:
Arkadiusz Fal
2022-11-11 18:50:13 +01:00
parent 6ca6a40aa1
commit 730ba1ea2e
9 changed files with 216 additions and 107 deletions

View File

@@ -10,24 +10,34 @@ struct HistoryView: View {
var body: some View {
LazyVStack {
ForEach(visibleWatches, id: \.videoID) { watch in
PlayerQueueRow(
item: PlayerQueueItem.from(watch, video: player.historyVideo(watch.videoID)),
history: true
)
.onAppear {
player.loadHistoryVideoDetails(watch.videoID)
if visibleWatches.isEmpty {
VStack(alignment: .center, spacing: 20) {
HStack {
Image(systemName: "clock")
Text("Playback history is empty")
}.foregroundColor(.secondary)
}
.contextMenu {
VideoContextMenuView(video: player.historyVideo(watch.videoID) ?? watch.video)
} else {
ForEach(visibleWatches, id: \.videoID) { watch in
PlayerQueueRow(
item: PlayerQueueItem.from(watch, video: player.historyVideo(watch.videoID)),
history: true
)
.onAppear {
player.loadHistoryVideoDetails(watch.videoID)
}
.contextMenu {
VideoContextMenuView(video: player.historyVideo(watch.videoID) ?? watch.video)
}
}
}
#if os(tvOS)
.padding(.horizontal, 40)
#else
.padding(.horizontal, 15)
#endif
}
#if os(tvOS)
.padding(.horizontal, 40)
#else
.padding(.horizontal, 15)
#endif
}
private var visibleWatches: [Watch] {