Admin: Berichten-scherm met formulierschakelaar, lijst, detail en opnieuw mailen (CMS-U6)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
# CMS-U6 — Admin UI "Berichten" (summary)
|
||||
|
||||
Frontend only. New feature folder `frontend/src/features/contact` (services, components, page, msw mocks, tests).
|
||||
|
||||
- Route `/messages` (Owner/Administrator, `ModuleGuard Contact`, plus `ContactAvailabilityGuard`: a 404 on `GET /contact-settings` means the host switch is off and the usual not-found page is shown). Sidebar entry "Berichten" only when capabilities list `Contact` and the settings call did not answer 404.
|
||||
- Form switch card (`role=switch`, state from the server response, first-time hint, translated errors).
|
||||
- List: chips Inbox/Nieuw/Gelezen/Gearchiveerd/Spam (Nieuw shows `unreadCount`), 25 per page, pager, empty states, spam only under its chip, mail status icons with text alternatives.
|
||||
- Detail dialog: line breaks kept, mailto link, status select, "Geen spam", delete with confirmation, resend (sent / not sent / 409 / 429 with Retry-After seconds / disabled with hint when mail is off), translated mail error code and next attempt time. Opening an unread message marks it read (decision approved).
|
||||
- Texts nl/en under `contact.*` and `nav.messages`; no API titles are shown.
|
||||
- Shared files touched (additive): `lib/api-client.ts` (new `patch` method), `Sidebar.tsx` (one entry), `router.tsx` (one route), `mocks/index.ts`, both translation files.
|
||||
- Verification: `pnpm lint` clean, `npx tsc -b` clean, vitest 58 files / 458 tests (26 new). Not touched: backend, auth/refresh, users, theme assets.
|
||||
+6
-6
@@ -17,12 +17,12 @@ Phase 2, frontend only (`frontend/src/features/contact`, `router.tsx`, `Sidebar.
|
||||
7. All user-facing texts Dutch with English counterparts (`contact.*`); errors and 4xx/5xx mapped to translated messages, never the API's English titles. Accessibility: switch with accessible name and state, focus management in dialogs, status icons with text alternatives.
|
||||
|
||||
## Steps
|
||||
- [ ] **Step 1 — Types, services and msw mocks** (settings get/put incl. 404 = unavailable, messages list/detail/patch/delete/resend with the real status codes and shapes).
|
||||
- [ ] **Step 2 — Components**: `FormSwitchCard`, `MessagesFilterChips`, `MessagesTable` + pager, `MessageDialog`, `DeleteMessageDialog`.
|
||||
- [ ] **Step 3 — Page, route, sidebar entry, guards, translations (nl/en)**.
|
||||
- [ ] **Step 4 — Tests (Vitest + Testing Library + msw)**: sidebar entry visible/hidden (module missing, 404 on settings, role); direct route when unavailable; switch card off→on→off with server response, error path, first-time hint; list default shows no spam, each chip sends the right query, counter from `unreadCount`, paging; detail opens, marks unread as read, line breaks preserved, status change, un-spam moves the row, delete confirm/cancel, resend (`mailed` true/false, 409, 429 with seconds, email disabled), empty states, translated error codes; no raw API titles shown.
|
||||
- [ ] **Step 5 — Verification (automatic)**: `pnpm lint`, `npx tsc -b`, full `pnpm test`; new files formatted with prettier (the 15 old prettier warnings in offerings stay); real output reported.
|
||||
- [ ] **Step 6 — Docs/commit**: summary; one commit; no push.
|
||||
- [x] **Step 1 — Types, services and msw mocks** (settings get/put incl. 404 = unavailable, messages list/detail/patch/delete/resend with the real status codes and shapes).
|
||||
- [x] **Step 2 — Components**: `FormSwitchCard`, `MessagesFilterChips`, `MessagesTable` + pager, `MessageDialog`, `DeleteMessageDialog`.
|
||||
- [x] **Step 3 — Page, route, sidebar entry, guards, translations (nl/en)**.
|
||||
- [x] **Step 4 — Tests (Vitest + Testing Library + msw)**: sidebar entry visible/hidden (module missing, 404 on settings, role); direct route when unavailable; switch card off→on→off with server response, error path, first-time hint; list default shows no spam, each chip sends the right query, counter from `unreadCount`, paging; detail opens, marks unread as read, line breaks preserved, status change, un-spam moves the row, delete confirm/cancel, resend (`mailed` true/false, 409, 429 with seconds, email disabled), empty states, translated error codes; no raw API titles shown.
|
||||
- [x] **Step 5 — Verification (automatic)**: `pnpm lint`, `npx tsc -b`, full `pnpm test`; new files formatted with prettier (the 15 old prettier warnings in offerings stay); real output reported.
|
||||
- [x] **Step 6 — Docs/commit**: summary; one commit; no push.
|
||||
|
||||
## Explicitly NOT touched
|
||||
Backend, auth/refresh, users, theme assets, existing features except the one entry in `Sidebar.tsx` and the route in `router.tsx`, shared UI primitives (used, not edited; a switch is built from the existing button/checkbox primitives unless a primitive is missing, then added as a new file).
|
||||
|
||||
Reference in New Issue
Block a user