"use client" import { useState } from "react" import { cn } from "@/lib/utils" import { useAuth } from "@/lib/auth-context" import { Button } from "@/components/ui/button" import { Field, FieldDescription, FieldGroup, FieldLabel, } from "@/components/ui/field" import { Input } from "@/components/ui/input" export function LoginForm({ className, ...props }: React.ComponentProps<"div">) { const [handle, setHandle] = useState("") const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const { login } = useAuth() async function handleSubmit(e: React.FormEvent) { e.preventDefault() if (!handle.trim()) return setLoading(true) setError(null) try { await login(handle.trim()) } catch (e: unknown) { setError(e instanceof Error ? e.message : "Login failed") setLoading(false) } } return (

HappyView Admin

Sign in with your ATProto account to manage your AppView.
{error && (

{error}

)} Handle setHandle(e.target.value)} required disabled={loading} />
) }