import { useState, Fragment } from "react"; import { useSetAtom } from "jotai"; import { useNavigate } from "react-router-dom"; import { Slide, Drawer, Typography, IconButton, Box, Stack, Button, } from "@mui/material"; import CloseIcon from "@mui/icons-material/Close"; import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; import StepsProgress from "@src/components/StepsProgress"; import { TUTORIAL_STEPS } from "./Steps"; import { globalScope, confirmDialogAtom } from "@src/atoms/globalScope"; import { ROUTES } from "@src/constants/routes"; import { NAV_DRAWER_COLLAPSED_WIDTH } from "@src/layouts/Navigation/NavDrawer"; export default function TableTutorial() { const confirm = useSetAtom(confirmDialogAtom, globalScope); const navigate = useNavigate(); const [completed, setCompleted] = useState( new Array(TUTORIAL_STEPS.length).fill(false) ); const [currentStep, setCurrentStep] = useState(0); const handleComplete = (value: boolean) => setCompleted((c) => { if (c[currentStep] === value) return c; const newCompleted = [...c]; newCompleted[currentStep] = value; return newCompleted; }); const handleNext = () => setCurrentStep((c) => Math.min(c + 1, TUTORIAL_STEPS.length - 1)); const stepProps = TUTORIAL_STEPS[currentStep]; const StepComponent = stepProps.StepComponent; const isFinal = currentStep === TUTORIAL_STEPS.length - 1; return ( `max(env(safe-area-inset-bottom), ${theme.spacing(5)})`, overflow: "auto", display: "flex", flexDirection: "column", gap: 2, }, "& ol": { m: 0, p: 0, listStyle: "none" }, "& p": { maxWidth: "100ch" }, }} PaperProps={{ elevation: 2 }} > Get started tutorial confirm({ title: "Close tutorial?", body: "Your progress will be lost", handleConfirm: () => navigate(ROUTES.tables), confirm: "Close tutorial", cancel: "Continue tutorial", confirmColor: "error", buttonLayout: "vertical", }) } >
{stepProps.title} {stepProps.description}
{stepProps.completeText && ( theme.transitions.create("opacity"), }} > {stepProps.completeText} )}
); }