Upgrades #54

Merged
LucidKobold merged 16 commits from upgrades into main 2022-04-29 10:17:58 -04:00
28 changed files with 199 additions and 190 deletions
Showing only changes of commit 76c0dfca91 - Show all commits

View File

@@ -5,7 +5,6 @@ import {
getMonth, getMonth,
sub, sub,
getDate, getDate,
isSameDay,
isBefore, isBefore,
endOfDay endOfDay
} from "date-fns"; } from "date-fns";
@@ -94,9 +93,7 @@ const Day = ({
w="100%" w="100%"
h="100%" h="100%"
_hover={{ _hover={{
cursor: isBefore(date, endOfDay(currDate)) cursor: isBefore(date, endOfDay(currDate)) ? "pointer" : "default",
? "pointer"
: "default",
background: "gray.700", background: "gray.700",
border: "1px solid #FFF", border: "1px solid #FFF",
color: "whiteAlpha.900" color: "whiteAlpha.900"
@@ -135,9 +132,7 @@ const Day = ({
justifyContent="flex-start" justifyContent="flex-start"
pt={2} pt={2}
_hover={{ _hover={{
cursor: isBefore(date, endOfDay(currDate)) cursor: isBefore(date, endOfDay(currDate)) ? "pointer" : "default",
? "pointer"
: "default",
background: "gray.700", background: "gray.700",
border: "1px solid #FFF" border: "1px solid #FFF"
}} }}

View File

@@ -7,7 +7,8 @@ import CalenderNav from "./CalenderNav";
import Day from "./Day"; import Day from "./Day";
const Calender = (newDate?: UpdateCalendarProps): JSX.Element => { const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
const { selectedDate, layout, updateDate, currDate, setCurrDate } = useContext(CalenderContext); const { selectedDate, layout, updateDate, currDate, setCurrDate } =
useContext(CalenderContext);
const { stickersMonth } = useContext(StickersContext); const { stickersMonth } = useContext(StickersContext);
useEffect(() => { useEffect(() => {
@@ -25,7 +26,7 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
useEffect(() => { useEffect(() => {
console.info("Check to update date."); console.info("Check to update date.");
if (!isSameDay(currDate, new Date())) { if (!isSameDay(currDate, new Date())) {
console.info("Updated date.") console.info("Updated date.");
setCurrDate(new Date()); setCurrDate(new Date());
} }
}, [currDate, setCurrDate]); }, [currDate, setCurrDate]);

View File

@@ -240,8 +240,8 @@ const CalenderContextProvider = ({
} }
}; };
// * Attempting to fix an issue with static generation where the date does not appear to be updating after initial generation. // * Attempting to fix an issue with static generation where the date does not appear to be updating after initial generation.
const [currDate, setCurrDate] = useState<Date>(new Date); const [currDate, setCurrDate] = useState<Date>(new Date());
const calenderContextValues: CalenderContextState = { const calenderContextValues: CalenderContextState = {
currDate, currDate,