- openArtistDetail(artistId, artistName)}
- />
- openArtistDetail(artistId, artistName)}
- />
+
+
- openArtistDetail(artistId, artistName)}
- />
+
openArtistDetail(artistId, artistName)}
onPlay={(track) => playStatsTrack(bridge, track)}
/>
@@ -405,13 +393,7 @@ function StatsGenreLegend({
);
}
-function TopArtistsVisual({
- artists,
- onArtistSelect,
-}: {
- artists: StatsArtistRow[];
- onArtistSelect: (artistId: string | number, artistName: string) => void;
-}) {
+function TopArtistsVisual({ artists }: { artists: StatsArtistRow[] }) {
const topArtists = getTopArtistBubbles(artists);
if (topArtists.length === 0) return null;
@@ -420,18 +402,8 @@ function TopArtistsVisual({
{topArtists.map(({ artist, percent, size }) => {
const isClickable = artist.id !== null && artist.id !== undefined;
- return (
-
+ >
+ );
+ return isClickable ? (
+
+ {bubbleContent}
+
+ ) : (
+
+ {bubbleContent}
+
);
})}
@@ -459,13 +449,30 @@ function TopArtistsVisual({
);
}
-function StatsRankedArtists({
- artists,
- onArtistSelect,
+function ArtistDetailLink({
+ artistId,
+ children,
+ ...linkProps
}: {
- artists: StatsArtistRow[];
- onArtistSelect: (artistId: string | number, artistName: string) => void;
-}) {
+ artistId: string | number | null | undefined;
+ children: ReactNode;
+} & Omit
, 'children' | 'href'>) {
+ if (artistId == null) {
+ return <>{children}>;
+ }
+
+ return (
+
+ {children}
+
+ );
+}
+
+function StatsRankedArtists({ artists }: { artists: StatsArtistRow[] }) {
return (
{artists.length === 0 ?
: null}
@@ -479,17 +486,9 @@ function StatsRankedArtists({
)}
- {artist.id ? (
-
- ) : (
- artist.name
- )}
+
+ {artist.name}
+
{artist.soul_id && !String(artist.soul_id).startsWith('soul_unnamed_') ? (

) : null}
@@ -509,13 +508,7 @@ function StatsRankedArtists({
);
}
-function StatsRankedAlbums({
- albums,
- onArtistSelect,
-}: {
- albums: StatsAlbumRow[];
- onArtistSelect: (artistId: string | number, artistName: string) => void;
-}) {
+function StatsRankedAlbums({ albums }: { albums: StatsAlbumRow[] }) {
return (
{albums.length === 0 ?
: null}
@@ -530,19 +523,9 @@ function StatsRankedAlbums({
{album.name}
- {album.artist_id ? (
-
- ) : (
- album.artist || ''
- )}
+
+ {album.artist || ''}
+
@@ -556,11 +539,9 @@ function StatsRankedAlbums({
function StatsRankedTracks({
tracks,
- onArtistSelect,
onPlay,
}: {
tracks: StatsTrackRow[];
- onArtistSelect: (artistId: string | number, artistName: string) => void;
onPlay: (track: { title: string; artist: string; album: string }) => Promise;
}) {
return (
@@ -577,19 +558,9 @@ function StatsRankedTracks({
{track.name}
- {track.artist_id ? (
-
- ) : (
- track.artist || ''
- )}
+
+ {track.artist || ''}
+
{track.album ? ` ยท ${track.album}` : ''}