Add 'download' option to album context menu

This commit is contained in:
Deluan
2020-08-05 14:57:59 -04:00
parent 8e4b2e1c06
commit 38c19eddc3
6 changed files with 35 additions and 12 deletions
+12
View File
@@ -6,11 +6,14 @@ import {
} from 'react-admin'
import PlayArrowIcon from '@material-ui/icons/PlayArrow'
import ShuffleIcon from '@material-ui/icons/Shuffle'
import CloudDownloadIcon from '@material-ui/icons/CloudDownload'
import React from 'react'
import { useDispatch } from 'react-redux'
import { playTracks, shuffleTracks } from '../audioplayer'
import subsonic from '../subsonic'
const AlbumActions = ({
albumId,
className,
ids,
data,
@@ -21,6 +24,7 @@ const AlbumActions = ({
const dispatch = useDispatch()
const translate = useTranslate()
console.log(rest)
return (
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
<Button
@@ -39,6 +43,14 @@ const AlbumActions = ({
>
<ShuffleIcon />
</Button>
<Button
onClick={() => {
subsonic.download(albumId)
}}
label={translate('resources.album.actions.download')}
>
<CloudDownloadIcon />
</Button>
</TopToolbar>
)
}
+1 -1
View File
@@ -26,7 +26,7 @@ const AlbumShow = (props) => {
{...props}
albumId={props.id}
title={<Title subTitle={record.name} />}
actions={<AlbumActions />}
actions={<AlbumActions albumId={props.id} />}
filter={{ album_id: props.id }}
resource={'albumSong'}
exporter={false}