Remove duplicated code for SongBulkActions
This commit is contained in:
@@ -3,7 +3,7 @@ import { useGetOne } from 'react-admin'
|
||||
import AlbumDetails from './AlbumDetails'
|
||||
import { Title } from '../common'
|
||||
import { useStyles } from './styles'
|
||||
import { AlbumSongBulkActions } from './AlbumSongBulkActions'
|
||||
import { SongBulkActions } from '../common'
|
||||
import AlbumActions from './AlbumActions'
|
||||
import AlbumSongs from './AlbumSongs'
|
||||
|
||||
@@ -33,7 +33,7 @@ const AlbumShow = (props) => {
|
||||
perPage={0}
|
||||
pagination={null}
|
||||
sort={{ field: 'discNumber asc, trackNumber asc', order: 'ASC' }}
|
||||
bulkActionButtons={<AlbumSongBulkActions />}
|
||||
bulkActionButtons={<SongBulkActions />}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import React, { Fragment, useEffect } from 'react'
|
||||
import { useUnselectAll } from 'react-admin'
|
||||
import { playNext, playTracks } from '../audioplayer'
|
||||
import { RiPlayList2Fill } from 'react-icons/ri'
|
||||
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
||||
import { BatchPlayButton } from '../common'
|
||||
import AddToPlaylistButton from '../song/AddToPlaylistButton'
|
||||
|
||||
export const AlbumSongBulkActions = (props) => {
|
||||
const unselectAll = useUnselectAll()
|
||||
useEffect(() => {
|
||||
unselectAll('albumSong')
|
||||
// eslint-disable-next-line
|
||||
}, [])
|
||||
return (
|
||||
<Fragment>
|
||||
<BatchPlayButton
|
||||
{...props}
|
||||
action={playTracks}
|
||||
label={'resources.song.actions.playNow'}
|
||||
icon={<PlayArrowIcon />}
|
||||
/>
|
||||
<BatchPlayButton
|
||||
{...props}
|
||||
action={playNext}
|
||||
label={'resources.song.actions.playNext'}
|
||||
icon={<RiPlayList2Fill />}
|
||||
/>
|
||||
<BatchPlayButton {...props} />
|
||||
<AddToPlaylistButton {...props} />
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user