'use client'; /** * Recent Strip * * Shows last 5 actions as clickable chips for quick repeat. * Height: 48px (h-12) */ import { useSwiftStore, type SwiftIntent } from '@/stores/swift-store'; import { FileText, Search, ArrowRightLeft, HelpCircle, Clock } from 'lucide-react'; const INTENT_CONFIG: Record = { dagnotitie: { icon: FileText, color: 'text-blue-400 bg-blue-400/10', label: 'Notitie' }, zoeken: { icon: Search, color: 'text-emerald-400 bg-emerald-400/10', label: 'Zoeken' }, overdracht: { icon: ArrowRightLeft, color: 'text-purple-400 bg-purple-400/10', label: 'Overdracht' }, unknown: { icon: HelpCircle, color: 'text-slate-400 bg-slate-400/10', 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 } = useSwiftStore(); const handleActionClick = (action: typeof recentActions[0]) => { // Set the input to repeat the action setInputValue(action.label); // If it's a known intent, open the block directly if (action.intent !== 'unknown') { 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:
)}
); }