Skip to content
Snippets Groups Projects
Commit 1f5fbc8e authored by Ewen Le Bihan's avatar Ewen Le Bihan
Browse files

feat(reports): show comments count on reports list page

parent 70458942
Branches
Tags v1.36.0
No related merge requests found
<script lang="ts"> <script lang="ts">
import IconIssue from '~icons/mdi/chat-alert-outline'; import IconIssue from '~icons/mdi/chat-alert-outline';
import IconMore from '~icons/mdi/dots-horizontal-circle-outline'; import IconMore from '~icons/mdi/dots-horizontal-circle-outline';
import IconComments from '~icons/mdi/comment-multiple-outline';
import Badge from '$lib/components/Badge.svelte'; import Badge from '$lib/components/Badge.svelte';
import { IssueState } from '../../zeus'; import { IssueState } from '../../zeus';
import type { PageData } from './$types'; import type { PageData } from './$types';
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
<h1><ButtonBack></ButtonBack> Tes rapports</h1> <h1><ButtonBack></ButtonBack> Tes rapports</h1>
<ul class="nobullet reports"> <ul class="nobullet reports">
{#each data.issuesByUser as { number, title, state, duplicatedFrom } (duplicatedFrom ?? number)} {#each data.issuesByUser as { number, title, state, duplicatedFrom, comments } (duplicatedFrom ?? number)}
<li> <li>
<a href="./{number}"> <a href="./{number}">
<span class="number">#{duplicatedFrom ?? number}</span> <span class="number">#{duplicatedFrom ?? number}</span>
...@@ -25,9 +26,16 @@ ...@@ -25,9 +26,16 @@
{/if} {/if}
{title} {title}
</span> </span>
<div class="badges">
{#if comments.length}
<Badge title="{comments.length} commentaire{comments.length > 1 ? 's' : ''}"
><IconComments></IconComments> {comments.length}</Badge
>
{/if}
{#if state === IssueState.Closed} {#if state === IssueState.Closed}
<Badge theme="success">Réglé</Badge> <Badge theme="success">Réglé</Badge>
{/if} {/if}
</div>
</a> </a>
</li> </li>
{:else} {:else}
...@@ -94,6 +102,12 @@ ...@@ -94,6 +102,12 @@
font-family: var(--font-mono); font-family: var(--font-mono);
} }
.reports .badges {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
h2 { h2 {
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
......
...@@ -16,6 +16,7 @@ export const load: PageLoad = async ({ fetch, parent }) => { ...@@ -16,6 +16,7 @@ export const load: PageLoad = async ({ fetch, parent }) => {
difficulty: true, difficulty: true,
url: true, url: true,
duplicatedFrom: true, duplicatedFrom: true,
comments: { addedAt: true },
}, },
}, },
{ fetch, parent }, { fetch, parent },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment