diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 44837c56..5383544e 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -1,86 +1,36 @@ "use client"; -import { Suspense, useState } from "react"; +import { Suspense } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { AuthCard, AuthFooterLink } from "@/components/auth/auth-card"; -import { useAuth } from "@/components/auth/auth-provider"; -import { AuthError } from "@/lib/auth"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; +import { LoginForm } from "@/components/auth/login-form"; -function LoginForm() { +function LoginContent() { const router = useRouter(); const params = useSearchParams(); - const { logIn } = useAuth(); - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [error, setError] = useState(null); - const [submitting, setSubmitting] = useState(false); - - async function onSubmit(e: React.SyntheticEvent) { - e.preventDefault(); - setError(null); - setSubmitting(true); - try { - await logIn(email, password); - router.push(params.get("next") ?? "/profile"); - router.refresh(); - } catch (err) { - setError(err instanceof AuthError ? err.message : "Login failed."); - setSubmitting(false); - } - } return ( - - - + } > -
-
- - setEmail(e.target.value)} - /> -
-
- - setPassword(e.target.value)} - /> -
-
- {error ?

{error}

: null} - -
+ { + router.push(params.get("next") ?? "/u/me"); + router.refresh(); + }} + />
); } export default function LoginPage() { - // useSearchParams must be inside Suspense for Next.js streaming. return ( - + ); } diff --git a/app/(auth)/signup/page.tsx b/app/(auth)/signup/page.tsx index 57c57a63..012ecec2 100644 --- a/app/(auth)/signup/page.tsx +++ b/app/(auth)/signup/page.tsx @@ -1,37 +1,11 @@ "use client"; -import { useState } from "react"; import { useRouter } from "next/navigation"; import { AuthCard, AuthFooterLink } from "@/components/auth/auth-card"; -import { useAuth } from "@/components/auth/auth-provider"; -import { AuthError } from "@/lib/auth"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; +import { SignUpForm } from "@/components/auth/signup-form"; export default function SignUpPage() { const router = useRouter(); - const { signUp } = useAuth(); - const [name, setName] = useState(""); - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [error, setError] = useState(null); - const [submitting, setSubmitting] = useState(false); - - async function onSubmit(e: React.SyntheticEvent) { - e.preventDefault(); - setError(null); - setSubmitting(true); - try { - await signUp(email, password, name); - router.push("/profile"); - router.refresh(); - } catch (err) { - setError(err instanceof AuthError ? err.message : "Sign-up failed."); - setSubmitting(false); - } - } - return ( } > -
-
- - setName(e.target.value)} - /> -
- -
- - setEmail(e.target.value)} - /> -
- -
- - setPassword(e.target.value)} - /> -

At least 8 characters.

-
-
- {error ?

{error}

: null} - -
+ { + router.push("/u/me"); + router.refresh(); + }} + />
); } diff --git a/app/books/chapter-viewer.tsx b/app/books/chapter-viewer.tsx index 131e3055..9c840b13 100644 --- a/app/books/chapter-viewer.tsx +++ b/app/books/chapter-viewer.tsx @@ -390,7 +390,11 @@ export function ChapterViewer({ return ( <> {/* ---- Sidebar: Verse Index ---- */} -