diff --git a/apps/app/components/workspace/activity-graph.tsx b/apps/app/components/workspace/activity-graph.tsx index 0d8be2039..39c96890d 100644 --- a/apps/app/components/workspace/activity-graph.tsx +++ b/apps/app/components/workspace/activity-graph.tsx @@ -52,7 +52,7 @@ export const ActivityGraph = () => { const date = new Date(year, month, 1); while (date.getMonth() === month && date < new Date()) { - dates.push(new Date(date)); + dates.push(renderDateFormat(new Date(date))); date.setDate(date.getDate() + 1); } @@ -68,22 +68,20 @@ export const ActivityGraph = () => { ...getDatesOfMonth(recentMonths[5]), ]; - const getDatesOnDay = (dates: Date[], day: number) => { - const datesOnDay = []; - - for (let i = 0; i < dates.length; i++) - if (dates[i].getDay() === day) datesOnDay.push(renderDateFormat(new Date(dates[i]))); - - return datesOnDay; - }; - const activitiesIntensity = (activityCount: number) => { - if (activityCount <= 3) return "opacity-50"; - else if (activityCount > 3 && activityCount <= 6) return "opacity-70"; - else if (activityCount > 6 && activityCount <= 9) return "opacity-90"; + if (activityCount <= 3) return "opacity-20"; + else if (activityCount > 3 && activityCount <= 6) return "opacity-40"; + else if (activityCount > 6 && activityCount <= 9) return "opacity-80"; else return ""; }; + const addPaddingTiles = () => { + const firstDateDay = new Date(recentDates[0]).getDay(); + + for (let i = 0; i < firstDateDay; i++) recentDates.unshift(""); + }; + addPaddingTiles(); + useEffect(() => { if (!ref.current) return; @@ -91,7 +89,7 @@ export const ActivityGraph = () => { }, [ref]); return ( -