mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Refactor context menu
This commit is contained in:
@@ -8,6 +8,7 @@ struct VideoContextMenuView: View {
|
||||
|
||||
@Environment(\.inChannelView) private var inChannelView
|
||||
@Environment(\.inChannelPlaylistView) private var inChannelPlaylistView
|
||||
@Environment(\.inQueueListing) private var inQueueListing
|
||||
@Environment(\.navigationStyle) private var navigationStyle
|
||||
@Environment(\.currentPlaylistID) private var playlistID
|
||||
|
||||
@@ -36,6 +37,12 @@ struct VideoContextMenuView: View {
|
||||
}
|
||||
|
||||
@ViewBuilder var contextMenu: some View {
|
||||
if inQueueListing {
|
||||
if let item = player.queue.first(where: { $0.videoID == video.videoID }) {
|
||||
removeFromQueueButton(item)
|
||||
}
|
||||
removeAllFromQueueButton()
|
||||
}
|
||||
if !video.localStreamIsDirectory {
|
||||
if saveHistory {
|
||||
Section {
|
||||
@@ -340,4 +347,20 @@ struct VideoContextMenuView: View {
|
||||
Label("Remove from Playlist", systemImage: "text.badge.minus")
|
||||
}
|
||||
}
|
||||
|
||||
private func removeFromQueueButton(_ item: PlayerQueueItem) -> some View {
|
||||
Button {
|
||||
player.remove(item)
|
||||
} label: {
|
||||
Label("Remove from the queue", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
|
||||
private func removeAllFromQueueButton() -> some View {
|
||||
Button {
|
||||
player.removeQueueItems()
|
||||
} label: {
|
||||
Label("Clear the queue", systemImage: "trash.fill")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user