import { redirect } from "next/navigation"

import { overview } from "@/constants/routes/myPages"
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"

import LoginButton from "@/components/LoginButton"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"

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

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

export default async function SignUpVerification({
  dynamic_content,
}: SignUpVerificationProps) {
  const user = await getProfileSafely()
  if (user) {
    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>
  )
}
