Skip to content

Commit

Permalink
fix: in don't link to artist pages if on artist page
Browse files Browse the repository at this point in the history
closes #797
  • Loading branch information
Simon committed Jan 21, 2025
1 parent b727c89 commit 5930b92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/components/Artist/ArtistLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";
import { getArtistUrl } from "utils/artist";

const ArtistLink: React.FC<{ artist?: Artist }> = ({ artist }) => {
const location = useLocation();
if (!artist) {
return null;
}

if (artist.urlSlug && location.pathname.includes(artist.urlSlug)) {
return artist.name;
}

return <Link to={getArtistUrl(artist)}>{artist?.name}</Link>;
};
export default ArtistLink;

0 comments on commit 5930b92

Please sign in to comment.