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() {

{settings.hostEnabled ? ( - + /> ) : (

void; } -const SETTABLE: SettableStatus[] = ['new', 'read', 'archived']; - export function MessageDialog({ id, onClose, onDeleteRequested }: Props) { const { t, i18n } = useTranslation(); const { data: message, isPending, isError } = useContactMessage(id); @@ -118,52 +116,55 @@ export function MessageDialog({ id, onClose, onDeleteRequested }: Props) { {message.message}

-
-