Add Playlist action

This commit is contained in:
Deluan
2020-05-15 18:53:33 -04:00
committed by Deluan Quintão
parent f881e2a54b
commit fd49ae319f
7 changed files with 73 additions and 27 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ import PlayArrowIcon from '@material-ui/icons/PlayArrow'
import ShuffleIcon from '@material-ui/icons/Shuffle'
import React from 'react'
import { useDispatch } from 'react-redux'
import { playAlbum, shuffleAlbum } from '../audioplayer'
import { playTracks, shuffleTracks } from '../audioplayer'
const AlbumActions = ({
className,
@@ -25,7 +25,7 @@ const AlbumActions = ({
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
<Button
onClick={() => {
dispatch(playAlbum(data, ids))
dispatch(playTracks(data, ids))
}}
label={translate('resources.album.actions.playAll')}
>
@@ -33,7 +33,7 @@ const AlbumActions = ({
</Button>
<Button
onClick={() => {
dispatch(shuffleAlbum(data, ids))
dispatch(shuffleTracks(data, ids))
}}
label={translate('resources.album.actions.shuffle')}
>
+3 -3
View File
@@ -6,7 +6,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
import { makeStyles } from '@material-ui/core/styles'
import { useDataProvider, useNotify, useTranslate } from 'react-admin'
import { useDispatch } from 'react-redux'
import { addTracks, playAlbum, shuffleAlbum } from '../audioplayer'
import { addTracks, playTracks, shuffleTracks } from '../audioplayer'
const useStyles = makeStyles({
icon: {
@@ -25,7 +25,7 @@ const AlbumContextMenu = ({ record, color }) => {
const options = {
play: {
label: translate('resources.album.actions.playAll'),
action: (data) => playAlbum(data),
action: (data) => playTracks(data),
},
addToQueue: {
label: translate('resources.album.actions.addToQueue'),
@@ -33,7 +33,7 @@ const AlbumContextMenu = ({ record, color }) => {
},
shuffle: {
label: translate('resources.album.actions.shuffle'),
action: (data) => shuffleAlbum(data),
action: (data) => shuffleTracks(data),
},
}
+2 -2
View File
@@ -13,7 +13,7 @@ import classnames from 'classnames'
import { useDispatch } from 'react-redux'
import { Card, useMediaQuery } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import { playAlbum } from '../audioplayer'
import { playTracks } from '../audioplayer'
import { DurationField, SongDetails, SongDatagridRow } from '../common'
const useStyles = makeStyles(
@@ -124,7 +124,7 @@ const AlbumSongs = (props) => {
) : (
<SongsDatagrid
expand={!isXsmall && <SongDetails />}
rowClick={(id) => dispatch(playAlbum(data, ids, id))}
rowClick={(id) => dispatch(playTracks(data, ids, id))}
{...controllerProps}
hasBulkActions={hasBulkActions}
>