Landing: Enter -> login door, /login deep-link (signin mode), /signup register; onboarding scroll fix

This commit is contained in:
glass beadian 2026-10-13 08:13:33 +00:00
parent f98fca45d0
commit 27fd68c8df
4 changed files with 18 additions and 5 deletions

View file

@ -65,7 +65,10 @@ function SignInForm({ onSwitch }: { onSwitch: () => void }): React.ReactElement
export default function OnboardingPage(): React.ReactElement {
const { status, session, register, adoptToken, logout } = useAuth();
const offline = status === "offline";
const [mode, setMode] = useState<"register" | "signin">("register");
// /login deep-links here in sign-in mode; the default entry is create-account.
const [mode, setMode] = useState<"register" | "signin">(
typeof window !== "undefined" && window.location.search.includes("mode=signin") ? "signin" : "register",
);
const [step, setStep] = useState(0);
const [name, setName] = useState("");
// Collectives opt-in (operator reorder #2): default OFF = solo account.
@ -148,7 +151,7 @@ export default function OnboardingPage(): React.ReactElement {
// Signed-in visitors who land here (e.g. from the sidebar) get a way out rather than a second registration form.
if (status === "authenticated" && session !== null && step === 0) {
return (
<div className="flex h-full items-center justify-center p-6">
<div className="flex min-h-full items-center justify-center p-6">
<Card className="w-[520px] max-w-full p-6">
<h2 className="mb-1 text-base font-semibold">You&apos;re signed in</h2>
<p className="mb-6 text-xs text-text-faint">

View file

@ -0,0 +1,9 @@
import { redirect } from "next/navigation";
/**
* /login — the sign-in door. The onboarding page holds both forms; this route
* deep-links into sign-in mode (register stays the default at /signup).
*/
export default function LoginRedirect(): React.ReactElement {
redirect("/onboarding?mode=signin");
}

View file

@ -88,7 +88,7 @@ function ManualLanding(): React.ReactElement {
useEffect(() => {
const onKey = (e: KeyboardEvent): void => {
if (e.key === "Enter" && e.target === document.body && !e.shiftKey) {
router.push(status === "authenticated" ? "/streams" : "/onboarding");
router.push(status === "authenticated" ? "/streams" : "/login");
}
};
window.addEventListener("keydown", onKey);
@ -133,7 +133,7 @@ function ManualLanding(): React.ReactElement {
))}
</div>
<Link
href={status === "authenticated" ? "/streams" : "/onboarding"}
href={status === "authenticated" ? "/streams" : "/login"}
className="shrink-0 rounded-md bg-accent px-3 py-1.5 text-2xs font-medium text-white hover:bg-accent-hover"
>
{status === "authenticated"
@ -158,7 +158,7 @@ function ManualLanding(): React.ReactElement {
// create-account forms. A join link itself arrives from outside
// (the only /join route is /join/[token]); starting/solo need the
// same forms, so one destination is honest for all three.
const href = "/onboarding";
const href = "/onboarding?mode=register";
return (
<li key={path.id}>
<Link