show topics on all tasks

This commit is contained in:
2025-01-24 12:33:10 +01:00
parent f84c864dd4
commit 951a0b5256
2 changed files with 19 additions and 4 deletions

View File

@@ -2,7 +2,15 @@ import { db } from '$lib/db';
export const load = async ({ cookies }) => { export const load = async ({ cookies }) => {
return { return {
tasks: await db.query.tasks.findMany(), tasks: await db.query.tasks.findMany({
with: {
tasksToTopics: {
with: {
topic: true
}
}
}
}),
editable: cookies.get('token') editable: cookies.get('token')
}; };
}; };

View File

@@ -22,7 +22,7 @@
<thead> <thead>
<tr class="border-b border-white"> <tr class="border-b border-white">
<th class="px-6 py-3 text-left text-sm font-semibold">Name</th> <th class="px-6 py-3 text-left text-sm font-semibold">Name</th>
<th class="px-6 py-3 text-left text-sm font-semibold">Type</th> <th class="px-6 py-3 text-left text-sm font-semibold">Topics</th>
<th class="px-6 py-3 text-left text-sm font-semibold">Progress</th> <th class="px-6 py-3 text-left text-sm font-semibold">Progress</th>
<th class="px-6 py-3 text-left text-sm font-semibold">Actions</th> <th class="px-6 py-3 text-left text-sm font-semibold">Actions</th>
</tr> </tr>
@@ -36,8 +36,15 @@
</a> </a>
</td> </td>
<td class="px-6 py-2 border-b"> <td class="px-6 py-2 border-b">
<a href={`/progress/${task.id}`} class="text-blue-500 hover:underline"> <a href={`/progress/${task.id}`} class="flex gap-2 flex-wrap">
{task.type} {#each task.tasksToTopics as topic}
<div
class="relative bg-blue-500 text-white rounded-full px-2 py-1 shadow font-medium hover:bg-blue-600 transition cursor-pointer group"
title="Click for more details about {topic.topic.name}"
>
{topic.topic.name}
</div>
{/each}
</a> </a>
</td> </td>