'use client'; /** * Recent Strip * * Shows last 5 actions as clickable chips for quick repeat. * Height: 48px (h-12) */ import { useCortexStore, type CortexIntent } from '@/stores/cortex-store'; import { FileText, Search, ArrowRightLeft, HelpCircle, Clock, Calendar, Plus, X, ClipboardList, AlertTriangle, Stethoscope, Navigation, UserX, } from 'lucide-react'; const INTENT_CONFIG: Record = { dagnotitie: { icon: FileText, color: 'text-blue-600 bg-blue-50 border border-blue-200', label: 'Notitie' }, zoeken: { icon: Search, color: 'text-emerald-600 bg-emerald-50 border border-emerald-200', label: 'Zoeken' }, overdracht: { icon: ArrowRightLeft, color: 'text-purple-600 bg-purple-50 border border-purple-200', label: 'Overdracht' }, agenda_query: { icon: Calendar, color: 'text-teal-600 bg-teal-50 border border-teal-200', label: 'Agenda' }, create_appointment: { icon: Plus, color: 'text-green-600 bg-green-50 border border-green-200', label: 'Afspraak' }, cancel_appointment: { icon: X, color: 'text-red-600 bg-red-50 border border-red-200', label: 'Annuleren' }, reschedule_appointment: { icon: Clock, color: 'text-amber-600 bg-amber-50 border border-amber-200', label: 'Verzetten' }, // Intake intents (MVP) intake_status: { icon: ClipboardList, color: 'text-cyan-600 bg-cyan-50 border border-cyan-200', label: 'Status' }, intake_navigeer: { icon: Navigation, color: 'text-indigo-600 bg-indigo-50 border border-indigo-200', label: 'Navigeer' }, risico_query: { icon: AlertTriangle, color: 'text-orange-600 bg-orange-50 border border-orange-200', label: 'Risico' }, diagnose_query: { icon: Stethoscope, color: 'text-rose-600 bg-rose-50 border border-rose-200', label: 'Diagnose' }, // No Show casus register_no_show: { icon: UserX, color: 'text-red-600 bg-red-50 border border-red-200', label: 'No Show' }, unknown: { icon: HelpCircle, color: 'text-slate-600 bg-slate-50 border border-slate-200', label: 'Actie' }, }; function formatRelativeTime(date: Date): string { const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffMins = Math.floor(diffMs / 60000); if (diffMins < 1) return 'zojuist'; if (diffMins < 60) return `${diffMins}m`; const diffHours = Math.floor(diffMins / 60); if (diffHours < 24) return `${diffHours}u`; return `${Math.floor(diffHours / 24)}d`; } export function RecentStrip() { const { recentActions, setInputValue, openBlock, activePatient } = useCortexStore(); const handleActionClick = (action: typeof recentActions[0]) => { // Set the input to repeat the action setInputValue(action.label); // Skip 'unknown' intent if (action.intent === 'unknown') return; // intake_navigeer is navigation-only (no block) if (action.intent === 'intake_navigeer') { // For navigation, we need patient context // TODO: Implement navigation when patient + intake context is available console.log('[RecentStrip] intake_navigeer - navigation not yet implemented'); return; } // Open the block for other intents openBlock(action.intent, { patientName: action.patientName, }); }; return (
{/* Label */}
Recent
{/* Divider */}
{/* Actions */} {recentActions.length === 0 ? ( Nog geen acties ) : (
{recentActions.map((action) => { const config = INTENT_CONFIG[action.intent]; const Icon = config.icon; return ( ); })}
)} {/* Quick actions hint (when empty) */} {recentActions.length === 0 && (
Probeer:
)}
); }