import { useState } from 'react'; import { useAuth } from '@/context/AuthContext'; import { cn } from "@/lib/utils"; 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"; export function Login({ className, ...props }: React.ComponentPropsWithoutRef<"div">) { const { login } = useAuth(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [isLoading, setIsLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setIsLoading(true); const result = await login(username, password); if (!result.success) { setError(result.error || 'Login failed'); } setIsLoading(false); }; return (