mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-17 04:22:23 +03:00
Show artist link in Songs lists
This commit is contained in:
parent
1c82bf5179
commit
91b470c93b
@ -14,25 +14,35 @@ export const useGetHandleArtistClick = (width) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const ArtistLinkField = withWidth()(({ record, className, width }) => {
|
||||
const artistLink = useGetHandleArtistClick(width)
|
||||
const songsFilteredByArtist = (artist) => {
|
||||
return `/song?filter={"artist":"${artist}"}`
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={artistLink(record.albumArtistId)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={className}
|
||||
>
|
||||
{record.albumArtist}
|
||||
</Link>
|
||||
)
|
||||
})
|
||||
export const ArtistLinkField = withWidth()(
|
||||
({ record, className, width, source }) => {
|
||||
const artistLink = useGetHandleArtistClick(width)
|
||||
|
||||
const id = record[source + 'Id']
|
||||
const link = id ? artistLink(id) : songsFilteredByArtist(record[source])
|
||||
return (
|
||||
<Link
|
||||
to={link}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={className}
|
||||
>
|
||||
{record[source]}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
ArtistLinkField.propTypes = {
|
||||
record: PropTypes.object,
|
||||
className: PropTypes.string,
|
||||
source: PropTypes.string,
|
||||
}
|
||||
|
||||
ArtistLinkField.defaultProps = {
|
||||
addLabel: true,
|
||||
source: 'albumArtist',
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ const Menu = ({ dense = false }) => {
|
||||
const renderResourceMenuItemLink = (resource) => (
|
||||
<MenuItemLink
|
||||
key={resource.name}
|
||||
to={`/${resource.name}`}
|
||||
to={`/${resource.name}?page=1`}
|
||||
activeClassName={classes.active}
|
||||
primaryText={translatedResourceName(resource, translate)}
|
||||
leftIcon={resource.icon || <ViewListIcon />}
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
useSelectedFields,
|
||||
useResourceRefresh,
|
||||
DateField,
|
||||
ArtistLinkField,
|
||||
} from '../common'
|
||||
import { AddToPlaylistDialog } from '../dialogs'
|
||||
import { AlbumLinkField } from '../song/AlbumLinkField'
|
||||
@ -134,7 +135,8 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
||||
trackNumber: isDesktop && <TextField source="id" label={'#'} />,
|
||||
title: <SongTitleField source="title" showTrackNumbers={false} />,
|
||||
album: isDesktop && <AlbumLinkField source="album" />,
|
||||
artist: isDesktop && <TextField source="artist" />,
|
||||
artist: isDesktop && <ArtistLinkField source="artist" />,
|
||||
albumArtist: isDesktop && <ArtistLinkField source="albumArtist" />,
|
||||
duration: (
|
||||
<DurationField source="duration" className={classes.draggable} />
|
||||
),
|
||||
@ -158,7 +160,14 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
||||
const columns = useSelectedFields({
|
||||
resource: 'playlistTrack',
|
||||
columns: toggleableFields,
|
||||
defaultOff: ['channels', 'bpm', 'year', 'playCount', 'playDate'],
|
||||
defaultOff: [
|
||||
'channels',
|
||||
'bpm',
|
||||
'year',
|
||||
'playCount',
|
||||
'playDate',
|
||||
'albumArtist',
|
||||
],
|
||||
})
|
||||
|
||||
return (
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
SongSimpleList,
|
||||
RatingField,
|
||||
useResourceRefresh,
|
||||
ArtistLinkField,
|
||||
} from '../common'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
@ -107,8 +108,8 @@ const SongList = (props) => {
|
||||
sortByOrder={'ASC'}
|
||||
/>
|
||||
),
|
||||
artist: <TextField source="artist" />,
|
||||
albumArtist: <TextField source="albumArtist" />,
|
||||
artist: <ArtistLinkField source="artist" />,
|
||||
albumArtist: <ArtistLinkField source="albumArtist" />,
|
||||
trackNumber: isDesktop && <NumberField source="trackNumber" />,
|
||||
playCount: isDesktop && (
|
||||
<NumberField source="playCount" sortByOrder={'DESC'} />
|
||||
|
Loading…
x
Reference in New Issue
Block a user