import styles from "./styles.module.css"; import Title from "@/components/Title"; import { Gender, genders } from "@/data"; import routes from "@/routes"; import { actions } from "@/store"; import { useEffect } from "react"; import { useDispatch } from "react-redux"; import { useNavigate, useParams } from "react-router-dom"; function GenderPage(): JSX.Element { const dispatch = useDispatch(); const navigate = useNavigate(); const { targetId } = useParams(); const pathName = window.location.pathname; useEffect(() => { const isShowTryApp = targetId === "i"; dispatch(actions.userConfig.addIsShowTryApp(isShowTryApp)); }, [dispatch, targetId]); const selectGender = (gender: Gender) => { dispatch(actions.questionnaire.update({ gender: gender.id })); if (pathName === "/epe/gender") { return navigate(routes.client.epeBirthdate()); } navigate(`/questionnaire/profile/flowChoice`); }; const getButtonBGColor = (gender: Gender): string => { const { colorAssociation } = gender; if (Array.isArray(colorAssociation)) { return `linear-gradient(125.02deg, ${colorAssociation.join(", ")})`; } if (typeof colorAssociation === "string") { return colorAssociation; } return "#f5f5f5"; }; return (
Understand Yourself and Improve Relationships With Astrology 1-Minute Personal Assessment Select your gender:
{genders.map((gender, index) => (
{ selectGender(gender); }} > {gender.id}
))}
); } export default GenderPage;