2023-06-27 22:26:23 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
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-06-30 17:59:50 +00:00
|
|
|
import {useParams} from "react-router-dom";
|
|
|
|
import {questionStore} from "@root/questions";
|
2023-06-27 22:26:23 +00:00
|
|
|
|
|
|
|
interface Props {
|
2023-06-30 14:39:07 +00:00
|
|
|
totalIndex: number,
|
2023-06-27 22:26:23 +00:00
|
|
|
}
|
|
|
|
|
2023-06-30 17:59:50 +00:00
|
|
|
export default function SwitchQuestionsPage ({totalIndex }: Props) {
|
|
|
|
const params = Number(useParams().quizId);
|
|
|
|
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
|
|
|
|
const switchState = listQuestions[params][totalIndex].type
|
2023-06-27 22:26:23 +00:00
|
|
|
switch (switchState) {
|
|
|
|
case 'answer':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<AnswerOptions totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'answerpict':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<OptionsPicture totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'answerandpict':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<OptionsAndPicture totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'emoji':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<Emoji totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'textfield':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<OwnTextField totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'dropdown':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<DropDown totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'date':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<DataOptions totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'slider':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<SliderOptions totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'uploader':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<UploadFile totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'page':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<PageOptions totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'rating':
|
2023-06-30 14:39:07 +00:00
|
|
|
return (<RatingOptions totalIndex={totalIndex}/>);
|
2023-06-27 22:26:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return (<></>)
|
|
|
|
}
|
|
|
|
}
|