2024-08-30 10:45:37 +00:00
|
|
|
import DataOptions from "./QuestionOptions/DataOptions/DataOptions";
|
2023-11-15 18:38:02 +00:00
|
|
|
import DropDown from "./DropDown/DropDown";
|
|
|
|
import Emoji from "./Emoji/Emoji";
|
2024-08-30 10:45:37 +00:00
|
|
|
import OptionsAndPicture from "./QuestionOptions/OptionsAndPicture/OptionsAndPicture";
|
|
|
|
import OptionsPicture from "./QuestionOptions/OptionsPicture/OptionsPicture";
|
2023-06-27 22:26:23 +00:00
|
|
|
import OwnTextField from "./OwnTextField/OwnTextField";
|
2024-08-30 10:45:37 +00:00
|
|
|
import PageOptions from "./QuestionOptions/PageOptions/PageOptions";
|
|
|
|
import RatingOptions from "./QuestionOptions/RatingOptions/RatingOptions";
|
|
|
|
import SliderOptions from "./QuestionOptions/SliderOptions/SliderOptions";
|
2023-06-27 22:26:23 +00:00
|
|
|
import UploadFile from "./UploadFile/UploadFile";
|
2023-11-15 18:38:02 +00:00
|
|
|
import AnswerOptions from "./answerOptions/AnswerOptions";
|
2023-11-29 13:49:52 +00:00
|
|
|
import { notReachable } from "../../utils/notReachable";
|
2024-06-19 20:22:37 +00:00
|
|
|
import { AnyTypedQuizQuestion } from "@frontend/squzanswerer";
|
2023-11-15 18:38:02 +00:00
|
|
|
|
2023-06-27 22:26:23 +00:00
|
|
|
interface Props {
|
2023-12-16 12:17:07 +00:00
|
|
|
question: AnyTypedQuizQuestion;
|
2024-01-05 07:07:06 +00:00
|
|
|
openBranchingPage: boolean;
|
|
|
|
setOpenBranchingPage: (a: boolean) => void;
|
2023-06-27 22:26:23 +00:00
|
|
|
}
|
|
|
|
|
2024-06-19 20:22:37 +00:00
|
|
|
export default function SwitchQuestionsPage({ question, openBranchingPage, setOpenBranchingPage }: Props) {
|
2023-12-16 12:17:07 +00:00
|
|
|
switch (question.type) {
|
|
|
|
case "variant":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<AnswerOptions
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-09-15 12:37:12 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "images":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<OptionsPicture
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "varimg":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<OptionsAndPicture
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "emoji":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<Emoji
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "text":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<OwnTextField
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "select":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<DropDown
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "date":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<DataOptions
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "number":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<SliderOptions
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "file":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<UploadFile
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "page":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<PageOptions
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
case "rating":
|
2024-01-05 07:07:06 +00:00
|
|
|
return (
|
|
|
|
<RatingOptions
|
|
|
|
question={question}
|
|
|
|
openBranchingPage={openBranchingPage}
|
|
|
|
setOpenBranchingPage={setOpenBranchingPage}
|
|
|
|
/>
|
|
|
|
);
|
2023-06-27 22:26:23 +00:00
|
|
|
|
2024-02-26 15:56:07 +00:00
|
|
|
case "result":
|
|
|
|
return null;
|
|
|
|
|
2023-12-16 12:17:07 +00:00
|
|
|
default:
|
|
|
|
notReachable(question);
|
|
|
|
}
|
2023-08-18 11:16:56 +00:00
|
|
|
}
|