"use client" import { signIn } from "next-auth/react" import { useState } from "react" import { useSearchParams, useRouter } from "next/navigation" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Alert, AlertDescription } from "@/components/ui/alert" import { Loader2 } from "lucide-react" export default function SignInPage() { const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState(null) const searchParams = useSearchParams() const router = useRouter() const urlError = searchParams.get("error") const callbackUrl = searchParams.get("callbackUrl") || "/admin" const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setIsLoading(true) setError(null) const formData = new FormData(e.currentTarget) const email = formData.get("email") as string const password = formData.get("password") as string try { const result = await signIn("credentials", { email, password, redirect: false, }) if (result?.error) { setError("Invalid email or password. Please try again.") } else if (result?.ok) { // Successful signin - redirect to admin router.push(callbackUrl) router.refresh() } } catch (error) { setError("An error occurred during sign in. Please try again.") } finally { setIsLoading(false) } } return (
Sign In Access the United Tattoo Studio admin dashboard {(error || urlError) && ( {error || (urlError === "CredentialsSignin" ? "Invalid email or password. Please try again." : "An error occurred during sign in. Please try again." )} )} {/* Credentials Form */}
{/* Development Note */}

For development testing:

Use any email/password combination.
Admin: nicholai@biohazardvfx.com

) }