Tutorial #62
@@ -43,7 +43,7 @@ const Calender = ({
|
|||||||
console.warn("Invalid date format: ", newDate);
|
console.warn("Invalid date format: ", newDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [dispatch, newDate]);
|
}, [currentSelectedDateStr, dispatch, newDate]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.info("Check to update date.");
|
// console.info("Check to update date.");
|
||||||
|
|||||||
@@ -7,18 +7,23 @@ import Day from "../calender/Day";
|
|||||||
|
|
||||||
interface CalenderExampleProps {
|
interface CalenderExampleProps {
|
||||||
type: "add" | "edit";
|
type: "add" | "edit";
|
||||||
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CalenderExample = ({ type }: CalenderExampleProps): JSX.Element => {
|
const CalenderExample = ({
|
||||||
|
type,
|
||||||
|
isLoading
|
||||||
|
}: CalenderExampleProps): JSX.Element => {
|
||||||
// TODO: Check if the current date is the start of the user's preferred start of the week and use the previous week for the edit example.
|
// TODO: Check if the current date is the start of the user's preferred start of the week and use the previous week for the edit example.
|
||||||
|
|
||||||
// TODO: Add highlight to the current date for the add example and highlight other dates when the edit example is used.
|
// TODO: Add highlight to the current date for the add example and highlight other dates when the edit example is used.
|
||||||
|
|
||||||
// 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.
|
// 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 currDateStr: string = useAppSelector(state => state.calender.currDate);
|
const currDateStr: string = useAppSelector(
|
||||||
|
(state) => state.calender.currDate
|
||||||
|
);
|
||||||
const currDateObj: Date = new Date(currDateStr);
|
const currDateObj: Date = new Date(currDateStr);
|
||||||
const isLoading = false;
|
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
|
import { toggleRememberCompleted } from "../../features/tutorial";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -8,9 +11,6 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
VStack
|
VStack
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import React from "react";
|
|
||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
|
||||||
import { toggleRememberCompleted } from "../../features/tutorial";
|
|
||||||
import CustomButton from "../buttons/Custom";
|
import CustomButton from "../buttons/Custom";
|
||||||
import Patreon from "../buttons/Patreon";
|
import Patreon from "../buttons/Patreon";
|
||||||
import Twitter from "../buttons/Twitter";
|
import Twitter from "../buttons/Twitter";
|
||||||
@@ -19,11 +19,13 @@ import CalenderExample from "./CalenderExample";
|
|||||||
interface TutorialProps {
|
interface TutorialProps {
|
||||||
setTutorialComplete: () => void;
|
setTutorialComplete: () => void;
|
||||||
setTempTutorialComplete: () => void;
|
setTempTutorialComplete: () => void;
|
||||||
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Tutorial = ({
|
const Tutorial = ({
|
||||||
setTutorialComplete,
|
setTutorialComplete,
|
||||||
setTempTutorialComplete
|
setTempTutorialComplete,
|
||||||
|
isLoading
|
||||||
}: TutorialProps): JSX.Element => {
|
}: TutorialProps): JSX.Element => {
|
||||||
const rememberComplete = useAppSelector(
|
const rememberComplete = useAppSelector(
|
||||||
(state) => state.tutorial.rememberCompleted
|
(state) => state.tutorial.rememberCompleted
|
||||||
@@ -271,7 +273,12 @@ const Tutorial = ({
|
|||||||
alignItems="flex-start"
|
alignItems="flex-start"
|
||||||
pt={8}
|
pt={8}
|
||||||
>
|
>
|
||||||
<Button type="button" onClick={() => handleSkip()} variant="skip">
|
<Button
|
||||||
|
type="button"
|
||||||
|
isDisabled={isLoading}
|
||||||
|
onClick={() => handleSkip()}
|
||||||
|
variant="skip"
|
||||||
|
>
|
||||||
{"Skip"}
|
{"Skip"}
|
||||||
</Button>
|
</Button>
|
||||||
<VStack
|
<VStack
|
||||||
@@ -283,6 +290,7 @@ const Tutorial = ({
|
|||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
isDisabled={isLoading}
|
||||||
onClick={() => handleComplete()}
|
onClick={() => handleComplete()}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
>
|
>
|
||||||
@@ -290,6 +298,7 @@ const Tutorial = ({
|
|||||||
</Button>
|
</Button>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
isChecked={rememberComplete}
|
isChecked={rememberComplete}
|
||||||
|
isDisabled={isLoading}
|
||||||
onChange={() => handleUpdateCheck()}
|
onChange={() => handleUpdateCheck()}
|
||||||
>
|
>
|
||||||
{"Remember completed?"}
|
{"Remember completed?"}
|
||||||
|
|||||||
@@ -39,9 +39,8 @@ const IndexPage = (): JSX.Element => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (completedTutorial === null || tutorialCompletionInfo === null) {
|
if (completedTutorial === null && tutorialCompletionInfo === null) {
|
||||||
dispatch(getAndSetTutorial());
|
dispatch(getAndSetTutorial());
|
||||||
dispatch(updateLoading(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (completedTutorial !== null) {
|
if (completedTutorial !== null) {
|
||||||
@@ -63,6 +62,7 @@ const IndexPage = (): JSX.Element => {
|
|||||||
<Tutorial
|
<Tutorial
|
||||||
setTutorialComplete={handleTutorialCompleted}
|
setTutorialComplete={handleTutorialCompleted}
|
||||||
setTempTutorialComplete={handleTempTutorialCompleted}
|
setTempTutorialComplete={handleTempTutorialCompleted}
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Provider>
|
</Provider>
|
||||||
|
|||||||
Reference in New Issue
Block a user