import { useNavigate } from "react-router-dom";
import { useTranslations } from "@/hooks/translations";
import routes from "@/routes";
import styles from "./styles.module.css";
import Title from "@/components/Title";
import MainButton from "@/components/MainButton";

function FailPaymentPage(): JSX.Element {
  const { translate } = useTranslations();
  const navigate = useNavigate();
  const isAdvisorChat = window.location.href.includes("/advisor-chat/");
  let nextRoute = routes.client.epePayment();
  if (isAdvisorChat) {
    nextRoute = routes.client.advisorChatGender();
  }
  const handleNext = () => navigate(nextRoute);

  return (
    <section className={`${styles.page} page`}>
      <img
        src="/ExclamationIcon.webp"
        alt="Exclamation Icon"
        style={{ minHeight: "180px" }}
      />
      <div className={styles.text}>
        <Title variant="h1">{translate("auweb.pay_bad.title")}</Title>
        <p className={styles.list}>{translate("auweb.pay_bad.text1")}</p>
      </div>
      <div className={styles.bottom}>
        <p className={styles.description}>{translate("auweb.pay_bad.text2")}</p>
        <MainButton className={styles.button} onClick={handleNext}>
          {translate("auweb.pay_bad.button")}
        </MainButton>
      </div>
    </section>
  );
}

export default FailPaymentPage;
