diff --git a/src/app/calendarOverviewCard.tsx b/src/app/calendarOverviewCard.tsx index 6da6a72..d69e09c 100644 --- a/src/app/calendarOverviewCard.tsx +++ b/src/app/calendarOverviewCard.tsx @@ -11,7 +11,7 @@ import './calendar-styles.css' import { Tooltip } from 'react-tooltip'; const initialDate = dFns.parseISO('2023-12-15T00:00:00.000Z') -const endDate = dFns.parseISO('2024-01-20T00:00:00.000Z') +const endDate = dFns.parseISO('2024-01-25T00:00:00.000Z') const projectIds = [ 195482340, 195519024, @@ -58,6 +58,19 @@ function useCalendarData() { return R.sum((entries ?? []).map((entry) => entry.raw_json.seconds)) }, grouped); + // Fill in missing days, hacky + dFns.eachDayOfInterval({ + start: initialDate, + end: endDate, + }).forEach((date) => { + const key = dFns.formatISO(date); + if (summed[key] == undefined) { + summed[key] = 0; + } + }) + + debugger + setData(Object.entries(summed) .map(([key, value]) => ({ date: dFns.parseISO(key), @@ -81,10 +94,10 @@ export function CalendarOverviewCard() { values={data} classForValue={value => `color-github-${computeCompletionShade(value?.count ?? 0)}`} tooltipDataAttrs={(value: any) => { - return { + return value.date ? { 'data-tooltip-id': `calendar-tooltip`, - 'data-tooltip-content': value.count ?`${dFns.format(value.date, 'EEE do: ')} ${value.count.toFixed(2)} hours` : `${dFns.format(value.date, 'EEE do: ')} No time logged` - } + 'data-tooltip-content': value.count ?`${dFns.format(value.date, 'EEE do')}: ${value.count.toFixed(2)} hours` : `${dFns.format(value.date, 'EEE do')}` + } : undefined }} />