feat: Add links to TrackCard

This commit is contained in:
Roman Godmaire 2023-11-20 09:55:14 -05:00
parent 33aee1875e
commit 10d0ab1030
3 changed files with 17 additions and 2 deletions

View file

@ -1,4 +1,5 @@
<script lang="ts">
export let id: number;
export let title: string;
export let version: number;
export let producerUsername: string;
@ -19,8 +20,15 @@
<article>
<hgroup>
<h2>{title} <sup>(v{version})</sup></h2>
<h3>by {producerUsername}</h3>
<h2>
<a href="/track/{id}" class="contrast track-title">
{title} <sup>(v{version})</sup>
</a>
</h2>
<h3>
by <a href="/user/{producerUsername}" class="secondary">{producerUsername}</a>
</h3>
</hgroup>
This is a track card.
@ -52,6 +60,10 @@
</article>
<style>
.track-title {
text-decoration: none;
}
.comment-headline {
display: flex;
justify-content: space-between;

View file

@ -11,6 +11,7 @@ export class DatabasePrisma implements Database {
listTracksForTrackCard = async (producerId: string) => {
const tracks = await this.client.track.findMany({
select: {
id: true,
title: true,
producer: {
select: {
@ -45,6 +46,7 @@ export class DatabasePrisma implements Database {
const res = tracks.map((track) => {
return {
id: track.id,
title: track.title,
version: track._count.versions,
producer: track.producer.username,

View file

@ -16,6 +16,7 @@
{#each data.tracks as track}
<TrackCard
id={track.id}
title={track.title}
version={track.version}
producerUsername={track.producer}