to do calendar view

This commit is contained in:
2025-07-07 17:45:33 -04:00
parent de40c78f47
commit 5143be1a67
13 changed files with 225 additions and 26 deletions

View File

@@ -0,0 +1,35 @@
import FullCalendar from '@fullcalendar/react'
import dayGridPlugin from '@fullcalendar/daygrid' // a plugin!
import type { EventInput } from '@fullcalendar/core'
interface EventTodo {
id: string
name: string
complete: boolean
dueDate?: string | null
notes?: string | null
eventId: string
createdAt: string
updatedAt: string
}
export default function EventTaskCalendar({ todos }: { todos: EventTodo[] }) {
const calendarEvents: EventInput[] = todos
.filter(todo => !!todo.dueDate)
.map(todo => ({
id: todo.id,
title: todo.name,
start: todo.dueDate as string,
backgroundColor: todo.complete ? '#9ae6b4' : '#fbd38d',
borderColor: todo.complete ? '#38a169' : '#dd6b20',
allDay: true,
}))
return (
<FullCalendar
plugins={[ dayGridPlugin ]}
initialView="dayGridMonth"
height={650}
events={calendarEvents}
/>
)
}