Teal.fm frontend powered by slices.network tealfm-slices.wisp.place
tealfm slices

add musicbrainz links to the realese

+4 -1
src/AlbumItem.tsx
···
import AlbumArt from "./AlbumArt";
interface Artist {
artistName: string;
···
<div className="flex-1 min-w-0">
<h3 className="text-sm font-medium text-zinc-100 truncate">
-
{releaseName}
</h3>
<p className="text-xs text-zinc-500 truncate">{artistNames}</p>
</div>
···
import AlbumArt from "./AlbumArt";
+
import MusicBrainzLink from "./MusicBrainzLink";
interface Artist {
artistName: string;
···
<div className="flex-1 min-w-0">
<h3 className="text-sm font-medium text-zinc-100 truncate">
+
<MusicBrainzLink releaseMbId={releaseMbId}>
+
{releaseName}
+
</MusicBrainzLink>
</h3>
<p className="text-xs text-zinc-500 truncate">{artistNames}</p>
</div>
+24
src/MusicBrainzLink.tsx
···
···
+
interface MusicBrainzLinkProps {
+
releaseMbId: string | null | undefined;
+
children: React.ReactNode;
+
}
+
+
export default function MusicBrainzLink({
+
releaseMbId,
+
children,
+
}: MusicBrainzLinkProps) {
+
if (!releaseMbId) {
+
return <>{children}</>;
+
}
+
+
return (
+
<a
+
href={`https://musicbrainz.org/release/${releaseMbId}`}
+
target="_blank"
+
rel="noopener noreferrer"
+
className="hover:text-violet-400 transition-colors"
+
>
+
{children}
+
</a>
+
);
+
}
+4 -1
src/TopTrackItem.tsx
···
import AlbumArt from "./AlbumArt";
interface Artist {
artistName: string;
···
<div className="flex-1 min-w-0">
<h3 className="text-sm font-medium text-zinc-100 truncate">
-
{trackName}
</h3>
<p className="text-xs text-zinc-500 truncate">{artistNames}</p>
</div>
···
import AlbumArt from "./AlbumArt";
+
import MusicBrainzLink from "./MusicBrainzLink";
interface Artist {
artistName: string;
···
<div className="flex-1 min-w-0">
<h3 className="text-sm font-medium text-zinc-100 truncate">
+
<MusicBrainzLink releaseMbId={releaseMbId}>
+
{trackName}
+
</MusicBrainzLink>
</h3>
<p className="text-xs text-zinc-500 truncate">{artistNames}</p>
</div>
+4 -1
src/TrackItem.tsx
···
import { graphql, useFragment } from "react-relay";
import type { TrackItem_play$key } from "./__generated__/TrackItem_play.graphql";
import AlbumArt from "./AlbumArt";
interface TrackItemProps {
play: TrackItem_play$key;
···
<div className="text-right min-w-0">
<p className="text-xs text-zinc-400 truncate">
-
{data.releaseName}
</p>
<div className="flex items-center justify-end gap-2 mt-0.5 min-w-0 overflow-hidden">
{data.playedTime && (
···
import { graphql, useFragment } from "react-relay";
import type { TrackItem_play$key } from "./__generated__/TrackItem_play.graphql";
import AlbumArt from "./AlbumArt";
+
import MusicBrainzLink from "./MusicBrainzLink";
interface TrackItemProps {
play: TrackItem_play$key;
···
<div className="text-right min-w-0">
<p className="text-xs text-zinc-400 truncate">
+
<MusicBrainzLink releaseMbId={data.releaseMbId}>
+
{data.releaseName}
+
</MusicBrainzLink>
</p>
<div className="flex items-center justify-end gap-2 mt-0.5 min-w-0 overflow-hidden">
{data.playedTime && (