diff --git a/frontend/src/routes/conversations/+page.svelte b/frontend/src/routes/conversations/+page.svelte index 64086b2e..3c893a1b 100644 --- a/frontend/src/routes/conversations/+page.svelte +++ b/frontend/src/routes/conversations/+page.svelte @@ -52,6 +52,17 @@ function swapPersons() { receiverId = tmp; applyFilters(); } + +const enrichedDocuments = $derived( + data.documents.map((doc, i) => { + const year = doc.documentDate ? new Date(doc.documentDate).getFullYear() : null; + const prevYear = + i > 0 && data.documents[i - 1].documentDate + ? new Date(data.documents[i - 1].documentDate!).getFullYear() + : null; + return { doc, year, showYearDivider: year !== null && year !== prevYear }; + }) +);
@@ -221,7 +232,17 @@ function swapPersons() {
- {#each data.documents as doc (doc.id)} + {#each enrichedDocuments as { doc, year, showYearDivider } (doc.id)} + {#if showYearDivider} +
+
+ {year} +
+
+ {/if} {@const isRight = doc.sender?.id === senderId}