Hide Love button on Artist Page when EnableFavourites=false. Fix #2245
This commit is contained in:
@@ -271,16 +271,14 @@ const AlbumDetails = (props) => {
|
|||||||
className={classes.recordName}
|
className={classes.recordName}
|
||||||
>
|
>
|
||||||
{record.name}
|
{record.name}
|
||||||
{config.enableFavourites && (
|
<LoveButton
|
||||||
<LoveButton
|
className={classes.loveButton}
|
||||||
className={classes.loveButton}
|
record={record}
|
||||||
record={record}
|
resource={'album'}
|
||||||
resource={'album'}
|
size={isDesktop ? 'default' : 'small'}
|
||||||
size={isDesktop ? 'default' : 'small'}
|
aria-label="love"
|
||||||
aria-label="love"
|
color="primary"
|
||||||
color="primary"
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography component={'h6'} className={classes.recordArtist}>
|
<Typography component={'h6'} className={classes.recordArtist}>
|
||||||
<ArtistLinkField record={record} />
|
<ArtistLinkField record={record} />
|
||||||
|
|||||||
@@ -3,15 +3,8 @@ import { useGetOne } from 'react-admin'
|
|||||||
import { GlobalHotKeys } from 'react-hotkeys'
|
import { GlobalHotKeys } from 'react-hotkeys'
|
||||||
import { LoveButton, useToggleLove } from '../common'
|
import { LoveButton, useToggleLove } from '../common'
|
||||||
import { keyMap } from '../hotkeys'
|
import { keyMap } from '../hotkeys'
|
||||||
import config from '../config'
|
|
||||||
|
|
||||||
const Placeholder = () => (
|
const Placeholder = () => <LoveButton disabled={true} resource={'song'} />
|
||||||
<>
|
|
||||||
{config.enableFavourites && (
|
|
||||||
<LoveButton disabled={true} resource={'song'} />
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
|
|
||||||
const Toolbar = ({ id }) => {
|
const Toolbar = ({ id }) => {
|
||||||
const { data, loading } = useGetOne('song', id)
|
const { data, loading } = useGetOne('song', id)
|
||||||
@@ -24,13 +17,11 @@ const Toolbar = ({ id }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<GlobalHotKeys keyMap={keyMap} handlers={handlers} allowChanges />
|
<GlobalHotKeys keyMap={keyMap} handlers={handlers} allowChanges />
|
||||||
{config.enableFavourites && (
|
<LoveButton
|
||||||
<LoveButton
|
record={data}
|
||||||
record={data}
|
resource={'song'}
|
||||||
resource={'song'}
|
disabled={loading || toggling}
|
||||||
disabled={loading || toggling}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import IconButton from '@material-ui/core/IconButton'
|
|||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import { useToggleLove } from './useToggleLove'
|
import { useToggleLove } from './useToggleLove'
|
||||||
import { useRecordContext } from 'react-admin'
|
import { useRecordContext } from 'react-admin'
|
||||||
|
import config from '../config'
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
love: {
|
love: {
|
||||||
@@ -38,6 +39,9 @@ export const LoveButton = ({
|
|||||||
[toggleLove]
|
[toggleLove]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (!config.enableFavourites) {
|
||||||
|
return <></>
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleToggleLove}
|
onClick={handleToggleLove}
|
||||||
|
|||||||
Reference in New Issue
Block a user