Enable sort by "starred" in Album and Artist lists
This commit is contained in:
@@ -100,6 +100,9 @@ const AlbumListView = ({ hasShow, hasEdit, hasList, ...rest }) => {
|
|||||||
<RangeField source={'year'} sortBy={'maxYear'} sortByOrder={'DESC'} />
|
<RangeField source={'year'} sortBy={'maxYear'} sortByOrder={'DESC'} />
|
||||||
{isDesktop && <DurationField source="duration" />}
|
{isDesktop && <DurationField source="duration" />}
|
||||||
<AlbumContextMenu
|
<AlbumContextMenu
|
||||||
|
source={'starred'}
|
||||||
|
sortBy={'starred ASC, starredAt ASC'}
|
||||||
|
sortByOrder={'DESC'}
|
||||||
label={
|
label={
|
||||||
<StarBorderIcon fontSize={'small'} className={classes.columnIcon} />
|
<StarBorderIcon fontSize={'small'} className={classes.columnIcon} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from 'react-admin'
|
} from 'react-admin'
|
||||||
import { useMediaQuery, withWidth } from '@material-ui/core'
|
import { useMediaQuery, withWidth } from '@material-ui/core'
|
||||||
import StarIcon from '@material-ui/icons/Star'
|
import StarIcon from '@material-ui/icons/Star'
|
||||||
|
import StarBorderIcon from '@material-ui/icons/StarBorder'
|
||||||
import AddToPlaylistDialog from '../dialogs/AddToPlaylistDialog'
|
import AddToPlaylistDialog from '../dialogs/AddToPlaylistDialog'
|
||||||
import {
|
import {
|
||||||
ArtistContextMenu,
|
ArtistContextMenu,
|
||||||
@@ -18,6 +19,15 @@ import {
|
|||||||
SimpleList,
|
SimpleList,
|
||||||
useGetHandleArtistClick,
|
useGetHandleArtistClick,
|
||||||
} from '../common'
|
} from '../common'
|
||||||
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
|
||||||
|
const useStyles = makeStyles({
|
||||||
|
columnIcon: {
|
||||||
|
marginLeft: '3px',
|
||||||
|
marginTop: '-2px',
|
||||||
|
verticalAlign: 'text-top',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const ArtistFilter = (props) => (
|
const ArtistFilter = (props) => (
|
||||||
<Filter {...props}>
|
<Filter {...props}>
|
||||||
@@ -62,6 +72,7 @@ const ArtistDatagrid = (props) => (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const ArtistList = ({ width, ...rest }) => {
|
const ArtistList = ({ width, ...rest }) => {
|
||||||
|
const classes = useStyles()
|
||||||
const handleArtistLink = useGetHandleArtistClick(width)
|
const handleArtistLink = useGetHandleArtistClick(width)
|
||||||
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
||||||
return (
|
return (
|
||||||
@@ -86,7 +97,17 @@ const ArtistList = ({ width, ...rest }) => {
|
|||||||
<NumberField source="albumCount" sortByOrder={'DESC'} />
|
<NumberField source="albumCount" sortByOrder={'DESC'} />
|
||||||
<NumberField source="songCount" sortByOrder={'DESC'} />
|
<NumberField source="songCount" sortByOrder={'DESC'} />
|
||||||
<NumberField source="playCount" sortByOrder={'DESC'} />
|
<NumberField source="playCount" sortByOrder={'DESC'} />
|
||||||
<ArtistContextMenu />
|
<ArtistContextMenu
|
||||||
|
source={'starred'}
|
||||||
|
sortBy={'starred ASC, starredAt ASC'}
|
||||||
|
sortByOrder={'DESC'}
|
||||||
|
label={
|
||||||
|
<StarBorderIcon
|
||||||
|
fontSize={'small'}
|
||||||
|
className={classes.columnIcon}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</ArtistDatagrid>
|
</ArtistDatagrid>
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
|
|||||||
Reference in New Issue
Block a user