mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Use menu for add to playlists
This commit is contained in:
@@ -72,7 +72,11 @@ struct VideoContextMenuView: View {
|
||||
|
||||
if accounts.app.supportsUserPlaylists, accounts.signedIn, !video.isLocal {
|
||||
Section {
|
||||
addToPlaylistButton
|
||||
#if os(tvOS)
|
||||
addToPlaylistButton
|
||||
#else
|
||||
addToPlaylistMenu
|
||||
#endif
|
||||
addToLastPlaylistButton
|
||||
|
||||
if let id = navigation.tabSelection?.playlistID ?? playlistID {
|
||||
@@ -309,6 +313,26 @@ struct VideoContextMenuView: View {
|
||||
}
|
||||
}
|
||||
|
||||
#if !os(tvOS)
|
||||
@ViewBuilder private var addToPlaylistMenu: some View {
|
||||
if playlists.playlists.isEmpty {
|
||||
Text("No Playlists")
|
||||
} else {
|
||||
Menu {
|
||||
ForEach(playlists.editable) { playlist in
|
||||
Button {
|
||||
playlists.addVideo(playlistID: playlist.id, videoID: video.videoID)
|
||||
} label: {
|
||||
Text(playlist.title).tag(playlist.id)
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Label("Add to Playlist...", systemImage: "text.badge.plus")
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func removeFromPlaylistButton(playlistID: String) -> some View {
|
||||
Button {
|
||||
playlists.removeVideo(index: video.indexID!, playlistID: playlistID)
|
||||
|
Reference in New Issue
Block a user