Link track coauthors next to the artist in rows and the player

This commit is contained in:
2026-09-25 02:23:43 +02:00
parent dddb57c98b
commit 2a7e805480
8 changed files with 31 additions and 3 deletions
@@ -21,6 +21,7 @@
title={track.title} title={track.title}
artist={track.artist} artist={track.artist}
ownerUserId={track.ownerUserId} ownerUserId={track.ownerUserId}
coauthors={track.coauthors}
explicit={track.explicit} explicit={track.explicit}
{active} {active}
> >
@@ -60,6 +60,7 @@
title={player.current.title} title={player.current.title}
artist={player.current.artist || '—'} artist={player.current.artist || '—'}
ownerUserId={player.current.ownerUserId} ownerUserId={player.current.ownerUserId}
coauthors={player.current.coauthors}
explicit={player.current.explicit} explicit={player.current.explicit}
active active
/> />
@@ -123,6 +124,7 @@
title={track.title} title={track.title}
subtitle={track.artist || '—'} subtitle={track.artist || '—'}
subtitleHref={track.ownerUserId} subtitleHref={track.ownerUserId}
coauthors={track.coauthors}
explicit={track.explicit} explicit={track.explicit}
trackId={track.id} trackId={track.id}
class="p-2" class="p-2"
@@ -42,6 +42,7 @@
<ArtistLink <ArtistLink
name={current?.artist || '—'} name={current?.artist || '—'}
ownerUserId={current?.ownerUserId} ownerUserId={current?.ownerUserId}
coauthors={current?.coauthors}
class="mt-0.5 text-xs text-fg-2" class="mt-0.5 text-xs text-fg-2"
/> />
</div> </div>
@@ -2,14 +2,30 @@
interface Props { interface Props {
name?: string | null; name?: string | null;
ownerUserId?: string | null; ownerUserId?: string | null;
coauthors?: { id: string; name: string }[];
class?: string; class?: string;
} }
let { name, ownerUserId, class: klass = '' }: Props = $props(); let { name, ownerUserId, coauthors = [], class: klass = '' }: Props = $props();
</script> </script>
{#snippet person(label: string, id?: string | null)}
{#if id}
<a href="/user/{id}" onclick={(e) => e.stopPropagation()} class="hover:underline">{label}</a>
{:else}
{label}
{/if}
{/snippet}
{#if name} {#if name}
{#if ownerUserId} {#if coauthors.length > 0}
<span class="block max-w-full truncate {klass}">
{@render person(name, ownerUserId)}{#each coauthors as coauthor (coauthor.id)}, {@render person(
coauthor.name,
coauthor.id
)}{/each}
</span>
{:else if ownerUserId}
<a <a
href="/user/{ownerUserId}" href="/user/{ownerUserId}"
onclick={(e) => e.stopPropagation()} onclick={(e) => e.stopPropagation()}
@@ -13,6 +13,7 @@
title: string; title: string;
subtitle?: string | null; subtitle?: string | null;
subtitleHref?: string | null; subtitleHref?: string | null;
coauthors?: { id: string; name: string }[];
explicit?: boolean; explicit?: boolean;
trackId?: string; trackId?: string;
trackIds?: string[]; trackIds?: string[];
@@ -35,6 +36,7 @@
title, title,
subtitle, subtitle,
subtitleHref, subtitleHref,
coauthors,
explicit = false, explicit = false,
trackId, trackId,
trackIds, trackIds,
@@ -60,6 +62,7 @@
{title} {title}
artist={subtitle} artist={subtitle}
ownerUserId={subtitleHref} ownerUserId={subtitleHref}
{coauthors}
{trackId} {trackId}
{trackIds} {trackIds}
{coverSrc} {coverSrc}
@@ -10,6 +10,7 @@
title: string; title: string;
artist?: string | null; artist?: string | null;
ownerUserId?: string | null; ownerUserId?: string | null;
coauthors?: { id: string; name: string }[];
coverSrc?: string | null; coverSrc?: string | null;
size?: 'xs' | 'sm' | 'lg'; size?: 'xs' | 'sm' | 'lg';
explicit?: boolean; explicit?: boolean;
@@ -26,6 +27,7 @@
title, title,
artist, artist,
ownerUserId, ownerUserId,
coauthors,
coverSrc, coverSrc,
size = 'sm', size = 'sm',
explicit = false, explicit = false,
@@ -60,6 +62,6 @@
>{title}</span >{title}</span
> >
</div> </div>
<ArtistLink name={artist} {ownerUserId} class="mt-0.5 text-xs text-fg-2" /> <ArtistLink name={artist} {ownerUserId} {coauthors} class="mt-0.5 text-xs text-fg-2" />
</div> </div>
</div> </div>
+2
View File
@@ -117,6 +117,7 @@
title={item.title} title={item.title}
subtitle={item.artist} subtitle={item.artist}
subtitleHref={item.ownerUserId} subtitleHref={item.ownerUserId}
coauthors={item.coauthors}
explicit={item.explicit} explicit={item.explicit}
trackId={item.id} trackId={item.id}
class="animate-enter" class="animate-enter"
@@ -182,6 +183,7 @@
title={track.title} title={track.title}
subtitle={track.artist} subtitle={track.artist}
subtitleHref={track.ownerUserId} subtitleHref={track.ownerUserId}
coauthors={track.coauthors}
explicit={track.explicit} explicit={track.explicit}
> >
{#snippet leading()} {#snippet leading()}
@@ -67,6 +67,7 @@
title={track.title} title={track.title}
subtitle={track.artist} subtitle={track.artist}
subtitleHref={track.ownerUserId} subtitleHref={track.ownerUserId}
coauthors={track.coauthors}
explicit={track.explicit} explicit={track.explicit}
active={player.currentId === track.id} active={player.currentId === track.id}
size="lg" size="lg"