2023-11-27 23:07:24 +00:00
|
|
|
|
import { QuizResultsType, QuizStartpageType, QuizType } from "@model/quizSettings";
|
2023-07-01 23:33:35 +00:00
|
|
|
|
import ContactFormPage from "../pages/ContactFormPage/ContactFormPage";
|
2023-07-06 15:54:12 +00:00
|
|
|
|
import InstallQuiz from "../pages/InstallQuiz/InstallQuiz";
|
2023-11-13 18:04:51 +00:00
|
|
|
|
import FormQuestionsPage from "../pages/Questions/Form/FormQuestionsPage";
|
|
|
|
|
import QuestionsPage from "../pages/Questions/QuestionsPage";
|
|
|
|
|
import { QuestionsMap } from "../pages/QuestionsMap";
|
2023-09-15 12:37:12 +00:00
|
|
|
|
import { Result } from "../pages/Result/Result";
|
|
|
|
|
import { Setting } from "../pages/Result/Setting";
|
2023-11-13 18:04:51 +00:00
|
|
|
|
import StartPageSettings from "../pages/startPage/StartPageSettings";
|
|
|
|
|
import StepOne from "../pages/startPage/stepOne";
|
|
|
|
|
import Steptwo from "../pages/startPage/steptwo";
|
|
|
|
|
|
2023-03-03 20:07:19 +00:00
|
|
|
|
|
2023-03-03 23:54:19 +00:00
|
|
|
|
interface Props {
|
2023-11-27 23:07:24 +00:00
|
|
|
|
activeStep: number;
|
|
|
|
|
quizType: QuizType;
|
|
|
|
|
quizStartPageType: QuizStartpageType;
|
|
|
|
|
quizResults: QuizResultsType;
|
2023-03-03 23:54:19 +00:00
|
|
|
|
}
|
2023-03-03 20:07:19 +00:00
|
|
|
|
|
2023-10-05 10:12:56 +00:00
|
|
|
|
export default function SwitchStepPages({
|
2023-11-13 18:04:51 +00:00
|
|
|
|
activeStep = 1,
|
|
|
|
|
quizType,
|
2023-11-27 23:07:24 +00:00
|
|
|
|
quizStartPageType,
|
|
|
|
|
quizResults,
|
2023-10-05 10:12:56 +00:00
|
|
|
|
}: Props) {
|
2023-11-13 18:04:51 +00:00
|
|
|
|
switch (activeStep) {
|
2023-11-27 23:07:24 +00:00
|
|
|
|
case 0: {
|
|
|
|
|
if (!quizType) return <StepOne />;
|
|
|
|
|
if (!quizStartPageType) return <Steptwo />;
|
|
|
|
|
return <StartPageSettings />;
|
|
|
|
|
}
|
|
|
|
|
case 1: return quizType === "form" ? <FormQuestionsPage /> : <QuestionsPage />;
|
|
|
|
|
case 2: {
|
|
|
|
|
if (!quizResults) return <Result />;
|
|
|
|
|
return <Setting />;
|
|
|
|
|
}
|
|
|
|
|
case 3: return <QuestionsMap />;
|
|
|
|
|
case 4: return <ContactFormPage />;
|
|
|
|
|
case 5: return <InstallQuiz />;
|
|
|
|
|
case 6: return <>Реклама</>;
|
|
|
|
|
default: throw new Error(`Invalid quiz setup step: ${activeStep}`);
|
2023-11-13 18:04:51 +00:00
|
|
|
|
}
|
2023-11-27 23:07:24 +00:00
|
|
|
|
}
|