frontAnswerer/lib/components/ViewPublicationPage/questions/Text/index.tsx
Nastya 4190ae767e
All checks were successful
Deploy / CreateImage (push) Successful in 2m53s
Deploy / DeployService (push) Successful in 21s
add crutch
2025-04-16 21:34:25 +03:00

56 lines
1.4 KiB
TypeScript

import { useQuizSettings } from "@contexts/QuizDataContext";
import { useQuizViewStore } from "@stores/quizView";
import { TextNormal } from "./TextNormal";
import { TextSpecial } from "./TextSpecial";
import { TextSpecialHorisontal } from "./TextSpecialHorisontal";
import type { QuizQuestionText } from "@model/questionTypes/text";
type TextProps = {
currentQuestion: QuizQuestionText;
stepNumber: number | null;
};
const pathOnly = window.location.pathname;
export const Text = ({ currentQuestion, stepNumber }: TextProps) => {
const { settings } = useQuizSettings();
const answers = useQuizViewStore((state) => state.answers);
const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
if (pathOnly === "/92ed5e3e-8e6a-491e-87d0-d3197682d0e3")
return (
<TextSpecialHorisontal
currentQuestion={currentQuestion}
answer={answer}
stepNumber={stepNumber}
/>
);
switch (settings.cfg.spec) {
case true:
return (
<TextSpecial
currentQuestion={currentQuestion}
answer={answer}
stepNumber={stepNumber}
/>
);
case undefined:
return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
/>
);
default:
return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
/>
);
}
};