Enable turn on/off Favorites/Loved feature. (#917)
* Added option to enable/disable favorites in Song * Added option to enable/disable favorites in Artist * Added option to enable/disable favorites in Albums and Favorites tab in sidebar * Added option to enable/disable favorites in Player * Set default value of enableFavourites as true * Improved the functionality to enable/disable Favorites * Add `EnableFavourites` config option Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
SizeField,
|
||||
LoveButton,
|
||||
} from '../common'
|
||||
import config from '../config'
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
@@ -160,14 +161,16 @@ const AlbumDetails = ({ record }) => {
|
||||
<CardContent className={classes.content}>
|
||||
<Typography variant="h5">
|
||||
{record.name}
|
||||
<LoveButton
|
||||
className={classes.loveButton}
|
||||
record={record}
|
||||
resource={'album'}
|
||||
size={isDesktop ? 'default' : 'small'}
|
||||
aria-label="love"
|
||||
color="primary"
|
||||
/>
|
||||
{config.enableFavourites && (
|
||||
<LoveButton
|
||||
className={classes.loveButton}
|
||||
record={record}
|
||||
resource={'album'}
|
||||
size={isDesktop ? 'default' : 'small'}
|
||||
aria-label="love"
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
</Typography>
|
||||
<Typography component="h6">
|
||||
<ArtistLinkField record={record} />
|
||||
|
||||
@@ -19,6 +19,7 @@ import AlbumListView from './AlbumListView'
|
||||
import AlbumGridView from './AlbumGridView'
|
||||
import { AddToPlaylistDialog } from '../dialogs'
|
||||
import albumLists, { defaultAlbumList } from './albumLists'
|
||||
import config from '../config'
|
||||
|
||||
const AlbumFilter = (props) => {
|
||||
const translate = useTranslate()
|
||||
@@ -36,11 +37,13 @@ const AlbumFilter = (props) => {
|
||||
</ReferenceInput>
|
||||
<NullableBooleanInput source="compilation" />
|
||||
<NumberInput source="year" />
|
||||
<QuickFilter
|
||||
source="starred"
|
||||
label={<FavoriteIcon fontSize={'small'} />}
|
||||
defaultValue={true}
|
||||
/>
|
||||
{config.enableFavourites && (
|
||||
<QuickFilter
|
||||
source="starred"
|
||||
label={<FavoriteIcon fontSize={'small'} />}
|
||||
defaultValue={true}
|
||||
/>
|
||||
)}
|
||||
</Filter>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
MultiLineTextField,
|
||||
AlbumContextMenu,
|
||||
} from '../common'
|
||||
import config from '../config'
|
||||
|
||||
const useStyles = makeStyles({
|
||||
columnIcon: {
|
||||
@@ -91,12 +92,15 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
|
||||
source={'starred'}
|
||||
sortBy={'starred ASC, starredAt ASC'}
|
||||
sortByOrder={'DESC'}
|
||||
sortable={config.enableFavourites}
|
||||
className={classes.contextMenu}
|
||||
label={
|
||||
<FavoriteBorderIcon
|
||||
fontSize={'small'}
|
||||
className={classes.columnIcon}
|
||||
/>
|
||||
config.enableFavourites && (
|
||||
<FavoriteBorderIcon
|
||||
fontSize={'small'}
|
||||
className={classes.columnIcon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Datagrid>
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
SongTitleField,
|
||||
} from '../common'
|
||||
import { AddToPlaylistDialog } from '../dialogs'
|
||||
import config from '../config'
|
||||
|
||||
const useStyles = makeStyles(
|
||||
(theme) => ({
|
||||
@@ -123,10 +124,12 @@ const AlbumSongs = (props) => {
|
||||
sortable={false}
|
||||
className={classes.contextMenu}
|
||||
label={
|
||||
<FavoriteBorderIcon
|
||||
fontSize={'small'}
|
||||
className={classes.columnIcon}
|
||||
/>
|
||||
config.enableFavourites && (
|
||||
<FavoriteBorderIcon
|
||||
fontSize={'small'}
|
||||
className={classes.columnIcon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</SongDatagrid>
|
||||
|
||||
@@ -4,6 +4,7 @@ import VideoLibraryIcon from '@material-ui/icons/VideoLibrary'
|
||||
import RepeatIcon from '@material-ui/icons/Repeat'
|
||||
import AlbumIcon from '@material-ui/icons/Album'
|
||||
import FavoriteIcon from '@material-ui/icons/Favorite'
|
||||
import config from '../config'
|
||||
|
||||
export default {
|
||||
all: {
|
||||
@@ -11,10 +12,12 @@ export default {
|
||||
params: 'sort=name&order=ASC',
|
||||
},
|
||||
random: { icon: ShuffleIcon, params: 'sort=random' },
|
||||
starred: {
|
||||
icon: FavoriteIcon,
|
||||
params: 'sort=starred_at&order=DESC&filter={"starred":true}',
|
||||
},
|
||||
...(config.enableFavourites && {
|
||||
starred: {
|
||||
icon: FavoriteIcon,
|
||||
params: 'sort=starred_at&order=DESC&filter={"starred":true}',
|
||||
},
|
||||
}),
|
||||
recentlyAdded: {
|
||||
icon: LibraryAddIcon,
|
||||
params: 'sort=recently_added&order=DESC',
|
||||
|
||||
Reference in New Issue
Block a user