feat(person): show sender/receiver badge on each document #21

Closed
opened 2026-03-19 21:13:49 +01:00 by marcel · 0 comments
Owner

User Journey

Lena is on Heinrich's person page after issue #1 has been implemented, which shows both sent and received documents. She scrolls through a long mixed list and loses track of which letters Heinrich wrote vs. which he received. She has to open each document to find out.

With this feature, every document card in the list shows a small badge: "Gesendet" (dark) or "Empfangen" (mint). Lena sees the correspondence direction at a glance without opening anything.


High-Level Plan

After issue #1, the page has data.sentDocuments and data.receivedDocuments arrays. The role context (sender vs. receiver) is already known from which array the document came from — no API change needed. Add a small badge to the document card component in the person page.

Depends on: issue #1 (split sent/received document sections).


Detailed Plan

Frontend only

  1. Badge in the document list item (persons/[id]/+page.svelte):

    When iterating over sentDocuments, pass a role="sent" context. When iterating over receivedDocuments, pass role="received". Render a badge in the top-right of each card:

    <!-- for sent documents -->
    <span class="text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-brand-navy text-white">
        {m.person_role_sender()}
    </span>
    
    <!-- for received documents -->
    <span class="text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-brand-mint text-brand-navy">
        {m.person_role_receiver()}
    </span>
    
  2. i18n keys — add to de.json, en.json, es.json:

    • person_role_sender: DE "Gesendet" / EN "Sent" / ES "Enviado"
    • person_role_receiver: DE "Empfangen" / EN "Received" / ES "Recibido"
  3. Badge sits alongside the existing doc.status badge — they serve different purposes and can coexist.

Acceptance Criteria

  • Sent documents show the "Gesendet" badge in brand-navy
  • Received documents show the "Empfangen" badge in brand-mint
  • Badges are translated in all three languages
  • Depends on issue #1 being implemented first
  • No backend changes
## User Journey Lena is on Heinrich's person page after issue #1 has been implemented, which shows both sent and received documents. She scrolls through a long mixed list and loses track of which letters Heinrich wrote vs. which he received. She has to open each document to find out. With this feature, every document card in the list shows a small badge: **"Gesendet"** (dark) or **"Empfangen"** (mint). Lena sees the correspondence direction at a glance without opening anything. --- ## High-Level Plan After issue #1, the page has `data.sentDocuments` and `data.receivedDocuments` arrays. The role context (sender vs. receiver) is already known from which array the document came from — no API change needed. Add a small badge to the document card component in the person page. **Depends on:** issue #1 (split sent/received document sections). --- ## Detailed Plan ### Frontend only 1. **Badge in the document list item** (`persons/[id]/+page.svelte`): When iterating over `sentDocuments`, pass a `role="sent"` context. When iterating over `receivedDocuments`, pass `role="received"`. Render a badge in the top-right of each card: ```svelte <!-- for sent documents --> <span class="text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-brand-navy text-white"> {m.person_role_sender()} </span> <!-- for received documents --> <span class="text-[10px] font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-brand-mint text-brand-navy"> {m.person_role_receiver()} </span> ``` 2. **i18n keys** — add to `de.json`, `en.json`, `es.json`: - `person_role_sender`: DE `"Gesendet"` / EN `"Sent"` / ES `"Enviado"` - `person_role_receiver`: DE `"Empfangen"` / EN `"Received"` / ES `"Recibido"` 3. Badge sits alongside the existing `doc.status` badge — they serve different purposes and can coexist. ### Acceptance Criteria - [ ] Sent documents show the "Gesendet" badge in brand-navy - [ ] Received documents show the "Empfangen" badge in brand-mint - [ ] Badges are translated in all three languages - [ ] Depends on issue #1 being implemented first - [ ] No backend changes
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#21