mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-24 07:30:57 +03:00
Clean up code a bit
This commit is contained in:
parent
a25044bdf6
commit
34af6fc671
ui/src
@ -1,4 +1,5 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import {
|
||||
Button,
|
||||
@ -13,15 +14,7 @@ import AddToQueueIcon from '@material-ui/icons/AddToQueue'
|
||||
import { addTracks, playTracks, shuffleTracks } from '../audioplayer'
|
||||
import subsonic from '../subsonic'
|
||||
|
||||
const AlbumActions = ({
|
||||
albumId,
|
||||
className,
|
||||
ids,
|
||||
data,
|
||||
exporter,
|
||||
permanentFilter,
|
||||
...rest
|
||||
}) => {
|
||||
const AlbumActions = ({ className, ids, data, record, ...rest }) => {
|
||||
const dispatch = useDispatch()
|
||||
const translate = useTranslate()
|
||||
|
||||
@ -38,8 +31,8 @@ const AlbumActions = ({
|
||||
}, [dispatch, data, ids])
|
||||
|
||||
const handleDownload = React.useCallback(() => {
|
||||
subsonic.download(albumId)
|
||||
}, [albumId])
|
||||
subsonic.download(record.id)
|
||||
}, [record])
|
||||
|
||||
return (
|
||||
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
||||
@ -71,7 +64,13 @@ const AlbumActions = ({
|
||||
)
|
||||
}
|
||||
|
||||
AlbumActions.propTypes = {
|
||||
record: PropTypes.object.isRequired,
|
||||
selectedIds: PropTypes.arrayOf(PropTypes.number),
|
||||
}
|
||||
|
||||
AlbumActions.defaultProps = {
|
||||
record: {},
|
||||
selectedIds: [],
|
||||
onUnselectItems: () => null,
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ const AlbumShow = (props) => {
|
||||
{...props}
|
||||
albumId={props.id}
|
||||
title={<Title subTitle={record.name} />}
|
||||
actions={<AlbumActions albumId={props.id} />}
|
||||
actions={<AlbumActions record={record} />}
|
||||
filter={{ album_id: props.id }}
|
||||
resource={'albumSong'}
|
||||
exporter={false}
|
||||
|
@ -15,16 +15,9 @@ import { httpClient } from '../dataProvider'
|
||||
import { addTracks, playTracks, shuffleTracks } from '../audioplayer'
|
||||
import { M3U_MIME_TYPE, REST_URL } from '../consts'
|
||||
import subsonic from '../subsonic'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
const PlaylistActions = ({
|
||||
className,
|
||||
ids,
|
||||
data,
|
||||
exporter,
|
||||
permanentFilter,
|
||||
record,
|
||||
...rest
|
||||
}) => {
|
||||
const PlaylistActions = ({ className, ids, data, record, ...rest }) => {
|
||||
const dispatch = useDispatch()
|
||||
const translate = useTranslate()
|
||||
|
||||
@ -98,7 +91,13 @@ const PlaylistActions = ({
|
||||
)
|
||||
}
|
||||
|
||||
PlaylistActions.propTypes = {
|
||||
record: PropTypes.object.isRequired,
|
||||
selectedIds: PropTypes.arrayOf(PropTypes.number),
|
||||
}
|
||||
|
||||
PlaylistActions.defaultProps = {
|
||||
record: {},
|
||||
selectedIds: [],
|
||||
onUnselectItems: () => null,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user