2023-08-18 11:16:56 +00:00
|
|
|
import * as React from "react";
|
2023-06-27 22:26:23 +00:00
|
|
|
|
|
|
|
import AnswerOptions from "./answerOptions/AnswerOptions";
|
|
|
|
import OptionsPicture from "./OptionsPicture/OptionsPicture";
|
|
|
|
import DataOptions from "./DataOptions/DataOptions";
|
|
|
|
import SliderOptions from "./SliderOptions/SliderOptions";
|
|
|
|
import OwnTextField from "./OwnTextField/OwnTextField";
|
|
|
|
import PageOptions from "./PageOptions/PageOptions";
|
|
|
|
import OptionsAndPicture from "./OptionsAndPicture/OptionsAndPicture";
|
|
|
|
import RatingOptions from "./RatingOptions/RatingOptions";
|
|
|
|
import Emoji from "./Emoji/Emoji";
|
|
|
|
import DropDown from "./DropDown/DropDown";
|
|
|
|
import UploadFile from "./UploadFile/UploadFile";
|
2023-08-18 11:16:56 +00:00
|
|
|
import { useParams } from "react-router-dom";
|
|
|
|
import { questionStore } from "@root/questions";
|
2023-06-27 22:26:23 +00:00
|
|
|
|
|
|
|
interface Props {
|
2023-08-18 11:16:56 +00:00
|
|
|
totalIndex: number;
|
2023-06-27 22:26:23 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
export default function SwitchQuestionsPage({ totalIndex }: Props) {
|
|
|
|
const params = Number(useParams().quizId);
|
|
|
|
const { listQuestions } = questionStore();
|
|
|
|
const switchState = listQuestions[totalIndex].type;
|
|
|
|
switch (switchState) {
|
|
|
|
case "variant":
|
|
|
|
return <AnswerOptions totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "images":
|
|
|
|
return <OptionsPicture totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "varimg":
|
|
|
|
return <OptionsAndPicture totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "emoji":
|
|
|
|
return <Emoji totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "text":
|
|
|
|
return <OwnTextField totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "select":
|
|
|
|
return <DropDown totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "date":
|
|
|
|
return <DataOptions totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "number":
|
|
|
|
return <SliderOptions totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "file":
|
|
|
|
return <UploadFile totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "page":
|
|
|
|
return <PageOptions totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
case "rating":
|
|
|
|
return <RatingOptions totalIndex={totalIndex} />;
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-08-18 11:16:56 +00:00
|
|
|
default:
|
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
}
|