import Title from "@/components/Title";
import styles from "./styles.module.css";
import MainButton from "@/components/MainButton";
import { useNavigate } from "react-router-dom";
import routes from "@/routes";
import { selectors } from "@/store";
import { useSelector } from "react-redux";
import { getZodiacSignByDate } from "@/services/zodiac-sign";

function NotAlonePage() {
  const navigate = useNavigate();
  const { birthdate } = useSelector(selectors.selectQuestionnaire);
  const zodiacSign = getZodiacSignByDate(birthdate);

  const handleBack = () => {
    navigate(-1);
  };

  const handleNext = () => {
    navigate(`${routes.client.questionnaire()}/personalityTraits/attitude`);
  };

  return (
    <section className={`${styles.page} page`}>
      <img
        src="/umbrella.svg"
        alt="The starry key"
        style={{ minHeight: "227px" }}
      />
      <div>
        <Title variant="h1" className={styles.title}>
          You’re not alone. <br /> A lot of{" "}
          <span style={{ color: "#f2c94c" }}>{zodiacSign}</span> people find it
          difficult to control emotions due to their zodiac sign traits. Don’t
          worry, we know how to address that!
        </Title>
      </div>
      <div className={styles["buttons-container"]}>
        <MainButton
          className={`${styles.button} ${styles["back-button"]}`}
          onClick={handleBack}
        >
          Back
        </MainButton>
        <MainButton
          className={`${styles.button} ${styles["next-button"]}`}
          onClick={handleNext}
        >
          Next
        </MainButton>
      </div>
    </section>
  );
}

export default NotAlonePage;
