feat(person): sort control on document list #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User Journey
Erik opens the person page for his great-uncle Georg, who has 40+ documents spanning 50 years. He wants to read the documents in chronological order to follow Georg's life story — but the list is in whatever order the API returned. He has to open documents at random to find the earliest one.
With this feature, Erik sees a "Neueste zuerst / Älteste zuerst" toggle above the document list — the same pattern used on the conversations page. He clicks "Älteste zuerst" and the list reorders instantly.
High-Level Plan
Add a sort direction state variable to the person page and sort the document array before rendering. Same pattern as the conversations page sort toggle. Pure frontend — no backend changes or additional API calls.
Detailed Plan
Frontend only
Sort state in
persons/[id]/+page.svelte:Documents without a date sort to the end in both directions.
Sort toggle button — place in the section header row (same row as the "Dokumente" heading and count badge):
Reuse existing i18n keys
conv_sort_newest/conv_sort_oldest— no new keys needed (same wording applies here).Render
sortedSentandsortedReceivedinstead ofdata.sentDocuments/data.receivedDocuments.Single sort control — one toggle governs both sections simultaneously (they share the same
sortDirstate).Depends on: issue #1 (split sent/received). If implemented before issue #1, apply to the current single
documentsarray.Acceptance Criteria