import { Box, Typography, Button } from "@mui/material";

import { useCurrentQuiz } from "@root/quizes/hooks";

type ContactFormProps = {
  showResultForm: boolean;
  setShowContactForm: (show: boolean) => void;
  setShowResultForm: (show: boolean) => void;
};

export const ContactForm = ({
  showResultForm,
  setShowContactForm,
  setShowResultForm,
}: ContactFormProps) => {
  const quiz = useCurrentQuiz();

  const followNextForm = () => {
    setShowContactForm(false);
    setShowResultForm(true);
  };

  return (
    <Box>
      <Typography>Форма контактов</Typography>
      {!showResultForm && quiz?.config.resultInfo.when === "after" && (
        <Button variant="contained" onClick={followNextForm}>
          Показать результат
        </Button>
      )}
    </Box>
  );
};
