From 25b258165384ebb0b4a0bb18e74439be481c9e18 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Thu, 13 Aug 2026 21:57:59 +0200 Subject: [PATCH] =?UTF-8?q?feat(C):=20Phase=20C=20=E2=80=94=20Core=20UI=20?= =?UTF-8?q?pr=C3=BCfen,=20vervollst=C3=A4ndigen,=20testen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C-ERR-BOUNDARY: ErrorBoundary erweitert (trace_id, Fallback-UI, PluginErrorBoundary) C-NOTIF: NotificationDropdown mit System-Channel-Link C-DOCS: ApiDocs.tsx Seite (Swagger UI iframe) C-A11Y: aria-label, min-h-touch, focus-visible ergänzt C-FE-TEST: 29 neue Tests (ErrorBoundary, ApiDocs, PrintButton, themeStore, NotificationDropdown) C-DOC: ui-design-guidelines.md aktualisiert Verifiziert (keine Änderungen nötig): - C-TAGS, C-CF, C-FILTER, C-DEDUP, C-ONBOARD, C-THEME, C-PWA, C-PRINT TSC: 0 errors, Build: erfolgreich, Vitest: 29/29 passed --- PROGRESS.md | 25 +++- docs/ui-design-guidelines.md | 113 +++++++++++++++++- .../__tests__/common/ErrorBoundary.test.tsx | 108 +++++++++++++++++ .../src/__tests__/common/PrintButton.test.tsx | 62 ++++++++++ .../NotificationDropdown.test.tsx | 84 +++++++++++++ frontend/src/__tests__/pages/ApiDocs.test.tsx | 36 ++++++ .../src/__tests__/store/themeStore.test.ts | 99 +++++++++++++++ .../src/components/common/ErrorBoundary.tsx | 95 ++++++++------- frontend/src/components/layout/AppShell.tsx | 2 +- .../src/components/layout/StartLayout.tsx | 2 +- frontend/src/components/layout/TopBar.tsx | 3 +- .../notifications/NotificationDropdown.tsx | 18 ++- .../src/components/plugins/PluginLoader.tsx | 70 ++++++++++- frontend/src/pages/ApiDocs.tsx | 50 ++++++++ frontend/src/routes/index.tsx | 8 +- 15 files changed, 713 insertions(+), 62 deletions(-) create mode 100644 frontend/src/__tests__/common/ErrorBoundary.test.tsx create mode 100644 frontend/src/__tests__/common/PrintButton.test.tsx create mode 100644 frontend/src/__tests__/notifications/NotificationDropdown.test.tsx create mode 100644 frontend/src/__tests__/pages/ApiDocs.test.tsx create mode 100644 frontend/src/__tests__/store/themeStore.test.ts create mode 100644 frontend/src/pages/ApiDocs.tsx diff --git a/PROGRESS.md b/PROGRESS.md index bb270e9..f2d9224 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -11,7 +11,7 @@ |-------|-------|-------|------|------------|-------------| | A — Stabilität verifizieren | `done` | 2026-08-13 | 2026-08-13 | 5 | 5 | | B — System-Konsolidierung | `done` | 2026-08-13 | 2026-08-13 | ~50 | ~50 | -| C — Core UI | `not_started` | — | — | 0 | ~18 | +| C — Core UI | `done` | 2026-08-13 | 2026-08-13 | 14 | 14 | | C.5 — Import/Export | `not_started` | — | — | 0 | 8 | | D — Undo/Restore | `not_started` | — | — | 0 | ~12 | | E — Search | `not_started` | — | — | 0 | ~24 | @@ -191,7 +191,28 @@ --- -## Phasen C-J +## Phase C — Core UI prüfen, vervollständigen, testen + +| Task | Status | Forgejo Issue | Verifiziert | +|------|-------|---------------|------------| +| C-ERR-BOUNDARY | `done` | — | ✅ ErrorBoundary (common) erweitert: trace_id, Tailwind Fallback-UI, Retry+Neu laden Buttons, role=alert, aria-live. PluginErrorBoundary in PluginLoader erweitert mit trace_id. PluginRouteRenderer in routes mit ErrorBoundary umschlossen. AppShell+StartLayout auf common/ErrorBoundary umgestellt. 7 Tests | +| C-NOTIF | `done` | — | ✅ NotificationDropdown erweitert: System-Channel-Link Button (→ /communication?channel=system), MessageSquare Icon. Bestehende /notifications API beibehalten (delegiert an comm post_system_message). 5 Tests | +| C-TAGS | `done` | — | ✅ Verifiziert — Tags.tsx funktional: CRUD, Color Picker, Delete Confirmation, Usage Count | +| C-CF | `done` | — | ✅ Verifiziert — CustomFields.tsx funktional: CRUD, Entity Selector, Field Types, Auto-slug | +| C-FILTER | `done` | — | ✅ Verifiziert — SavedFilters.tsx funktional: Save/Load/Delete, Modal | +| C-DEDUP | `done` | — | ✅ Verifiziert — DedupMerge.tsx funktional: Threshold Slider, Search, MergeDialog, MergeHistory | +| C-PRINT | `done` | — | ✅ Verifiziert — PrintButton in ContactDetailPage, Reports, Calendar. print.ts mit printElement/printCurrentPage/exportToPDF. print.css mit @media print. 6 Tests | +| C-DOCS | `done` | — | ✅ ApiDocs.tsx erstellt: iframe mit /docs, External-Link, Route /api-docs. 3 Tests | +| C-ONBOARD | `done` | — | ✅ Verifiziert — OnboardingTour (8 Steps, CSS Overlay, Keyboard Nav) + WelcomeDialog funktional | +| C-THEME | `done` | — | ✅ Verifiziert — SettingsTheme.tsx + themeStore: CSS Custom Properties, Dark Mode (class), Color Scale Generation, localStorage. 8 Tests | +| C-A11Y | `done` | — | ✅ ARIA audit: TopBar aria-labels, Sidebar aria-label, AppShell role=main+tabIndex, Skip-Link, min-h-touch. Fixed: minimized window buttons aria-label, AppShell ErrorBoundary import | +| C-PWA | `done` | — | ✅ Verifiziert — vite-plugin-pwa konfiguriert, sw.js+registerSW.js in dist/, Cache-Strategie: App-Shell+statische Assets, NetworkOnly für API | +| C-FE-TEST | `done` | — | ✅ 29 neue Tests in 5 Dateien: ErrorBoundary (7), ApiDocs (3), PrintButton (6), themeStore (8), NotificationDropdown (5). Alle grün | +| C-DOC | `done` | — | ✅ docs/ui-design-guidelines.md aktualisiert: Error Boundaries, Print/PDF, API Docs, Notification-System, A11Y Patterns | + +--- + +## Phasen D-J Detaillierte Task-Listen werden beim Start der jeweiligen Phase eingetragen. Siehe `PLATFORM_ROADMAP.md` für alle Tasks. diff --git a/docs/ui-design-guidelines.md b/docs/ui-design-guidelines.md index cc22212..98136a6 100644 --- a/docs/ui-design-guidelines.md +++ b/docs/ui-design-guidelines.md @@ -511,7 +511,118 @@ function ContactForm({ open, onClose }) { --- -## 10. Datei-Struktur +## 10. Error Boundaries & Plugin-Fehlerbehandlung + +### ErrorBoundary (common) + +Die zentrale `ErrorBoundary` in `components/common/ErrorBoundary.tsx` fängt React-Render-Fehler ab und zeigt eine Fallback-UI mit: + +- **Trace-ID**: Jeder Fehler erhält eine eindeutige `trace_id` (Format: `err--`), die im Fehlerbuffer und im Backend-Log gespeichert wird +- **Fehlerdetails**: Ausklappbare Details mit Fehlermeldung und Stack-Trace +- **Retry-Button**: Setzt den Error-State zurück und versucht erneut zu rendern +- **Neu laden-Button**: Lädt die Seite neu (`window.location.reload()`) +- **ARIA**: `role="alert"` und `aria-live="assertive"` für Screenreader + +```tsx +import { ErrorBoundary } from '@/components/common/ErrorBoundary'; + + + + + +// Custom Fallback + }> + + +``` + +### PluginErrorBoundary + +Plugin-Seiten werden zusätzlich durch `PluginErrorBoundary` in `PluginLoader.tsx` umschlossen. Diese zeigt den Plugin-Namen im Fehlerfall und loggt den Fehler mit `pluginName` und `trace_id`. + +### PluginRouteRenderer + +Der `PluginRouteRenderer` (Catch-All Route) ist mit `ErrorBoundary` umschlossen, sodass Plugin-Seiten-Fehler nicht die gesamte App crashen. + +--- + +## 11. Print & PDF-Export + +### PrintButton + +Die `PrintButton`-Komponente in `components/common/PrintButton.tsx` bietet ein Dropdown mit Druck- und PDF-Export-Funktionen: + +- **Drucken**: Ruft `printElement(targetId)` oder `printCurrentPage()` auf +- **Als PDF**: Ruft `exportToPDF(targetId, filename)` auf (Browser-Print-to-PDF) +- **Print-CSS**: `public/print.css` mit `@media print` Regeln — versteckt Sidebars, TopBar, Buttons und formatiert Tabellen/Card für Druck + +```tsx +import { PrintButton } from '@/components/common/PrintButton'; + + +``` + +Verwendung in: `ContactDetailPage`, `Reports`, `Calendar`. + +--- + +## 12. API-Dokumentation (Swagger UI) + +Die `ApiDocsPage` in `pages/ApiDocs.tsx` bettet die FastAPI Swagger UI in einem iframe ein: + +- Route: `/api-docs` (erfordert `settings:read` Permission) +- iframe src: `/docs` (FastAPI Swagger UI) +- External-Link: Öffnet `/docs` in neuem Tab +- Vollbild-iframe mit Header-Leiste + +--- + +## 13. Notification-System + +### NotificationBell + Dropdown + +Die `NotificationBell` in `components/layout/NotificationBell.tsx` zeigt ungelesene Benachrichtigungen mit: + +- **Unread-Badge**: Roter Zähler (max. 99+) mit 30s Polling +- **Dropdown**: Liste der Benachrichtigungen, „Alle als gelesen"-Button +- **System-Channel-Link**: Öffnet den Kommunikations-System-Channel unter `/communication?channel=system` +- **Alle anzeigen**: Navigiert zu `/settings/notifications` + +Das Backend delegiert `/notifications` an den Kommunikations-System-Channel (`post_system_message`). + +--- + +## 14. Accessibility (A11Y) Patterns + +### Verbindliche ARIA-Regeln + +| Element | Attribut | Wert | +|---|---|---| +| Buttons | `aria-label` | Beschreibung der Aktion | +| Icon-only Buttons | `aria-label` + `aria-hidden` auf Icon | Icon dekorativ | +| Dropdowns | `aria-haspopup="menu"` + `aria-expanded` | true/false | +| Menüs | `role="menu"` + `aria-label` | Menüname | +| Error-Bereiche | `role="alert"` + `aria-live="assertive"` | Für Screenreader | +| Navigation | `aria-label` auf `