Adds profile and settings pages

This commit is contained in:
2026-06-22 23:59:04 +02:00
parent 6976eb4337
commit 2544e20b3c
49 changed files with 2741 additions and 34 deletions
@@ -0,0 +1,81 @@
# Unit 6 Code Generation Summary
## Overview
Unit 6 implements Profile, Settings, CMS placeholder, and error pages (403/404) for the CMS Frontend.
## Migration Check
**No EF Core migration required.** All backend changes in Steps 15 operate on existing columns in the `AspNetUsers` table managed by ASP.NET Identity (`UserName`, `NormalizedUserName`, `Email`, `NormalizedEmail`, `PasswordHash`). No new `DbSet<>` entries or schema columns were introduced.
---
## Files Created or Modified
### Backend — Core
| File | Change |
|------|--------|
| `src/SlpModularCms.Core/Identity/Models/IdentityRequests.cs` | Added `UpdateProfileRequest` and `ChangePasswordRequest` records |
| `src/SlpModularCms.Core/Identity/Services/IAuthService.cs` | Added `ChangePasswordAsync` method signature |
| `src/SlpModularCms.Core/Identity/Services/AuthService.cs` | Implemented `ChangePasswordAsync` using `UserManager.ChangePasswordAsync` |
### Backend — Modules.Identity
| File | Change |
|------|--------|
| `src/SlpModularCms.Modules.Identity/Controllers/AuthController.cs` | Added `POST /api/v1/Auth/change-password` endpoint |
| `src/SlpModularCms.Modules.Identity/Controllers/UsersController.cs` | Added `PUT /api/v1/Users/me` endpoint for profile self-update |
### Frontend — API hooks
| File | Change |
|------|--------|
| `frontend/src/api/useProfile.ts` | **Created**`useUpdateProfile()` and `useChangePassword()` hooks |
| `frontend/src/api/useAvailability.ts` | Extended with `useUpdateAvailability()` mutation |
### Frontend — MSW mocks
| File | Change |
|------|--------|
| `frontend/src/mocks/users/handlers.ts` | Added `PUT /api/v1/Users/me` mock handler |
| `frontend/src/mocks/auth/handlers.ts` | Added `POST /api/v1/Auth/change-password` mock handler |
### Frontend — i18n
| File | Change |
|------|--------|
| `frontend/src/i18n/locales/en/translation.json` | Added `profile`, `settings`, `cms`, `error` key groups |
| `frontend/src/i18n/locales/nl/translation.json` | Added Dutch translations for all new key groups |
### Frontend — Pages
| File | Change |
|------|--------|
| `frontend/src/pages/ProfilePage.tsx` | **Replaced stub** — full implementation with ProfileInfoForm, RoleDisplay badge, ChangePasswordDialog |
| `frontend/src/pages/SettingsPage.tsx` | **Replaced stub** — full implementation with availability selector + 3 placeholder cards |
| `frontend/src/pages/CmsPage.tsx` | **Replaced stub** — enhanced placeholder with LayoutGrid icon |
| `frontend/src/pages/AccessDeniedPage.tsx` | **Created** — 403 page with ShieldOff icon and back button |
| `frontend/src/pages/NotFoundPage.tsx` | **Created** — 404 catch-all page with FileQuestion icon and back button |
### Frontend — Router
| File | Change |
|------|--------|
| `frontend/src/router.tsx` | Added `/403` (`accessDeniedRoute`) and `$` catch-all (`notFoundRoute`) routes |
### Frontend — Tests
| File | Coverage |
|------|----------|
| `frontend/src/pages/ProfilePage.test.tsx` | Renders, pre-fill, save disabled when pristine, save enabled after edit, save success, email validation, dialog open, wrong password error, auth redirect |
| `frontend/src/pages/SettingsPage.test.tsx` | Renders, status badge, mode buttons, mode selection, save success, save error, placeholder sections, auth redirect |
| `frontend/src/pages/CmsPage.test.tsx` | Renders title and placeholder, auth redirect |
| `frontend/src/pages/AccessDeniedPage.test.tsx` | Renders title, message, back button, navigation |
| `frontend/src/pages/NotFoundPage.test.tsx` | Renders for unknown routes, back button, navigation |
---
## i18n Completeness
All `t('...')` calls in the new pages and hooks have corresponding keys in both `en/translation.json` and `nl/translation.json`. No orphaned keys.