feat: show received documents on person detail page #1

Closed
opened 2026-03-17 19:37:45 +01:00 by marcel · 1 comment
Owner

Summary

The person detail page (/persons/[id]) currently only lists documents where the person is the sender. It should also show documents where the person is a receiver.

Proposed Change

Split the documents section into two lists:

  • Gesendete Dokumente — documents where this person is the sender (existing behaviour)
  • Empfangene Dokumente — documents where this person is a receiver

Backend

Check whether GET /api/persons/{id}/documents already returns received documents, or whether a separate endpoint / query parameter is needed (e.g. ?role=receiver).

Frontend

Update persons/[id]/+page.server.ts to load both sets (potentially in parallel via Promise.all), and update persons/[id]/+page.svelte to render both sections.

## Summary The person detail page (`/persons/[id]`) currently only lists documents where the person is the **sender**. It should also show documents where the person is a **receiver**. ## Proposed Change Split the documents section into two lists: - **Gesendete Dokumente** — documents where this person is the sender (existing behaviour) - **Empfangene Dokumente** — documents where this person is a receiver ## Backend Check whether `GET /api/persons/{id}/documents` already returns received documents, or whether a separate endpoint / query parameter is needed (e.g. `?role=receiver`). ## Frontend Update `persons/[id]/+page.server.ts` to load both sets (potentially in parallel via `Promise.all`), and update `persons/[id]/+page.svelte` to render both sections.
marcel added the feature label 2026-03-17 19:42:41 +01:00
Author
Owner

Extension: Paginate document lists (frontend-only)

Both the Gesendete Dokumente and Empfangene Dokumente sections can grow very large. To keep the page manageable, only the first 5 documents should be shown initially, with a "Mehr anzeigen" button to reveal the rest.

Approach

Pure frontend state — no backend changes needed. All documents are loaded at once (existing behaviour); only the render is capped.

<!-- per section, in +page.svelte -->
let sentLimit = $state(5);
let receivedLimit = $state(5);

Render only data.sentDocuments.slice(0, sentLimit), then conditionally show a load-more button:

{#if data.sentDocuments.length > sentLimit}
    <button onclick={() => sentLimit += 5}>
        Mehr anzeigen ({data.sentDocuments.length - sentLimit} weitere)
    </button>
{/if}

Same pattern for received documents.

Acceptance Criteria

  • Each section shows at most 5 documents on initial load
  • A "Mehr anzeigen (N weitere)" button appears when there are more than 5
  • Clicking it reveals 5 more at a time
  • Button disappears once all documents are visible
  • Works for both sent and received sections independently
## Extension: Paginate document lists (frontend-only) Both the **Gesendete Dokumente** and **Empfangene Dokumente** sections can grow very large. To keep the page manageable, only the first 5 documents should be shown initially, with a "Mehr anzeigen" button to reveal the rest. ### Approach Pure frontend state — no backend changes needed. All documents are loaded at once (existing behaviour); only the render is capped. ```svelte <!-- per section, in +page.svelte --> let sentLimit = $state(5); let receivedLimit = $state(5); ``` Render only `data.sentDocuments.slice(0, sentLimit)`, then conditionally show a load-more button: ```svelte {#if data.sentDocuments.length > sentLimit} <button onclick={() => sentLimit += 5}> Mehr anzeigen ({data.sentDocuments.length - sentLimit} weitere) </button> {/if} ``` Same pattern for received documents. ### Acceptance Criteria - [ ] Each section shows at most 5 documents on initial load - [ ] A "Mehr anzeigen (N weitere)" button appears when there are more than 5 - [ ] Clicking it reveals 5 more at a time - [ ] Button disappears once all documents are visible - [ ] Works for both sent and received sections independently
Sign in to join this conversation.
No Label feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#1