2020-02-14 05:02:32 -09:00
|
|
|
import React, { Fragment, useEffect } from 'react'
|
|
|
|
|
import { useUnselectAll } from 'react-admin'
|
2020-10-31 06:23:52 -08:00
|
|
|
import { addTracks, playNext, playTracks } from '../audioplayer'
|
|
|
|
|
import { RiPlayList2Fill, RiPlayListAddFill } from 'react-icons/ri'
|
2020-10-31 06:12:38 -08:00
|
|
|
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
2020-10-31 06:23:52 -08:00
|
|
|
import { BatchPlayButton } from './index'
|
|
|
|
|
import AddToPlaylistButton from './AddToPlaylistButton'
|
2020-02-14 05:02:32 -09:00
|
|
|
|
2020-10-31 06:23:52 -08:00
|
|
|
const SongBulkActions = (props) => {
|
2020-02-14 05:02:32 -09:00
|
|
|
const unselectAll = useUnselectAll()
|
|
|
|
|
useEffect(() => {
|
2020-10-31 06:23:52 -08:00
|
|
|
unselectAll(props.resource)
|
2020-02-14 05:02:32 -09:00
|
|
|
// eslint-disable-next-line
|
|
|
|
|
}, [])
|
|
|
|
|
return (
|
|
|
|
|
<Fragment>
|
2020-10-31 06:12:38 -08:00
|
|
|
<BatchPlayButton
|
|
|
|
|
{...props}
|
|
|
|
|
action={playTracks}
|
|
|
|
|
label={'resources.song.actions.playNow'}
|
|
|
|
|
icon={<PlayArrowIcon />}
|
|
|
|
|
/>
|
|
|
|
|
<BatchPlayButton
|
2020-09-21 16:10:52 -08:00
|
|
|
{...props}
|
|
|
|
|
action={playNext}
|
|
|
|
|
label={'resources.song.actions.playNext'}
|
2020-09-27 08:50:58 -08:00
|
|
|
icon={<RiPlayList2Fill />}
|
2020-09-21 16:10:52 -08:00
|
|
|
/>
|
2020-10-31 06:23:52 -08:00
|
|
|
<BatchPlayButton
|
|
|
|
|
{...props}
|
|
|
|
|
action={addTracks}
|
|
|
|
|
label={'resources.song.actions.addToQueue'}
|
|
|
|
|
icon={<RiPlayListAddFill />}
|
|
|
|
|
/>
|
2020-05-17 16:57:38 -08:00
|
|
|
<AddToPlaylistButton {...props} />
|
2020-02-14 05:02:32 -09:00
|
|
|
</Fragment>
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-10-31 06:23:52 -08:00
|
|
|
|
|
|
|
|
export default SongBulkActions
|