import Link from "next/link"; import { useRouter } from "next/navigation"; 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 LoginPage() { const router = useRouter(); const isSignUpDisabled = env("NEXT_PUBLIC_DISABLE_SIGN_UP") === "true"; const [isMagicLinkSent, setIsMagicLinkSent] = useState(false); const [magicLinkRecipient, setMagicLinkRecipient] = useState(""); const handleMagicLinkSent = (value: boolean, recipient: string) => { setIsMagicLinkSent(value); setMagicLinkRecipient(recipient); }; const { data } = authClient.useSession(); if (data?.user.id) router.push("/boards"); return ( <>

kan.bn

{isMagicLinkSent ? "Check your inbox" : "Welcome back"}

{isMagicLinkSent ? (

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

) : (
)} {!isSignUpDisabled && (

Don't have an account?{" "} Sign up

)}
); }