Skip to content

🎧 Your Personal Streaming Service

Hide Love button on Artist Page when EnableFavourites=false. Fix #2245

Deluanec0eb2866be8
diff --git a/ui/src/album/AlbumDetails.js b/ui/src/album/AlbumDetails.js
index e52749f48..043f29664 100644
--- a/ui/src/album/AlbumDetails.js
+++ b/ui/src/album/AlbumDetails.js
@@ -271,16 +271,14 @@ const AlbumDetails = (props) => {
className={classes.recordName}
>
{record.name}
- {config.enableFavourites && (
- <LoveButton
- className={classes.loveButton}
- record={record}
- resource={'album'}
- size={isDesktop ? 'default' : 'small'}
- aria-label="love"
- color="primary"
- />
- )}
+ <LoveButton
+ className={classes.loveButton}
+ record={record}
+ resource={'album'}
+ size={isDesktop ? 'default' : 'small'}
+ aria-label="love"
+ color="primary"
+ />
</Typography>
<Typography component={'h6'} className={classes.recordArtist}>
<ArtistLinkField record={record} />
diff --git a/ui/src/audioplayer/PlayerToolbar.js b/ui/src/audioplayer/PlayerToolbar.js
index d7394a6bc..d3645f5b0 100644
--- a/ui/src/audioplayer/PlayerToolbar.js
+++ b/ui/src/audioplayer/PlayerToolbar.js
@@ -3,15 +3,8 @@ import { useGetOne } from 'react-admin'
import { GlobalHotKeys } from 'react-hotkeys'
import { LoveButton, useToggleLove } from '../common'
import { keyMap } from '../hotkeys'
-import config from '../config'
-const Placeholder = () => (
- <>
- {config.enableFavourites && (
- <LoveButton disabled={true} resource={'song'} />
- )}
- </>
-)
+const Placeholder = () => <LoveButton disabled={true} resource={'song'} />
const Toolbar = ({ id }) => {
const { data, loading } = useGetOne('song', id)
@@ -24,13 +17,11 @@ const Toolbar = ({ id }) => {
return (
<>
<GlobalHotKeys keyMap={keyMap} handlers={handlers} allowChanges />
- {config.enableFavourites && (
- <LoveButton
- record={data}
- resource={'song'}
- disabled={loading || toggling}
- />
- )}
+ <LoveButton
+ record={data}
+ resource={'song'}
+ disabled={loading || toggling}
+ />
</>
)
}
diff --git a/ui/src/common/LoveButton.js b/ui/src/common/LoveButton.js
index 7a1fa0207..eea91e826 100644
--- a/ui/src/common/LoveButton.js
+++ b/ui/src/common/LoveButton.js
@@ -6,6 +6,7 @@ import IconButton from '@material-ui/core/IconButton'
import { makeStyles } from '@material-ui/core/styles'
import { useToggleLove } from './useToggleLove'
import { useRecordContext } from 'react-admin'
+import config from '../config'
const useStyles = makeStyles({
love: {
@@ -38,6 +39,9 @@ export const LoveButton = ({
[toggleLove]
)
+ if (!config.enableFavourites) {
+ return <></>
+ }
return (
<Button
onClick={handleToggleLove}