2020-02-12 16:35:35 -09:00
|
|
|
import {
|
|
|
|
|
Button,
|
|
|
|
|
sanitizeListRestProps,
|
|
|
|
|
TopToolbar,
|
|
|
|
|
useTranslate,
|
|
|
|
|
} from 'react-admin'
|
|
|
|
|
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
|
|
|
|
import ShuffleIcon from '@material-ui/icons/Shuffle'
|
|
|
|
|
import React from 'react'
|
|
|
|
|
import { useDispatch } from 'react-redux'
|
2020-04-26 15:15:52 -08:00
|
|
|
import { playAlbum, shuffleAlbum } from '../audioplayer'
|
2020-02-12 16:35:35 -09:00
|
|
|
|
2020-05-15 09:48:33 -08:00
|
|
|
const AlbumActions = ({
|
2020-02-12 16:35:35 -09:00
|
|
|
className,
|
|
|
|
|
ids,
|
|
|
|
|
data,
|
|
|
|
|
exporter,
|
|
|
|
|
permanentFilter,
|
|
|
|
|
...rest
|
|
|
|
|
}) => {
|
|
|
|
|
const dispatch = useDispatch()
|
2020-02-14 05:14:50 -09:00
|
|
|
const translate = useTranslate()
|
2020-02-12 16:35:35 -09:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => {
|
2020-05-07 07:24:28 -08:00
|
|
|
dispatch(playAlbum(data, ids))
|
2020-02-12 16:35:35 -09:00
|
|
|
}}
|
2020-02-14 05:14:50 -09:00
|
|
|
label={translate('resources.album.actions.playAll')}
|
2020-02-12 16:35:35 -09:00
|
|
|
>
|
|
|
|
|
<PlayArrowIcon />
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => {
|
2020-05-07 07:24:28 -08:00
|
|
|
dispatch(shuffleAlbum(data, ids))
|
2020-02-12 16:35:35 -09:00
|
|
|
}}
|
2020-02-14 05:14:50 -09:00
|
|
|
label={translate('resources.album.actions.shuffle')}
|
2020-02-12 16:35:35 -09:00
|
|
|
>
|
|
|
|
|
<ShuffleIcon />
|
|
|
|
|
</Button>
|
|
|
|
|
</TopToolbar>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AlbumActions.defaultProps = {
|
|
|
|
|
selectedIds: [],
|
|
|
|
|
onUnselectItems: () => null,
|
|
|
|
|
}
|
2020-05-15 09:48:33 -08:00
|
|
|
|
|
|
|
|
export default AlbumActions
|