From 787131002fa7551920e9f1ddd7ee5d139a330955 Mon Sep 17 00:00:00 2001
From: Sluijsens
Date: Tue, 10 Nov 2026 23:20:05 +0100
Subject: [PATCH] Admin Berichten: toggle-switch, statusicoon,
archiveren/terugzetten (CMS-U10)
Co-Authored-By: Claude Sonnet 5.5
---
.../cms-u10-berichten-ux/code/summary.md | 9 ++
.../contact/components/FormSwitchCard.tsx | 22 ++---
.../contact/components/MessageDialog.tsx | 91 ++++++++++---------
.../contact/components/MessagesTable.tsx | 14 +--
.../contact/components/StatusIcon.tsx | 34 +++++++
.../contact/components/ToggleSwitch.tsx | 56 ++++++++++++
.../src/features/contact/mocks/handlers.ts | 6 +-
.../contact/pages/MessagesPage.test.tsx | 83 ++++++++++++++++-
frontend/src/i18n/locales/en/translation.json | 4 +
frontend/src/i18n/locales/nl/translation.json | 4 +
10 files changed, 245 insertions(+), 78 deletions(-)
create mode 100644 aidlc-docs/features/contact-forms-module/construction/cms-u10-berichten-ux/code/summary.md
create mode 100644 frontend/src/features/contact/components/StatusIcon.tsx
create mode 100644 frontend/src/features/contact/components/ToggleSwitch.tsx
diff --git a/aidlc-docs/features/contact-forms-module/construction/cms-u10-berichten-ux/code/summary.md b/aidlc-docs/features/contact-forms-module/construction/cms-u10-berichten-ux/code/summary.md
new file mode 100644
index 0000000..a115cde
--- /dev/null
+++ b/aidlc-docs/features/contact-forms-module/construction/cms-u10-berichten-ux/code/summary.md
@@ -0,0 +1,9 @@
+# CMS-U10 — Berichten UX (summary)
+
+Frontend only, `frontend/src/features/contact` + nl/en texts (`contact.switch.on|off`, `contact.detail.archive|restore`).
+
+- **Form switch**: new `ToggleSwitch` (native button, `role="switch"`, `aria-checked`, label as accessible name, state as visible text "Aan"/"Uit", `min-h-11 min-w-11` target, Space/Enter, disabled while saving). Existing error handling, toast and first-time hint unchanged.
+- **Status**: new `StatusIcon` (envelope = new, open envelope = read, archive box = archived, shield = spam) with the name as visible text and `title`; the same component in the list and the detail dialog. The status select is gone.
+- **Detail actions**: opening an unread message still marks it read automatically (no button). Buttons: Archiveren (new/read), Terugzetten (archived -> read), Geen spam (spam), Verwijderen, Opnieuw mailen.
+- **Subject**: shown literally as the site sent it (no transformation); mock data now uses capitalised labels ('Website', 'Onderhoudspakket', 'Overig'). The local dev database was re-seeded with such labels (not part of the repo).
+- Tests: switch (role, name, state text, 44px classes, Space/Enter, disabled while saving), no select, status icon with text in list and detail, archive/restore flow, literal subject. Lint and `tsc -b` clean, vitest 59 files / 470 tests.
diff --git a/frontend/src/features/contact/components/FormSwitchCard.tsx b/frontend/src/features/contact/components/FormSwitchCard.tsx
index d47ea56..934074f 100644
--- a/frontend/src/features/contact/components/FormSwitchCard.tsx
+++ b/frontend/src/features/contact/components/FormSwitchCard.tsx
@@ -1,9 +1,9 @@
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
-import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { useContactSettings, useUpdateContactSettings } from '../services/useContactSettings';
import { contactErrorMessage } from '../errors';
+import { ToggleSwitch } from './ToggleSwitch';
/** The form switch: whether the contact form on the website is open. The state shown is the server's. */
export function FormSwitchCard() {
@@ -14,8 +14,8 @@ export function FormSwitchCard() {
if (!settings) return null;
const open = settings.enabled;
- const toggle = () =>
- update.mutate(!open, {
+ const toggle = (next: boolean) =>
+ update.mutate(next, {
onSuccess: (saved) =>
toast.success(
saved.enabled ? t('contact.switch.nowOn') : t('contact.switch.nowOff'),
@@ -33,18 +33,14 @@ export function FormSwitchCard() {