import { SIGN_IN_LINK_MINUTES } from "@/lib/signin-link"; import type { Metadata } from "next"; import { Suspense } from "react"; import { AuthShell, primaryButton } from "../_components/auth-shell"; import { requestSignInLink } from "./actions"; export const metadata: Metadata = { title: "Sign in — SchemaTax", robots: { index: false, follow: false }, }; const ERRORS: Record = { InvalidEmail: "Enter a valid email address.", Verification: "That sign-in link has expired or was already used. Ask for a new one below.", AccessDenied: "That address can't sign in.", }; const FALLBACK_ERROR = "We couldn't send the link just now. Try again in a moment."; function first(value: string | string[] | undefined): string | undefined { return Array.isArray(value) ? value[0] : value; } export default function SignInPage({ searchParams }: PageProps<"/signin">) { return ( }> ); } async function SignInState({ searchParams, }: Pick, "searchParams">) { const params = await searchParams; const sent = first(params.sent); // Auth.js's own verify-request redirect carries type=email and no address. if (sent || first(params.type) === "email") return ; const error = first(params.error); return ( ); } function SignInForm({ error }: { error: string | null }) { return ( <>

Sign in to SchemaTax

We’ll email you a link. No password needed.

{error && (

{error}

)}
); } function CheckInbox({ email }: { email: string | null }) { return ( <>

Check your inbox

We sent a link to{" "} {email ? ( {email} ) : ( "your email address" )} . It works once and expires in {SIGN_IN_LINK_MINUTES} minutes.

Use a different address ); }