diff --git a/src/components/buttons/Custom.tsx b/src/components/buttons/Custom.tsx
index 93f377d..b96adae 100644
--- a/src/components/buttons/Custom.tsx
+++ b/src/components/buttons/Custom.tsx
@@ -14,9 +14,7 @@ const CustomButton = ({ text, link, type }: CustomButtonProps): JSX.Element => {
return (
-
+
);
diff --git a/src/components/buttons/Patreon.tsx b/src/components/buttons/Patreon.tsx
index 9dcec4e..76bfb5e 100644
--- a/src/components/buttons/Patreon.tsx
+++ b/src/components/buttons/Patreon.tsx
@@ -13,10 +13,7 @@ const Patreon = (): JSX.Element => {
target="_blank"
rel="noopener"
>
- }
- >
+ }>
{"Fund The App"}
diff --git a/src/components/calender/index.tsx b/src/components/calender/index.tsx
index 3f1af6d..41b7358 100644
--- a/src/components/calender/index.tsx
+++ b/src/components/calender/index.tsx
@@ -17,7 +17,7 @@ const Calender = ({
const selectedDate: SelectedDateInfo = useAppSelector(
(state) => state.calender.selectedDateInfo
);
- const { layout, title } = selectedDate;
+ const { layout, title, date: currentSelectedDateStr } = selectedDate;
const currDateObj = new Date(currDate);
@@ -33,9 +33,12 @@ const Calender = ({
if (year > 0 && month > 0 && day > 0) {
const generatedDate: Date = new Date(year, month - 1, day);
+ const currSelectedDateObj = new Date(currentSelectedDateStr);
const dateString: string = generatedDate.toJSON();
- dispatch(updateMonth(dateString));
+ if (!isSameDay(currSelectedDateObj, generatedDate)) {
+ dispatch(updateMonth(dateString));
+ }
} else {
console.warn("Invalid date format: ", newDate);
}
@@ -148,7 +151,7 @@ const Calender = ({
id.length
? id
: format(toDateObj, "yyyyddLL") +
- `/${sticker === null ? 0 : sticker}`
+ `/${sticker === null ? 0 : sticker}`
}
/>
);
diff --git a/src/components/tutorial/CalenderExample.tsx b/src/components/tutorial/CalenderExample.tsx
index b58e2e1..002c4c2 100644
--- a/src/components/tutorial/CalenderExample.tsx
+++ b/src/components/tutorial/CalenderExample.tsx
@@ -16,7 +16,8 @@ const CalenderExample = ({ type }: CalenderExampleProps): JSX.Element => {
// TODO: Disable the days that shouldn't have a function to prevent edits on add example and add to current date on the edit example.
- const currDateObj: Date = new Date();
+ const currDateStr: string = useAppSelector(state => state.calender.currDate);
+ const currDateObj: Date = new Date(currDateStr);
const isLoading = false;
const dispatch = useAppDispatch();
@@ -25,7 +26,7 @@ const CalenderExample = ({ type }: CalenderExampleProps): JSX.Element => {
const selectedDate: SelectedDateInfo = useAppSelector(
(state) => state.calender.selectedDateInfo
);
- const { layout } = selectedDate;
+ const { layout, date: currSelectedDateStr } = selectedDate;
// * Stickers * //
@@ -45,8 +46,13 @@ const CalenderExample = ({ type }: CalenderExampleProps): JSX.Element => {
const { month, weekdays } = currMonth;
useEffect(() => {
- dispatch(updateMonth(new Date().toJSON()));
- }, [dispatch]);
+ const currDateObj: Date = new Date(currDateStr);
+ const currSelectedDateOj: Date = new Date(currSelectedDateStr);
+
+ if (!isSameDay(currDateObj, currSelectedDateOj)) {
+ dispatch(updateMonth(currDateObj.toJSON()));
+ }
+ }, [currDateStr, currSelectedDateStr, dispatch]);
// * The current week * //
@@ -148,7 +154,7 @@ const CalenderExample = ({ type }: CalenderExampleProps): JSX.Element => {
id.length
? id
: format(toDateObj, "yyyyddLL") +
- `/${sticker === null ? 0 : sticker}`
+ `/${sticker === null ? 0 : sticker}`
}
/>
);
diff --git a/src/components/tutorial/index.tsx b/src/components/tutorial/index.tsx
index c91af59..982c2fd 100644
--- a/src/components/tutorial/index.tsx
+++ b/src/components/tutorial/index.tsx
@@ -25,7 +25,9 @@ const Tutorial = ({
setTutorialComplete,
setTempTutorialComplete
}: TutorialProps): JSX.Element => {
- const rememberComplete = useAppSelector(state => state.tutorial.rememberCompleted);
+ const rememberComplete = useAppSelector(
+ (state) => state.tutorial.rememberCompleted
+ );
const dispatch = useAppDispatch();
const handleComplete = (): void => {