import { useState, type FormEvent } from "react"; import { Button } from "@executor-js/react/components/button"; import { Input } from "@executor-js/react/components/input"; import { Label } from "@executor-js/react/components/label"; import { authClient } from "./auth-client"; import { AuthLayout } from "./auth-layout"; // First-run setup. A fresh instance has no users, so the first visitor creates // the admin account here. The server admits the first signup into the empty org // as its owner (no invite code needed); once anyone is a member, signup is // invite-gated and this page is never shown again. The auth gate renders this // when /api/setup-status reports the instance still needs setup. export const SetupPage = () => { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [busy, setBusy] = useState(false); const submit = async (event: FormEvent) => { event.preventDefault(); setBusy(true); setError(null); const result = await authClient.signUp.email({ name, email, password }); if (result.error) { setBusy(false); setError(result.error.message ?? "Could not create the admin account."); return; } window.location.href = "/"; }; return (

Set up Executor

Create the admin account for this instance. You can invite your team once you're in.

setName((e.target as HTMLInputElement).value)} autoComplete="name" required />
setEmail((e.target as HTMLInputElement).value)} autoComplete="email" required />
setPassword((e.target as HTMLInputElement).value)} autoComplete="new-password" required minLength={8} />
{error &&

{error}

}
); };