Remove stickers from caledner context. Rename main state.

This commit is contained in:
Lucid Kobold
2022-02-03 12:45:11 -06:00
parent 90391820f5
commit 62338cf735

View File

@@ -73,9 +73,7 @@ const CalenderContextProvider = ({
return { isOverflow: flag, overflowDirection: direction }; return { isOverflow: flag, overflowDirection: direction };
}; };
const [stickersMonth, setStickersMonth] = useState<StickerDays>( const [month /*, setMonth*/] = useState<StickerDays>(stickersSeeder());
stickersSeeder()
);
/** /**
* A function that will return a month layout when given a date. It produces * A function that will return a month layout when given a date. It produces
@@ -131,12 +129,11 @@ const CalenderContextProvider = ({
const overflowInfo = isOverflow(selectedDate, sunCurrDate); const overflowInfo = isOverflow(selectedDate, sunCurrDate);
const stickerDay = overflowInfo.isOverflow const stickerDay = overflowInfo.isOverflow
? null ? null
: stickersMonth[getDate(sunCurrDate) - 1]; : month[getDate(sunCurrDate) - 1];
const day: MonthDay = { const day: MonthDay = {
...overflowInfo, ...overflowInfo,
date: sunCurrDate, date: sunCurrDate
sticker: stickerDay ? stickerDay.sticker : null
}; };
sunCurrDate = add(sunCurrDate, { sunCurrDate = add(sunCurrDate, {
@@ -169,12 +166,11 @@ const CalenderContextProvider = ({
const overflowInfo = isOverflow(selectedDate, monCurrDate); const overflowInfo = isOverflow(selectedDate, monCurrDate);
const stickerDay = overflowInfo.isOverflow const stickerDay = overflowInfo.isOverflow
? null ? null
: stickersMonth[getDate(monCurrDate) - 1]; : month[getDate(monCurrDate) - 1];
const day: MonthDay = { const day: MonthDay = {
...overflowInfo, ...overflowInfo,
date: monCurrDate, date: monCurrDate
sticker: stickerDay ? stickerDay.sticker : null
}; };
monCurrDate = add(monCurrDate, { monCurrDate = add(monCurrDate, {