import { redirect } from "next/navigation"

import { overview } from "@/constants/routes/myPages"

import { auth } from "@/auth"
import LoginButton from "@/components/LoginButton"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { isValidSession } from "@/utils/session"

import styles from "./signUpVerification.module.css"

import type { SignUpVerificationProps } from "@/types/components/blocks/dynamicContent"

export default async function SignUpVerification({
  dynamic_content,
}: SignUpVerificationProps) {
  const session = await auth()
  if (isValidSession(session)) {
    redirect(overview[getLang()])
  }
  const intl = await getIntl()

  return (
    <div className={styles.container}>
      <LoginButton
        className={styles.loginButton}
        trackingId="signUpVerificationLogin"
        position="sign up verification"
        variant="signupVerification"
      >
        {intl.formatMessage({ id: "Proceed to login" })}
      </LoginButton>
    </div>
  )
}
