'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { ChevronLeft, MessageSquare, AlertCircle, Users } from 'lucide-react' import { addHours } from 'date-fns' import { Card, Button, showToast } from '@/components/ui' import { Header, PageContainer } from '@/components/layout/header' import { useApp } from '../../provider' const CATEGORIES = [ { value: 'GENERAL', label: 'General Update', emoji: 'šŸ“', color: 'bg-blue-100 border-blue-200' }, { value: 'SYMPTOM', label: 'Symptom Observation', emoji: '😷', color: 'bg-red-50 border-red-200' }, { value: 'MEDICATION', label: 'Medication Note', emoji: 'šŸ’Š', color: 'bg-green-50 border-green-200' }, { value: 'MOOD', label: 'Mood/Energy', emoji: 'šŸ’­', color: 'bg-purple-50 border-purple-200' }, ] const PRIORITIES = [ { value: 'LOW', label: 'FYI Only' }, { value: 'NORMAL', label: 'Normal' }, { value: 'HIGH', label: 'Important - Please Read', color: 'text-red-600' }, ] export default function NewHandoffNotePage() { const router = useRouter() const { currentWorkspace } = useApp() const [content, setContent] = useState('') const [category, setCategory] = useState('GENERAL') const [priority, setPriority] = useState('NORMAL') const [expiresIn, setExpiresIn] = useState('12') const [saving, setSaving] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (!content.trim()) { showToast('Please write a note', 'error') return } setSaving(true) try { const expiresAt = addHours(new Date(), parseInt(expiresIn)) const response = await fetch(`/api/workspaces/${currentWorkspace.id}/handoff-notes`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content: content.trim(), category, priority, expiresAt: expiresAt.toISOString(), }), }) if (!response.ok) throw new Error('Failed to create note') showToast('Handoff note added!', 'success') router.push('/care') } catch { showToast('Failed to add note', 'error') } finally { setSaving(false) } } return ( <>
, label: 'Back', onClick: () => router.push('/care') }} /> {/* Info Card */}

What are handoff notes?

Use these to communicate with other caregivers. They expire after a set time and can be marked as read.

{/* Category */}
{CATEGORIES.map((cat) => ( ))}
{/* Priority */} {/* Content */}