mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-15 23:02:24 +03:00
Fix link to Artist's albums in mobile view
This commit is contained in:
parent
e6d1e67297
commit
ab0e091736
@ -1,4 +1,5 @@
|
|||||||
import React, { cloneElement, isValidElement, useState } from 'react'
|
import React, { cloneElement, isValidElement, useState } from 'react'
|
||||||
|
import { useHistory } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
Datagrid,
|
Datagrid,
|
||||||
DatagridBody,
|
DatagridBody,
|
||||||
@ -71,45 +72,49 @@ const ArtistDatagrid = (props) => (
|
|||||||
<Datagrid {...props} body={<ArtistDatagridBody />} />
|
<Datagrid {...props} body={<ArtistDatagridBody />} />
|
||||||
)
|
)
|
||||||
|
|
||||||
const ArtistList = ({ width, ...rest }) => {
|
const ArtistListView = ({ hasShow, hasEdit, hasList, width, ...rest }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const handleArtistLink = useGetHandleArtistClick(width)
|
const handleArtistLink = useGetHandleArtistClick(width)
|
||||||
|
const history = useHistory()
|
||||||
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
||||||
|
return isXsmall ? (
|
||||||
|
<SimpleList
|
||||||
|
primaryText={(r) => r.name}
|
||||||
|
linkType={(id) => {
|
||||||
|
history.push(handleArtistLink(id))
|
||||||
|
}}
|
||||||
|
rightIcon={(r) => <ArtistContextMenu record={r} />}
|
||||||
|
{...rest}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<ArtistDatagrid rowClick={handleArtistLink}>
|
||||||
|
<TextField source="name" />
|
||||||
|
<NumberField source="albumCount" sortByOrder={'DESC'} />
|
||||||
|
<NumberField source="songCount" sortByOrder={'DESC'} />
|
||||||
|
<NumberField source="playCount" sortByOrder={'DESC'} />
|
||||||
|
<ArtistContextMenu
|
||||||
|
source={'starred'}
|
||||||
|
sortBy={'starred ASC, starredAt ASC'}
|
||||||
|
sortByOrder={'DESC'}
|
||||||
|
label={
|
||||||
|
<StarBorderIcon fontSize={'small'} className={classes.columnIcon} />
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ArtistDatagrid>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const ArtistList = (props) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<List
|
<List
|
||||||
{...rest}
|
{...props}
|
||||||
sort={{ field: 'name', order: 'ASC' }}
|
sort={{ field: 'name', order: 'ASC' }}
|
||||||
exporter={false}
|
exporter={false}
|
||||||
bulkActionButtons={false}
|
bulkActionButtons={false}
|
||||||
filters={<ArtistFilter />}
|
filters={<ArtistFilter />}
|
||||||
>
|
>
|
||||||
{isXsmall ? (
|
<ArtistListView {...props} />
|
||||||
<SimpleList
|
|
||||||
primaryText={(r) => r.name}
|
|
||||||
linkType={'show'}
|
|
||||||
rightIcon={(r) => <ArtistContextMenu record={r} />}
|
|
||||||
{...rest}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<ArtistDatagrid rowClick={handleArtistLink}>
|
|
||||||
<TextField source="name" />
|
|
||||||
<NumberField source="albumCount" sortByOrder={'DESC'} />
|
|
||||||
<NumberField source="songCount" sortByOrder={'DESC'} />
|
|
||||||
<NumberField source="playCount" sortByOrder={'DESC'} />
|
|
||||||
<ArtistContextMenu
|
|
||||||
source={'starred'}
|
|
||||||
sortBy={'starred ASC, starredAt ASC'}
|
|
||||||
sortByOrder={'DESC'}
|
|
||||||
label={
|
|
||||||
<StarBorderIcon
|
|
||||||
fontSize={'small'}
|
|
||||||
className={classes.columnIcon}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</ArtistDatagrid>
|
|
||||||
)}
|
|
||||||
</List>
|
</List>
|
||||||
<AddToPlaylistDialog />
|
<AddToPlaylistDialog />
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user