import { useQuizViewStore } from "@stores/quizView";
import { TextNormal } from "./TextNormal";

import type { QuizQuestionText } from "@model/questionTypes/text";

type TextProps = {
  currentQuestion: QuizQuestionText;
  stepNumber: number | null;
};

export const Text = ({ currentQuestion, stepNumber }: TextProps) => {
  const answers = useQuizViewStore((state) => state.answers);
  const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};

  return (
    <TextNormal
      currentQuestion={currentQuestion}
      answer={answer}
    />
  );
};
