Stickers now updating in local state, the context state is not.

This commit is contained in:
Lucid Kobold
2022-02-10 01:57:54 -06:00
parent af57b29e2d
commit 609882fd1e
7 changed files with 51 additions and 45 deletions

View File

@@ -1,9 +1,9 @@
import React, { useContext, useEffect } from "react";
import { Box, HStack, SimpleGrid, Text, VStack } from "@chakra-ui/react";
import CalenderNav from "./CalenderNav";
import { isSameDay, format } from "date-fns";
import { CalenderContext } from "../../contexts/CalenderContext";
import { StickersContext } from "../../contexts/StickerContext";
import { isSameDay } from "date-fns";
import CalenderNav from "./CalenderNav";
import Day from "./Day";
const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
@@ -28,15 +28,12 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
startOfWeek: "Sunday"
};
const currMonth = layout[`${userSettings.startOfWeek.toLowerCase()}`];
const currMonth: WeekLayout =
layout[`${userSettings.startOfWeek.toLowerCase()}`];
const { month, weekdays } = currMonth;
// TODO: Move the weekdays into it's own component for responsiveness.
useEffect(() => {
console.log("Stickers month updated");
}, [stickersMonth]);
return (
<VStack h="91vh" w="100%">
<CalenderNav />
@@ -94,7 +91,12 @@ const Calender = (newDate?: UpdateCalendarProps): JSX.Element => {
sticker={sticker}
date={date}
selectedDate={selectedDate}
key={id}
key={
id.length
? id
: format(date, "yyyyddLL") +
`/${sticker === null ? 0 : sticker}`
}
/>
);
});