diff --git a/apps/web/app/(dashboard)/canvas/page.tsx b/apps/web/app/(dashboard)/canvas/page.tsx index 988b6f4..ae83e5e 100644 --- a/apps/web/app/(dashboard)/canvas/page.tsx +++ b/apps/web/app/(dashboard)/canvas/page.tsx @@ -58,6 +58,7 @@ interface Canvas { function CanvasBoard({ canvas, onBack }: { canvas: Canvas; onBack: () => void }) { const [cards, setCards] = useState(canvas.cards || []); + const [connections] = useState(canvas.connections || []); const [dragging, setDragging] = useState(null); const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 }); const [viewport, setViewport] = useState(canvas.viewport || { x: 0, y: 0, zoom: 1 }); @@ -252,7 +253,7 @@ function CanvasBoard({ canvas, onBack }: { canvas: Canvas; onBack: () => void }) > {/* Connections */} - {canvas.connections.map((conn) => { + {connections.map((conn) => { const source = cards.find((c) => c.id === conn.source_card_id); const target = cards.find((c) => c.id === conn.target_card_id); if (!source || !target) return null; diff --git a/apps/web/components/calendar/big-calendar-wrapper.tsx b/apps/web/components/calendar/big-calendar-wrapper.tsx index 92c55a5..4c6abc7 100644 --- a/apps/web/components/calendar/big-calendar-wrapper.tsx +++ b/apps/web/components/calendar/big-calendar-wrapper.tsx @@ -129,7 +129,7 @@ export function BigCalendarWrapper({ eventPropGetter={eventStyleGetter} onSelectEvent={handleSelectEvent} views={['month', 'week', 'day']} - defaultView={defaultView} + view={defaultView} date={date} onNavigate={handleNavigate} onView={handleViewChange} diff --git a/apps/web/components/dashboard/widgets/quick-capture-widget.tsx b/apps/web/components/dashboard/widgets/quick-capture-widget.tsx index cd1f144..abd37e4 100644 --- a/apps/web/components/dashboard/widgets/quick-capture-widget.tsx +++ b/apps/web/components/dashboard/widgets/quick-capture-widget.tsx @@ -6,13 +6,12 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; -import { useRouter } from 'next/navigation'; +import { toast } from 'sonner'; export function QuickCaptureWidget() { const [type, setType] = useState('task'); const [title, setTitle] = useState(''); const [submitting, setSubmitting] = useState(false); - const router = useRouter(); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); @@ -20,34 +19,22 @@ export function QuickCaptureWidget() { setSubmitting(true); try { - const endpoint = type === 'task' ? '/api/tasks' - : type === 'habit' ? '/api/habits' - : '/api/notes'; - - const body: Record = { title: title.trim() }; - if (type === 'task') { - body.status = 'todo'; - body.priority = 'medium'; - } - if (type === 'habit') { - body.name = title.trim(); - delete body.title; - body.frequency = 'daily'; - body.difficulty = 'medium'; - } - - const res = await fetch(endpoint, { + const res = await fetch('/api/quick-capture', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(body), + body: JSON.stringify({ type, text: title.trim() }), }); if (res.ok) { setTitle(''); - router.refresh(); + toast.success(type.charAt(0).toUpperCase() + type.slice(1) + ' created'); + } else { + const err = await res.json().catch(() => ({ error: 'Unknown error' })); + toast.error(err.error || 'Failed to create'); } } catch (err) { console.error('Quick capture failed:', err); + toast.error('Failed to create'); } finally { setSubmitting(false); } @@ -71,6 +58,7 @@ export function QuickCaptureWidget() { Task Habit Note + Project -