diff --git a/src/pages/profile_calendar.tsx b/src/pages/profile_calendar.tsx index ab19252..7d715d1 100644 --- a/src/pages/profile_calendar.tsx +++ b/src/pages/profile_calendar.tsx @@ -296,12 +296,29 @@ const ProfileCalendar: FunctionComponent = () => { }, [tags]); const tasksCount = (date: CalendarDateTemplateEvent) => { - return tasks.filter((task) => { + const filterTasks = tasks.filter((task) => { const taskDate = task.date; return ( taskDate.getDate() === date.day && taskDate.getMonth() === date.month && taskDate.getFullYear() === date.year ); - }).length; + }); + return { + length: filterTasks.length, + colors: filterTasks.map((task) => { + switch (task.priority) { + case 1: + return "bg-[rgba(18,26,230,1)]"; + case 2: + return "bg-[rgba(97,200,232,1)]"; + case 3: + return "bg-[rgba(247,220,52,1)]"; + case 4: + return "bg-[rgba(251,194,199,1)]"; + default: + return "bg-[rgba(251,194,199,1)]"; + } + }), + }; }; const hasTasksOnDate = (date: CalendarDateTemplateEvent) => { @@ -315,7 +332,8 @@ const ProfileCalendar: FunctionComponent = () => { const dateTemplate = (date: CalendarDateTemplateEvent) => { const isHighlighted = hasTasksOnDate(date); - const countT = tasksCount(date); + const taskInfo = tasksCount(date); + if (taskInfo.length) console.log(taskInfo); const isSelected = currentDate && currentDate.getDate() === date.day && @@ -339,10 +357,10 @@ const ProfileCalendar: FunctionComponent = () => { {date.day} {isHighlighted && (
- {Array.from({ length: countT > 3 ? 3 : countT }).map((_, i) => ( - + {Array.from({ length: taskInfo.length > 3 ? 3 : taskInfo.length }).map((_, i) => ( + ))} - {countT > 3 && +} + {taskInfo.length > 3 && +}
)}