mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
Add "No playlists available" to context menu
This commit is contained in:
parent
5c46f7822f
commit
3ae1586e10
@ -1,5 +1,10 @@
|
||||
import React from 'react'
|
||||
import { useDataProvider, useGetList, useNotify } from 'react-admin'
|
||||
import {
|
||||
useDataProvider,
|
||||
useGetList,
|
||||
useNotify,
|
||||
useTranslate,
|
||||
} from 'react-admin'
|
||||
import { MenuItem } from '@material-ui/core'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
@ -24,6 +29,7 @@ export const addAlbumToPlaylist = (dataProvider, albumId, playlistId) =>
|
||||
const AddToPlaylistMenu = React.forwardRef(
|
||||
({ selectedIds, albumId, onClose, onItemAdded }, ref) => {
|
||||
const notify = useNotify()
|
||||
const translate = useTranslate()
|
||||
const dataProvider = useDataProvider()
|
||||
const { ids, data, loaded } = useGetList(
|
||||
'playlist',
|
||||
@ -36,6 +42,20 @@ const AddToPlaylistMenu = React.forwardRef(
|
||||
return <MenuItem>Loading...</MenuItem>
|
||||
}
|
||||
|
||||
// TODO: This is temporary, while we don't have the "New Playlist" option in the menu
|
||||
if (ids.length === 0) {
|
||||
return (
|
||||
<MenuItem
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onClose && onClose(e)
|
||||
}}
|
||||
>
|
||||
{translate('message.noPlaylistsAvailable')}
|
||||
</MenuItem>
|
||||
)
|
||||
}
|
||||
|
||||
const handleItemClick = (e) => {
|
||||
e.preventDefault()
|
||||
const playlistId = e.target.getAttribute('value')
|
||||
|
@ -238,7 +238,8 @@
|
||||
"note": "NOTE",
|
||||
"transcodingDisabled": "Changing the transcoding configuration through the web interface is disabled for security reasons. If you would like to change (edit or add) transcoding options, restart the server with the %{config} configuration option.",
|
||||
"transcodingEnabled": "Navidrome is currently running with %{config}, making it possible to run system commands from the transcoding settings using the web interface. We recommend to disable it for security reasons and only enable it when configuring Transcoding options.",
|
||||
"songsAddedToPlaylist": "Added 1 song to playlist |||| Added %{smart_count} songs to playlist"
|
||||
"songsAddedToPlaylist": "Added 1 song to playlist |||| Added %{smart_count} songs to playlist",
|
||||
"noPlaylistsAvailable": "None available"
|
||||
},
|
||||
"menu": {
|
||||
"library": "Library",
|
||||
|
Loading…
x
Reference in New Issue
Block a user