refactor: remove duplicate ClientSidebar component
Bug fix: Dubbele sidebar verwijderd in patient detail routes. ClientSidebar was een duplicate van EPDSidebar's Level 2 navigatie. EPDSidebar is al context-aware en switcht automatisch tussen Level 1 (behandelaar context) en Level 2 (patient context) navigatie. Changes: - Removed: ClientSidebar component (117 lines duplicate code) - Removed: EPDLayoutClient wrapper (conditional sidebar hiding) - Simplified: Patient detail layout uses only PatientLayoutClient - Restored: EPD layout to direct EPDSidebar rendering Result: Single sidebar component, -117 lines code, DRY principle restored 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ export default async function EPDLayout({ children }: EPDLayoutProps) {
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 flex">
|
||||
{/* Sidebar - Fixed 240px width on desktop */}
|
||||
{/* Sidebar - Context-aware (switches between Level 1 and Level 2) */}
|
||||
<EPDSidebar
|
||||
userEmail={user?.email}
|
||||
userName={user?.user_metadata?.full_name}
|
||||
@@ -33,9 +33,7 @@ export default async function EPDLayout({ children }: EPDLayoutProps) {
|
||||
|
||||
{/* Page Content - Scrollable */}
|
||||
<main className="flex-1 overflow-auto bg-white">
|
||||
<div className="p-8">
|
||||
{children}
|
||||
</div>
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
'use client';
|
||||
|
||||
/**
|
||||
* Client Sidebar Navigation Component
|
||||
* E2.S3: Context-aware sidebar with tabs for client dossier
|
||||
*/
|
||||
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import {
|
||||
ChevronLeft,
|
||||
LayoutDashboard,
|
||||
User,
|
||||
ClipboardList,
|
||||
FileText,
|
||||
Stethoscope,
|
||||
Calendar,
|
||||
FileBarChart,
|
||||
} from 'lucide-react';
|
||||
|
||||
interface ClientSidebarProps {
|
||||
patientId: string;
|
||||
}
|
||||
|
||||
interface NavItem {
|
||||
label: string;
|
||||
href: string;
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
}
|
||||
|
||||
export function ClientSidebar({ patientId }: ClientSidebarProps) {
|
||||
const pathname = usePathname();
|
||||
|
||||
// Navigation items
|
||||
const navItems: NavItem[] = [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
href: `/epd/patients/${patientId}`,
|
||||
icon: LayoutDashboard,
|
||||
},
|
||||
{
|
||||
label: 'Basisgegevens',
|
||||
href: `/epd/patients/${patientId}/basisgegevens`,
|
||||
icon: User,
|
||||
},
|
||||
{
|
||||
label: 'Screening',
|
||||
href: `/epd/patients/${patientId}/screening`,
|
||||
icon: ClipboardList,
|
||||
},
|
||||
{
|
||||
label: 'Intake',
|
||||
href: `/epd/patients/${patientId}/intakes`,
|
||||
icon: FileText,
|
||||
},
|
||||
{
|
||||
label: 'Diagnose',
|
||||
href: `/epd/patients/${patientId}/diagnose`,
|
||||
icon: Stethoscope,
|
||||
},
|
||||
{
|
||||
label: 'Behandelplan',
|
||||
href: `/epd/patients/${patientId}/behandelplan`,
|
||||
icon: Calendar,
|
||||
},
|
||||
{
|
||||
label: 'Rapportage',
|
||||
href: `/epd/patients/${patientId}/rapportage`,
|
||||
icon: FileBarChart,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<aside className="w-64 bg-white border-r border-slate-200 flex flex-col">
|
||||
{/* Back to Patients */}
|
||||
<div className="p-4 border-b border-slate-200">
|
||||
<Link
|
||||
href="/epd/patients"
|
||||
className="inline-flex items-center gap-2 text-sm text-slate-600 hover:text-slate-900 transition-colors group"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4 group-hover:-translate-x-1 transition-transform" />
|
||||
<span className="font-medium">Cliënten</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* Navigation Items */}
|
||||
<nav className="flex-1 p-4 space-y-1">
|
||||
{navItems.map((item) => {
|
||||
const Icon = item.icon;
|
||||
// Special handling for Intake tab: active when on /intakes or /intakes/[id]
|
||||
const isActive = item.href.includes('/intakes')
|
||||
? pathname.startsWith(`/epd/patients/${patientId}/intakes`)
|
||||
: pathname === item.href;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={`
|
||||
flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors
|
||||
${
|
||||
isActive
|
||||
? 'bg-teal-50 text-teal-700 border border-teal-200'
|
||||
: 'text-slate-700 hover:bg-slate-50 hover:text-slate-900'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span>{item.label}</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -10,3 +10,18 @@
|
||||
- Intake-tabs (contact, kindcheck, risico, anamnese, onderzoeken/ROM, diagnose, behandeladvies) compleet met Supabase CRUD
|
||||
- Status dropdowns gecorrigeerd (bezig/afgerond) en dokument flows afgerond
|
||||
- Supabase migratiestappen wachten nog op einde maintenance (fase 0 runbook ligt klaar)
|
||||
|
||||
## 2025-11-23 — Universele Rapportage backend + modal (Colin)
|
||||
- API: `/api/reports` (GET/POST) + `/api/reports/[reportId]` (GET/PATCH/DELETE) + `/api/reports/classify` staan, met Zod-validatie en soft delete
|
||||
- Supabase: `reports` tabel + migratie + RLS policies uitgerold, types toegevoegd in `lib/supabase/database.types.ts`
|
||||
- Server actions: `app/epd/patients/[id]/rapportage/actions.ts` + gedeelde `lib/server/api-client.ts` houden fetch logic DRY
|
||||
- UI: shadcn-dialog gebaseerd Rapportage Modal met textarea, speech recorder, AI-analyse en save flow (E2.S1)
|
||||
|
||||
## 2025-11-23 — ClientSidebar duplicate cleanup (Colin)
|
||||
- **Bug fix**: Dubbele sidebar (EPDSidebar + ClientSidebar) in patient detail routes verwijderd
|
||||
- ClientSidebar (`app/epd/patients/[id]/components/client-sidebar.tsx`) blijkt 100% duplicate van EPDSidebar Level 2 navigatie
|
||||
- EPDSidebar is al context-aware: detecteert patient routes en switcht automatisch tussen Level 1 (behandelaar) en Level 2 (patient) navigatie
|
||||
- Verwijderd: ClientSidebar component (117 regels) + EPDLayoutClient wrapper (conditionele sidebar hiding)
|
||||
- Vereenvoudigd: patient detail layout gebruikt nu alleen PatientLayoutClient zonder eigen sidebar rendering
|
||||
- Resultaat: Eén sidebar component die automatisch switcht, -117 regels duplicate code, DRY principle hersteld
|
||||
|
||||
|
||||
Reference in New Issue
Block a user