tlv84yb7n: Build the sign-in screen and signed-in placeholder shell

This commit is contained in:
2026-10-19 13:21:27 -06:00
parent 6e4cc3494b
commit 22aa454b81
8 changed files with 226 additions and 10 deletions
+45
View File
@@ -0,0 +1,45 @@
"use client";
import { useEffect, useState } from "react";
import { loadSession, type Person } from "@/lib/auth-client";
import { SignInForm } from "./SignInForm";
import { Logo } from "./Logo";
type State = { kind: "loading" } | { kind: "out" } | { kind: "in"; person: Person };
export function App() {
const [state, setState] = useState<State>({ kind: "loading" });
useEffect(() => {
let live = true;
loadSession().then((person) => {
if (live) setState(person ? { kind: "in", person } : { kind: "out" });
});
return () => {
live = false;
};
}, []);
if (state.kind === "loading") {
return (
<main className="center">
<p aria-live="polite">Loading...</p>
</main>
);
}
if (state.kind === "out") {
return <SignInForm onSignedIn={(person) => setState({ kind: "in", person })} />;
}
// Placeholder shell. The home feed and sign-out are later tasks.
return (
<main className="shell">
<header>
<Logo size={32} />
<div>
<strong>{state.person.name}</strong>
<span>{state.person.email}</span>
</div>
</header>
</main>
);
}