Remove link from songs to artist (when artist has no albums)

This commit is contained in:
Deluan
2021-11-17 18:47:54 -05:00
parent 48a627885c
commit 023d7bfa8a
2 changed files with 14 additions and 13 deletions
+13 -12
View File
@@ -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 (
<Link <>
to={link} {id ? (
onClick={(e) => e.stopPropagation()} <Link
className={className} to={artistLink(id)}
> onClick={(e) => e.stopPropagation()}
{record[source]} className={className}
</Link> >
{record[source]}
</Link>
) : (
record[source]
)}
</>
) )
} }
) )
+1 -1
View File
@@ -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 />}