Add "PlayNow" button to bulk actions
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
import React, { Fragment, useEffect } from 'react'
|
import React, { Fragment, useEffect } from 'react'
|
||||||
import { useUnselectAll } from 'react-admin'
|
import { useUnselectAll } from 'react-admin'
|
||||||
import { playNext } from '../audioplayer'
|
import { playNext, playTracks } from '../audioplayer'
|
||||||
import { RiPlayList2Fill } from 'react-icons/ri'
|
import { RiPlayList2Fill } from 'react-icons/ri'
|
||||||
import AddToQueueButton from '../song/AddToQueueButton'
|
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
|
||||||
|
import { BatchPlayButton } from '../common'
|
||||||
import AddToPlaylistButton from '../song/AddToPlaylistButton'
|
import AddToPlaylistButton from '../song/AddToPlaylistButton'
|
||||||
|
|
||||||
export const AlbumSongBulkActions = (props) => {
|
export const AlbumSongBulkActions = (props) => {
|
||||||
@@ -13,13 +14,19 @@ export const AlbumSongBulkActions = (props) => {
|
|||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<AddToQueueButton
|
<BatchPlayButton
|
||||||
|
{...props}
|
||||||
|
action={playTracks}
|
||||||
|
label={'resources.song.actions.playNow'}
|
||||||
|
icon={<PlayArrowIcon />}
|
||||||
|
/>
|
||||||
|
<BatchPlayButton
|
||||||
{...props}
|
{...props}
|
||||||
action={playNext}
|
action={playNext}
|
||||||
label={'resources.song.actions.playNext'}
|
label={'resources.song.actions.playNext'}
|
||||||
icon={<RiPlayList2Fill />}
|
icon={<RiPlayList2Fill />}
|
||||||
/>
|
/>
|
||||||
<AddToQueueButton {...props} />
|
<BatchPlayButton {...props} />
|
||||||
<AddToPlaylistButton {...props} />
|
<AddToPlaylistButton {...props} />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useDispatch } from 'react-redux'
|
|||||||
import { addTracks } from '../audioplayer'
|
import { addTracks } from '../audioplayer'
|
||||||
import { RiPlayListAddFill } from 'react-icons/ri'
|
import { RiPlayListAddFill } from 'react-icons/ri'
|
||||||
|
|
||||||
const AddToQueueButton = ({ resource, selectedIds, action, label, icon }) => {
|
const BatchPlayButton = ({ resource, selectedIds, action, label, icon }) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const dataProvider = useDataProvider()
|
const dataProvider = useDataProvider()
|
||||||
@@ -42,10 +42,10 @@ const AddToQueueButton = ({ resource, selectedIds, action, label, icon }) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToQueueButton.defaultProps = {
|
BatchPlayButton.defaultProps = {
|
||||||
action: addTracks,
|
action: addTracks,
|
||||||
label: 'resources.song.actions.addToQueue',
|
label: 'resources.song.actions.addToQueue',
|
||||||
icon: <RiPlayListAddFill />,
|
icon: <RiPlayListAddFill />,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AddToQueueButton
|
export default BatchPlayButton
|
||||||
@@ -3,6 +3,7 @@ import DurationField from './DurationField'
|
|||||||
import BitrateField from './BitrateField'
|
import BitrateField from './BitrateField'
|
||||||
import Pagination from './Pagination'
|
import Pagination from './Pagination'
|
||||||
import PlayButton from './PlayButton'
|
import PlayButton from './PlayButton'
|
||||||
|
import BatchPlayButton from './BatchPlayButton'
|
||||||
import SimpleList from './SimpleList'
|
import SimpleList from './SimpleList'
|
||||||
import RangeField, { formatRange } from './RangeField'
|
import RangeField, { formatRange } from './RangeField'
|
||||||
import ArtistLinkField, { useGetHandleArtistClick } from './ArtistLinkField'
|
import ArtistLinkField, { useGetHandleArtistClick } from './ArtistLinkField'
|
||||||
@@ -27,6 +28,7 @@ export {
|
|||||||
Pagination,
|
Pagination,
|
||||||
List,
|
List,
|
||||||
PlayButton,
|
PlayButton,
|
||||||
|
BatchPlayButton,
|
||||||
SimpleList,
|
SimpleList,
|
||||||
RangeField,
|
RangeField,
|
||||||
SongDetails,
|
SongDetails,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Button, useTranslate, useUnselectAll } from 'react-admin'
|
|||||||
import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd'
|
import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd'
|
||||||
import { openAddToPlaylist } from '../dialogs/dialogState'
|
import { openAddToPlaylist } from '../dialogs/dialogState'
|
||||||
|
|
||||||
const AddToPlaylistButton = ({ resource, selectedIds, onAddToPlaylist }) => {
|
const AddToPlaylistButton = ({ resource, selectedIds }) => {
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const unselectAll = useUnselectAll()
|
const unselectAll = useUnselectAll()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import AddToQueueButton from './AddToQueueButton'
|
import { BatchPlayButton } from '../common'
|
||||||
import AddToPlaylistButton from './AddToPlaylistButton'
|
import AddToPlaylistButton from './AddToPlaylistButton'
|
||||||
import { RiPlayList2Fill } from 'react-icons/ri'
|
import { RiPlayList2Fill } from 'react-icons/ri'
|
||||||
import { playNext } from '../audioplayer'
|
import { playNext } from '../audioplayer'
|
||||||
@@ -7,13 +7,13 @@ import { playNext } from '../audioplayer'
|
|||||||
export const SongBulkActions = (props) => {
|
export const SongBulkActions = (props) => {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<AddToQueueButton
|
<BatchPlayButton
|
||||||
{...props}
|
{...props}
|
||||||
action={playNext}
|
action={playNext}
|
||||||
label={'resources.song.actions.playNext'}
|
label={'resources.song.actions.playNext'}
|
||||||
icon={<RiPlayList2Fill />}
|
icon={<RiPlayList2Fill />}
|
||||||
/>
|
/>
|
||||||
<AddToQueueButton {...props} />
|
<BatchPlayButton {...props} />
|
||||||
<AddToPlaylistButton {...props} />
|
<AddToPlaylistButton {...props} />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user