diff --git a/src/components/App.tsx b/src/components/App.tsx index 54da305..25b6d01 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -23,7 +23,7 @@ const App = () => { return ( - + } /> } /> @@ -31,7 +31,7 @@ const App = () => { } /> } /> - + ); diff --git a/src/components/calendar-month/CalendarCell.tsx b/src/components/calendar-month/CalendarCell.tsx index 6ec9b46..7b97fd2 100644 --- a/src/components/calendar-month/CalendarCell.tsx +++ b/src/components/calendar-month/CalendarCell.tsx @@ -10,7 +10,7 @@ import { import { useNotesStore, useOccurrencesStore } from '@stores'; import { useUser } from '@supabase/auth-helpers-react'; import clsx from 'clsx'; -import { format } from 'date-fns'; +import { format, isToday, isFuture } from 'date-fns'; import { AnimatePresence, motion } from 'framer-motion'; import React from 'react'; @@ -61,16 +61,10 @@ const CalendarCell = ({ const { removeOccurrence, fetchingOccurrences, occurrencesByDate } = useOccurrencesStore(); const { notes, fetchingNotes } = useNotesStore(); - const today = new Date(); - const isToday = - today.getDate() === dateNumber && - today.getMonth() + 1 === monthNumber && - today.getFullYear() === fullYear; const screenSize = useScreenSize(); - const date = format( - new Date(fullYear, monthNumber - 1, dateNumber), - 'yyyy-MM-dd' - ); + const cellDate = new Date(fullYear, monthNumber - 1, dateNumber); + const isTodayCell = isToday(cellDate); + const date = format(cellDate, 'yyyy-MM-dd'); const occurrences = isCalendarDay(date) ? occurrencesByDate[date] || [] : []; const isMobile = screenSize < 768; @@ -103,7 +97,6 @@ const CalendarCell = ({ return onAddOccurrence(dateNumber, monthNumber, fullYear); }, [ - isToday, dateNumber, fetchingOccurrences, fullYear, @@ -152,21 +145,21 @@ const CalendarCell = ({ }; const cellRootClassName = clsx( - 'group/cell flex h-auto flex-1 flex-col gap-2 border-r-2 border-neutral-500 transition-colors last-of-type:border-r-0 hover:bg-neutral-200 dark:border-neutral-400 dark:hover:bg-neutral-800 lg:h-28', + 'group/cell flex h-auto flex-1 flex-col gap-2 border-r-2 border-neutral-500 transition-colors last-of-type:border-r-0 hover:bg-neutral-200 dark:border-neutral-400 dark:hover:bg-neutral-800 lg:h-36', rangeStatus === 'below-range' && 'cursor-w-resize', rangeStatus === 'above-range' && 'cursor-e-resize', position === 'top-left' && 'rounded-tl-md', position === 'top-right' && 'rounded-tr-md', position === 'bottom-left' && 'rounded-bl-md', position === 'bottom-right' && 'rounded-br-md', - isToday && - 'bg-neutral-200 hover:bg-neutral-300 dark:bg-neutral-800 dark:hover:bg-neutral-700' + isTodayCell && + 'bg-background-200 hover:bg-background-300 dark:bg-background-800 dark:hover:bg-background-700' ); const cellHeaderClassName = clsx( - 'flex w-full items-center justify-between border-b-1 border-neutral-500 px-1.5 py-0.5 text-sm dark:border-neutral-400 md:text-base', + 'flex w-full items-center justify-between border-b-1 border-neutral-500 px-1.5 py-1.5 text-sm dark:border-neutral-400 md:text-base', rangeStatus !== 'in-range' && 'text-neutral-400 dark:text-neutral-600', - isToday ? 'w-full self-auto md:self-start' : 'w-full' + isTodayCell ? 'w-full self-auto md:self-start' : 'w-full' ); return ( @@ -181,24 +174,26 @@ const CalendarCell = ({
+ Weekly calendar is only available when navigating from the month + calendar for now +
+ Coming soon +
{WEEK_DAYS[dayIndex]}
*/} + {/* {hourIndex - 1}*/} + {/*