import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; import { t } from "@lingui/core/macro"; import { Trans } from "@lingui/react/macro"; import { env } from "next-runtime-env"; import { useState } from "react"; import { authClient } from "@kan/auth/client"; import { Auth } from "~/components/AuthForm"; import { PageHead } from "~/components/PageHead"; import PatternedBackground from "~/components/PatternedBackground"; export default function SignUpPage() { const router = useRouter(); const isSignUpDisabled = env("NEXT_PUBLIC_DISABLE_SIGN_UP") === "true"; const [isMagicLinkSent, setIsMagicLinkSent] = useState(false); const [magicLinkRecipient, setMagicLinkRecipient] = useState(""); const redirect = useSearchParams().get("next"); const { data } = authClient.useSession(); if (data?.user.id) router.push("/boards"); const handleMagicLinkSent = (value: boolean, recipient: string) => { setIsMagicLinkSent(value); setMagicLinkRecipient(recipient); }; const isInviteFlow = redirect?.startsWith("/invite/"); if (isSignUpDisabled && !isInviteFlow) { return ( <>

kan.bn

{t`Sign up disabled`}

{t`Sign up is currently disabled. Please try again later.`}

); } return ( <>

kan.bn

{isMagicLinkSent ? t`Check your inbox` : t`Get started`}

{isMagicLinkSent ? (

Click on the link we've sent to {magicLinkRecipient} to sign in.

) : (
)}

Already have an account?{" "} Sign in

); }