diff --git a/src/components/utils/ui/Joyride.tsx b/src/components/utils/ui/Joyride.tsx deleted file mode 100644 index 52a2162..0000000 --- a/src/components/utils/ui/Joyride.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import Joyride from "react-joyride"; -import { steps } from "@/constants/steps/steps"; -import { useGlobalUIBoundedStore } from "@/core/store/ui"; -import { useJoyride } from "@/hooks/joyride.hook"; - -const JoyrideTutorial = () => { - const theme = useGlobalUIBoundedStore((state) => state.theme); - - const { run, stepIndex, handleJoyrideCallback } = useJoyride(); - console.log(stepIndex); - return ( - - ); -}; - -export default JoyrideTutorial; diff --git a/src/hooks/joyride.hook.ts b/src/hooks/joyride.hook.ts deleted file mode 100644 index 8c259b6..0000000 --- a/src/hooks/joyride.hook.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { steps } from "@/constants/steps/steps"; -import { useGlobalUIBoundedStore } from "@/core/store/ui"; -import { useState } from "react"; -import { CallBackProps, STATUS } from "react-joyride"; - -export const useJoyride = () => { - const run = useGlobalUIBoundedStore((state) => state.run); - const setRun = useGlobalUIBoundedStore((state) => state.setRun); - const [stepIndex, setStepIndex] = useState(0); - - const handleJoyrideCallback = (data: CallBackProps) => { - const { action, index, status, type } = data; - - if (status === STATUS.FINISHED || status === STATUS.SKIPPED) { - setRun(false); - setStepIndex(0); - } else if (action === "next" && index < steps.length - 1) { - setStepIndex(index + 1); - } else if (action === "prev" && index > 0) { - setStepIndex(index - 1); - } else if (type === "tour:end") { - setRun(false); - setStepIndex(0); - } - }; - - return { - handleJoyrideCallback, - run, - setRun, - stepIndex, - setStepIndex, - }; -};