Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/Home/Calendar/CalendarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const CalendarComponent = ({ schedule, setSelectedDate }: ScheduleCalendarProps)
const highlightedDays = useMemo(() => computeHighlightedDays(schedule), [schedule])
const timeRange = useMemo(() => computeTimeRange(schedule, '08:00:00', '22:00:00'), [schedule])

const eventOrder = (a: Task, b: Task): number => {
const priorityMap = { high: 3, medium: 2, low: 1 }
return priorityMap[b.priority] - priorityMap[a.priority]
}

return (
<Box sx={calendarStyles}>
<FullCalendar
Expand All @@ -47,6 +52,7 @@ const CalendarComponent = ({ schedule, setSelectedDate }: ScheduleCalendarProps)
right: 'dayGridMonth,timeGridWeek',
}}
events={highlightedDays}
eventOrder={eventOrder as (a: any, b: any) => number}
editable
selectable
height="auto"
Expand Down
15 changes: 8 additions & 7 deletions src/components/Home/Calendar/TaskInputDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ const TaskInputDialog = ({
const [actionHappening, setActionHappening] = useState(false)

const handleTaskSubmitted = useCallback(async () => {
const taskId = await generateUniqueId([
state.title,
state.description,
state.category,
state.priority,
])
dispatch({
type: 'SET_FIELD',
field: 'taskId',
value: await generateUniqueId([
state.title,
state.description,
state.category,
state.priority,
]),
value: taskId,
})

const newTask: Task = {
Expand All @@ -59,7 +60,7 @@ const TaskInputDialog = ({
setActionHappening(true)
if (action === 'Add') {
const addTask = useScheduleStore.getState().addTask
await addTask(newTask)
await addTask({ ...newTask, taskId })
}
else if (action === 'Edit') {
const updateTask = useScheduleStore.getState().updateTask
Expand Down