import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
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 { t } = useTranslation();
  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.png"
        alt="Exclamation Icon"
        style={{ minHeight: "180px" }}
      />
      <div className={styles.text}>
        <Title variant="h1">{t("auweb.pay_bad.title")}</Title>
        <p className={styles.list}>{t("auweb.pay_bad.text1")}</p>
      </div>
      <div className={styles.bottom}>
        <p className={styles.description}>{t("auweb.pay_bad.text2")}</p>
        <MainButton className={styles.button} onClick={handleNext}>
          {t("auweb.pay_bad.button")}
        </MainButton>
      </div>
    </section>
  );
}

export default FailPaymentPage;
