| 1 | "use client"; |
| 2 | |
| 3 | import { useLogger } from "@/lib/logger"; |
| 4 | import { useState } from "react"; |
| 5 | import { State, SignupForm, SignupState } from "./signup-form"; |
| 6 | import SignupSuccess from "./signup-success"; |
| 7 | |
| 8 | export function Index() { |
| 9 | const log = useLogger("Register/Page"); |
| 10 | const [state, setState] = useState(State.LOADED); |
| 11 | |
| 12 | const registerCallback = (state: SignupState) => { |
| 13 | log.debug("Register callback", state); |
| 14 | if (state === SignupState.SUCCESS) { |
| 15 | setState(State.SUCCESS); |
| 16 | } else { |
| 17 | setState(State.ERROR); |
| 18 | } |
| 19 | } |
| 20 | const view = state === State.SUCCESS ? <SignupSuccess /> : <SignupForm registerCallback={registerCallback} />; |
| 21 | |
| 22 | return ( |
| 23 | <div className="prose prose-sm prose-invert max-w-none"> |
| 24 | <div className="grid grid-cols-1 gap-6 lg:grid-cols-3"> |
| 25 | {view} |
| 26 | </div> |
| 27 | </div> |
| 28 | ); |
| 29 | } |