Add 'download' option to album context menu
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user