frontAnswerer/lib/components/ViewPublicationPage/questions/Text/index.tsx

56 lines
1.4 KiB
TypeScript
Raw Normal View History

import { useQuizViewStore } from "@stores/quizView";
import { TextNormal } from "./TextNormal";
import { TextSpecial } from "./TextSpecial";
2025-04-16 18:27:20 +00:00
import { TextSpecialHorisontal } from "./TextSpecialHorisontal";
2024-04-23 14:45:49 +00:00
import type { QuizQuestionText } from "@model/questionTypes/text";
2025-05-01 13:15:54 +00:00
import { useQuizStore } from "@/stores/useQuizStore";
2024-04-23 14:45:49 +00:00
type TextProps = {
currentQuestion: QuizQuestionText;
stepNumber: number | null;
};
2025-04-16 18:27:20 +00:00
const pathOnly = window.location.pathname;
2024-04-23 14:45:49 +00:00
export const Text = ({ currentQuestion, stepNumber }: TextProps) => {
2025-05-01 13:15:54 +00:00
const { settings } = useQuizStore();
2024-04-23 14:45:49 +00:00
const answers = useQuizViewStore((state) => state.answers);
2024-05-31 16:41:18 +00:00
const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
2024-04-23 14:45:49 +00:00
2025-04-16 18:27:20 +00:00
if (pathOnly === "/92ed5e3e-8e6a-491e-87d0-d3197682d0e3")
return (
<TextSpecialHorisontal
currentQuestion={currentQuestion}
answer={answer}
stepNumber={stepNumber}
/>
);
2024-04-23 14:45:49 +00:00
switch (settings.cfg.spec) {
case true:
return (
<TextSpecial
currentQuestion={currentQuestion}
answer={answer}
stepNumber={stepNumber}
/>
2024-04-23 14:45:49 +00:00
);
case undefined:
return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
/>
);
2024-04-23 14:45:49 +00:00
default:
return (
<TextNormal
currentQuestion={currentQuestion}
answer={answer}
/>
);
2024-04-23 14:45:49 +00:00
}
};