import { useNavigate } from "react-router-dom"; import { useUpdateStep } from "@/components/ChatsPath/hooks/useUpdateStep"; import routes from "@/routes"; import { IAnswer } from "@/components/ChatsPath/data"; import Answers from "@/components/ChatsPath/components/Answers"; import InputAnswerModal from "@/components/ChatsPath/components/InputAnswerModal"; import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import { yourGoalAnswers } from "@/components/ChatsPath/data/yourGoalAnswers"; function YourGoal() { useUpdateStep(10); const navigate = useNavigate(); const dispatch = useDispatch(); const { goal } = useSelector(selectors.selectAnswers); const [answer, setAnswer] = useState(""); const [open, setOpen] = useState(false); const handleOpen = () => setOpen(true); const handleClose = () => setOpen(false); const handleNext = () => { navigate(routes.client.chatsQuizSomethingWorrying()); }; const answers: IAnswer[] = yourGoalAnswers[goal]?.map((answer) => { return { ...answer, onClick: answer.value === "other" ? handleOpen : handleNext, }; }); const handleChangeAnswer = (event: React.ChangeEvent) => { setAnswer(event.target.value); }; const handleModalNext = () => { dispatch( actions.chats.updateAnswers({ yourGoal: answer, }) ); handleNext(); }; return ( <>

What is your goal?

); } export default YourGoal;