Commit Graph

30 Commits

Author SHA1 Message Date
colinislit
00ca026382 fix: stabilize build and archive configs 2025-11-23 11:42:40 +01:00
colinislit
6fcb9a0e7b feat: migrate clients module to patients + add docs 2025-11-23 10:13:00 +01:00
colinislit
123ee14461 chore: self-host fonts and log ops fixes 2025-11-23 09:55:46 +01:00
colinislit
9dac485e8e feat: implement client header and navigation (E2.S3)
Epic 2 - Cliëntenbeheer: Complete Level 2 navigation structure with
context-aware header and sidebar for patient dossier.

E2.S3 - Cliënt Header & Nav:
- Create ClientHeader component showing:
  * Full patient name with prefix support
  * Color-coded status badge (screening/actief/afgerond/afgemeld)
  * Last modified timestamp (Dutch format)
  * John Doe indicator badge
  * Patient ID (subtle display)
- Create ClientSidebar navigation component with:
  * Back button to patient list
  * Navigation items for all tabs (always visible)
  * Active state highlighting
  * Icon support for each tab
- Create patient detail layout wrapper:
  * Combines header and sidebar
  * Full-height flex layout
  * Scrollable main content area
- Update patient detail page to dashboard view:
  * Quick action cards for Basisgegevens, Screening, Intake
  * Next steps guide for workflow
  * Remove old edit-only view
- Create Basisgegevens tab page:
  * Patient form for editing
  * John Doe warning for incomplete registrations
  * Pre-populated with existing data
- Create placeholder pages for future epics:
  * Screening (Epic 3)
  * Intake (Epic 4)
  * Diagnose (Epic 6)
  * Behandelplan (future)
  * Rapportage (future)

Technical implementation:
- app/epd/patients/[id]/components/client-header.tsx: New
- app/epd/patients/[id]/components/client-sidebar.tsx: New
- app/epd/patients/[id]/layout.tsx: New
- app/epd/patients/[id]/page.tsx: Completely rewritten as dashboard
- app/epd/patients/[id]/basisgegevens/page.tsx: New
- app/epd/patients/[id]/screening/page.tsx: New placeholder
- app/epd/patients/[id]/intake/page.tsx: New placeholder
- app/epd/patients/[id]/diagnose/page.tsx: New placeholder
- app/epd/patients/[id]/behandelplan/page.tsx: New placeholder
- app/epd/patients/[id]/rapportage/page.tsx: New placeholder
- docs/specs/screening-intake/bouwplan-screening-intake-v1.0.md: Updated

Epic 2 is now complete with all 3 stories implemented!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 14:09:16 +01:00
colinislit
88440b7ac8 feat(intake): implement epic 4 intake core (overview, new flow, layout) 2025-11-22 14:03:22 +01:00
colinislit
86995a4466 feat: implement patient list and new patient form (E2.S1 & E2.S2)
Epic 2 - Cliëntenbeheer: Complete implementation of patient list with
search/filter functionality and comprehensive new patient form with
John Doe crisis admission support.

E2.S1 - Cliëntenlijst:
- Add client-side search bar with form submission
- Implement status filter dropdown (all/screening/active/finished/cancelled)
- Create StatusBadge component with color-coded status indicators
- Update table columns: Status, Name, BSN, Last Updated
- Add status filtering support to FHIR Patient API route
- Update FHIR patient transform to include episode-status extension
- Sort patients by updated_at descending (newest first)

E2.S2 - Nieuwe Cliënt Flow:
- Complete rewrite of patient form with all FO-required fields
- Implement John Doe checkbox with conditional BSN requirement
- Add BSN validation with Dutch Modulo-11 check algorithm
- Add comprehensive form fields:
  * Name fields: prefix, given name, family name
  * BSN with 9-digit pattern validation
  * Birth date with max date validation
  * Gender selection
  * Address: street, postal code, city
  * Contact: phone, email
  * Insurance: company, policy number
- Add warning messages for John Doe crisis admissions
- Set default episode status to 'planned' for all new patients
- Redirect to patient detail page after successful creation
- Update FHIR transform bidirectional insurance extension support:
  * dbPatientToFHIR: serialize insurance to JSON extension
  * fhirPatientToDB: parse insurance from JSON extension
- Pre-populate form fields when editing existing patients

Technical changes:
- app/api/fhir/Patient/route.ts: Add status query param and sorting
- app/epd/patients/actions.ts: Add status filter parameter
- app/epd/patients/page.tsx: Pass status searchParam
- app/epd/patients/components/patient-list.tsx: Complete UI rewrite
- app/epd/patients/components/patient-form.tsx: Complete form rewrite
- lib/fhir/transforms/patient.ts: Add insurance extension handling
- docs/specs/screening-intake/bouwplan-screening-intake-v1.0.md: Update status

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 13:58:31 +01:00
colinislit
4caab6a8ca feat: screening & intake database schema (Epic 1)
Implements complete database schema for screening and intake workflow:

Database additions:
- 7 new tables: screenings, screening_activities, screening_documents,
  intakes, anamneses, examinations, risk_assessments
- Extended patients table with status (episode_status) and is_john_doe
- Extended encounters table with intake_id for linking
- Extended care_plans with intake reference columns

Architecture:
- Separate tables for reusable content (anamneses, examinations, risk_assessments)
- JSONB fields for context-bound data (kindcheck_data, treatment_advice)
- RLS policies, indexes, and updated_at triggers on all new tables
- Helper view: active_intakes_overview

Generated TypeScript types from schema for type-safe database access.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 13:45:37 +01:00
colinislit
3cb60e6a0b security 2025-11-22 08:20:58 +01:00
colinislit
d5c6cf208b FHIR, API, datamodel 2025-11-21 22:32:29 +01:00
colinislit
e2a4fc68b7 fix: resolve webpack module resolution error with wrapper component
Root cause analysis:
- Next.js 16 Server/Client Component boundary issue
- Webpack module chunking fails with named exports from Client Components
- Error: "Cannot read properties of undefined (reading 'call')"

Solution:
- Created release-sidebar-wrapper.tsx to isolate import boundary
- Server Component (layout.tsx) now imports via wrapper
- Wrapper uses default export, which webpack handles better

Technical details:
- Server Component -> direct import -> Client Component = module undefined
- Wrapper component breaks the problematic import chain
- Default exports handle webpack chunking more reliably than named exports

Documentation:
- Added comprehensive troubleshooting guide
- Documents 4 solution approaches
- Lists best practices to prevent future occurrences
- Identifies other potential problem areas in codebase

Files changed:
- app/(marketing)/releases/layout.tsx (import via wrapper)
- app/(marketing)/releases/components/release-sidebar-wrapper.tsx (new)
- docs/troubleshooting/webpack-module-resolution-error.md (new)

Related: This is a known Next.js 15-16 issue with Server/Client boundaries
2025-11-19 21:41:10 +01:00
colinislit
8e08cdc09f refactor: rename 'Releases' to 'Documentatie'
Changed terminology from release notes to feature documentation
to better reflect the continuous build-in-public approach.

Changes:
- Navigation: "Releases" → "Documentatie"
- Page titles: "Release Notes" → "Feature Documentatie"
- Metadata descriptions updated
- Timeline link text updated
- Sidebar heading updated
- Template and example docs updated

The /releases route remains the same for stability,
but all user-facing text now says "Documentatie".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 21:18:32 +01:00
colinislit
f8904db3e9 fix: resolve MDX type imports for release notes
Fixed runtime error in release notes pages:
- Removed unused MDXRemote import from lib/mdx/releases.ts
- Fixed MDXComponents type import in mdx-components.tsx
- Added @types/mdx as dev dependency

Pages now load correctly:
- /releases (overview)
- /releases/authentication
- /releases/release-notes-system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 21:16:45 +01:00
colinislit
78e3019063 Epic 1: Implement two-level EPD layout and navigation
Implemented complete two-level navigation system with context-aware
sidebar and header components.

## Changes

### Layout (E1.S1)
- Add fixed header (60px) to EPD layout
- Maintain fixed sidebar (240px)
- Add scrollable main content area with padding

### Context-Aware Sidebar (E1.S2)
- Level 1 (Behandelaar): Dashboard | Cliënten | Agenda | Rapportage
- Level 2 (Client Dossier): ← Cliënten | Dashboard | Intake | Diagnose | Behandelplan | Rapportage
- URL-based context detection (/epd/clients/[id])
- Dynamic menu switching with back button in Level 2

### Context-Aware Header (E1.S3)
- Logo left, search right (both levels)
- Client selector center (Level 2 only)
- Shows client name, ID, and birthdate
- Dropdown icon for future client switching

### Routes & Placeholders (E1.S4)
- Level 1: /epd/dashboard, /epd/agenda, /epd/reports
- Level 2: /epd/clients/[id]/intake, diagnose, plan, reports
- All placeholder pages with clear Epic indicators

### Documentation
- Add comprehensive bouwplan: docs/specs/UI/bouwplan-mini-epd-v1.0.md
- 7 Epics with detailed stories and tech notes

### Fixes
- Fix MDX component type import for build

🚀 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 21:03:43 +01:00
colinislit
2ae7b37e5f feat: add release notes page with MDX content system
Implemented comprehensive release notes feature with:

- MDX-based content system for easy release note authoring
- Thematic sidebar navigation (Foundation, Features, Infrastructure)
- Auto-generated pages from MDX frontmatter
- Overview page with status filtering (completed/in_progress/planned)
- Detail pages with custom MDX components
- Mobile-responsive navigation (horizontal scroll tabs)
- Integration with timeline (link to detailed release notes)
- Added "Releases" link to header navigation

Technical implementation:
- next-mdx-remote for MDX parsing and rendering
- gray-matter for frontmatter extraction
- Custom MDX components for images, code blocks, typography
- Static site generation (SSG) for performance
- Template system for consistent release note structure

Files added:
- app/(marketing)/releases/ - Route structure and components
- content/nl/releases/ - MDX content files and index
- lib/mdx/releases.ts - MDX utility functions
- docs/specs/releasepage/ - Build plan documentation
- docs/templates/release-note-template.mdx - Content template

First release note: authentication.mdx (login, signup, password reset)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 20:59:54 +01:00
colinislit
501d8de22b UI specs 2025-11-19 19:50:20 +01:00
colinislit
44cf93805b gitignore 2025-11-19 16:23:27 +01:00
colinislit
74436dad08 tokenhash parameter 2025-11-19 14:23:54 +01:00
colinislit
d32b47407b callback routes 2025-11-19 12:22:52 +01:00
colinislit
9dd129c258 docs: improve auth flow documentation and fix email confirmation redirect
**Auth Callback Improvements:**
- Fix default redirect from /clients to /epd/clients (correct route)
- Add smart detection for password vs magic link users
- Password signup users now go directly to /epd/clients after email confirmation
- Magic link users still get optional /set-password page

**Documentation:**
- Add comprehensive AUTH_FLOW_EXPLAINED.md with step-by-step flow diagrams
- Update RELEASE_AUTH_IMPROVEMENTS.md with magic link migration instructions
- Update emails/README.md with aispeedrun.nl redirect URL configuration
- Document Site URL vs Redirect URLs difference
- Add troubleshooting for common issues (localhost in emails, invalid redirect)

**Key Changes:**
- Email confirmation now correctly redirects password users to EPD
- Clear instructions for Supabase configuration (Site URL + Redirect URLs)
- Both development and production URLs documented for dual environment support

All documentation includes practical examples and FAQ section.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 11:38:57 +01:00
colinislit
2fcf609e27 feat: enhance authentication UX with password visibility toggle and better error messages
Added comprehensive improvements to the login and authentication flow:

**UI Improvements:**
- Add password visibility toggle (Eye/EyeOff icons) for password fields
- Improve error message consistency with Dutch translations
- Fix syntax error in login page try-catch block

**Error Handling:**
- Add user-friendly error messages for invalid credentials
- Add specific error codes: invalid_credentials, email_not_confirmed
- Improve error message for non-existent accounts during login
- Handle duplicate email detection during signup with auto-switch to login mode

**Middleware:**
- Add /reset-password and /update-password to public routes
- Fix redirect issue preventing access to password reset flow

**Password Reset Flow:**
- Verify password reset works for magic link users (can set initial password)
- Ensure existing password users can reset their password
- Both flows use the same update mechanism via Supabase

**Documentation:**
- Add comprehensive release notes in docs/RELEASE_AUTH_IMPROVEMENTS.md

All changes maintain backward compatibility with existing magic link users.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 11:24:28 +01:00
colinislit
2505b27437 feat: add duplicate email detection via auth hook with fallback
- Add before-user-created hook function for server-side duplicate email detection
- Implement fallback detection using identities array check (Supabase limitation)
- Update signUpWithPassword to detect duplicate emails via hook errors or empty identities
- Add error handling in login page to show duplicate email errors and auto-switch to login mode
- Add auth hook setup documentation and test scripts
- Add password reset and update password flows
- Add email templates for signup confirmation and password reset
2025-11-19 11:03:46 +01:00
colinislit
114e7d200d specs login 2025-11-18 16:50:17 +01:00
colinislit
d4079b66c5 hero-section, start login 2025-11-18 13:55:16 +01:00
colinislit
273c00f9e8 Epic 2: Design System Migration - Teal-first implementatie
 E2.S1: Tailwind config update
- Teal-700 (#0F766E) als PRIMARY brand color (5.47:1 contrast)
- Amber-600→700 gradient voor AI features
- Updated ring color naar teal-700 voor WCAG AA

 E2.S2: Global CSS variables
- --color-brand → teal-700 (was blue-600)
- --color-info → teal-700 (was blue-500)
- --color-input-focus → teal-700 (was blue-500)
- --color-ai toegevoegd → amber-600

 E2.S3: Component color updates
- components/ui/sign-in.tsx: Alle blue → teal
- components/ui/timeline.tsx: Gradient blue → teal
- components/ui/reading-progress.tsx: Progress bar blue → teal
- components/ui/modern-side-bar.tsx: Logo, active states blue → teal

 E2.S4: AIButton component
- Nieuw component: components/ui/ai-button.tsx
- Amber-600→700 gradient voor WCAG compliance
- 3 variants: default, outline, ghost
- Loading state + Sparkles icon
- Fully accessible (WCAG AA focus states)

 E2.S5: Contrast testing
- scripts/test-contrast.ts: Automated WCAG testing
- docs/design/wcag-compliance.md: Compliance documentatie
- Resultaten: 7/11 AA Normal (4.5:1), 11/11 AA Large (3:1) 

WCAG AA Compliance:  PASS
- Teal-700 op wit: 5.47:1 (AA Normal)
- White op teal-700: 5.47:1 (AA Normal)
- White op amber-600: 3.19:1 (AA Large - OK voor buttons)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 17:38:22 +01:00
colinislit
1591e3271a new ux start 2025-11-17 17:24:35 +01:00
colinislit
99804656d7 RLS policies implementeren, Demo auth flow 2025-11-15 23:59:38 +01:00
colinislit
690e7b7c43 Content loader utility, Content directory structuur 2025-11-15 22:06:48 +01:00
colinislit
dbde412465 bouwplan templates 2025-11-11 09:28:46 +01:00
colinislit
530b8f1bdb eerste commit 2025-11-09 15:43:41 +01:00
colinislit
223161463f Initial commit from Create Next App 2025-11-09 14:21:31 +01:00