Skip to content

Commit

Permalink
Merge pull request #3051 from metabrainz/LB-1640
Browse files Browse the repository at this point in the history
LB-1640: Use artist MBID in radio prompt
  • Loading branch information
anshg1214 authored Dec 2, 2024
2 parents 32b3c5d + 80e22ab commit 8556a0c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
28 changes: 16 additions & 12 deletions frontend/js/src/album/AlbumPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ export default function AlbumPage(): JSX.Element {
</div>
);
}
const artistsRadioPrompt: string =
artist.artists
?.map((a) => `artist:(${a.artist_mbid ?? a.name})`)
.join(" ") ?? `artist:(${encodeURIComponent(artist.name)})`;
const artistsRadioPromptNoSim: string =
artist.artists
?.map((a) => `artist:(${a.artist_mbid ?? a.name})::nosim`)
.join(" ") ?? `artist:(${encodeURIComponent(artist.name)})::nosim`;

return (
<div
Expand Down Expand Up @@ -315,11 +323,10 @@ export default function AlbumPage(): JSX.Element {
<Link
type="button"
className="btn btn-info"
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artistName
)})&mode=easy`}
to={`/explore/lb-radio/?prompt=${artistsRadioPrompt}&mode=easy`}
>
<FontAwesomeIcon icon={faPlayCircle} /> Artist Radio
<FontAwesomeIcon icon={faPlayCircle} /> Artist
{artist.artists?.length > 1 && "s"} Radio
</Link>
<button
type="button"
Expand All @@ -334,20 +341,17 @@ export default function AlbumPage(): JSX.Element {
<ul className="dropdown-menu">
<li>
<Link
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artistName
)})::nosim&mode=easy`}
to={`/explore/lb-radio/?prompt=${artistsRadioPrompt}&mode=easy`}
>
This artist
Artist{artist.artists?.length > 1 && "s"} radio
</Link>
</li>
<li>
<Link
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artistName
)})&mode=easy`}
to={`/explore/lb-radio/?prompt=${artistsRadioPromptNoSim}&mode=easy`}
>
Similar artists
{artist.artists?.length > 1 ? "These artists" : "This artist"}{" "}
only
</Link>
</li>
{Boolean(filteredTags?.length) && (
Expand Down
16 changes: 5 additions & 11 deletions frontend/js/src/artist/ArtistPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ export default function ArtistPage(): JSX.Element {
<Link
type="button"
className="btn btn-info"
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artist?.name
)})&mode=easy`}
to={`/explore/lb-radio/?prompt=artist:(${artistMBID})&mode=easy`}
>
<FontAwesomeIcon icon={faPlayCircle} /> Radio
</Link>
Expand All @@ -373,20 +371,16 @@ export default function ArtistPage(): JSX.Element {
<ul className="dropdown-menu">
<li>
<Link
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artist?.name
)})::nosim&mode=easy`}
to={`/explore/lb-radio/?prompt=artist:(${artistMBID})&mode=easy`}
>
This artist
Artist radio
</Link>
</li>
<li>
<Link
to={`/explore/lb-radio/?prompt=artist:(${encodeURIComponent(
artist?.name
)})&mode=easy`}
to={`/explore/lb-radio/?prompt=artist:(${artistMBID})::nosim&mode=easy`}
>
Similar artists
This artist only
</Link>
</li>
{Boolean(filteredTags?.length) && (
Expand Down

0 comments on commit 8556a0c

Please sign in to comment.