Remove link from songs to artist (when artist has no albums)
This commit is contained in:
@@ -14,24 +14,25 @@ export const useGetHandleArtistClick = (width) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const songsFilteredByArtist = (artist) => {
|
|
||||||
return `/song?filter={"artist":"${artist}"}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ArtistLinkField = withWidth()(
|
export const ArtistLinkField = withWidth()(
|
||||||
({ record, className, width, source }) => {
|
({ record, className, width, source }) => {
|
||||||
const artistLink = useGetHandleArtistClick(width)
|
const artistLink = useGetHandleArtistClick(width)
|
||||||
|
|
||||||
const id = record[source + 'Id']
|
const id = record[source + 'Id']
|
||||||
const link = id ? artistLink(id) : songsFilteredByArtist(record[source])
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{id ? (
|
||||||
<Link
|
<Link
|
||||||
to={link}
|
to={artistLink(id)}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
{record[source]}
|
{record[source]}
|
||||||
</Link>
|
</Link>
|
||||||
|
) : (
|
||||||
|
record[source]
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const Menu = ({ dense = false }) => {
|
|||||||
const renderResourceMenuItemLink = (resource) => (
|
const renderResourceMenuItemLink = (resource) => (
|
||||||
<MenuItemLink
|
<MenuItemLink
|
||||||
key={resource.name}
|
key={resource.name}
|
||||||
to={`/${resource.name}?page=1`}
|
to={`/${resource.name}`}
|
||||||
activeClassName={classes.active}
|
activeClassName={classes.active}
|
||||||
primaryText={translatedResourceName(resource, translate)}
|
primaryText={translatedResourceName(resource, translate)}
|
||||||
leftIcon={resource.icon || <ViewListIcon />}
|
leftIcon={resource.icon || <ViewListIcon />}
|
||||||
|
|||||||
Reference in New Issue
Block a user