'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { useAuth } from './contexts/AuthContext' export default function LoginPage() { const [username, setUsername] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const { login } = useAuth() const router = useRouter() const handleSubmit = (e: React.FormEvent) => { e.preventDefault() setError('') if (login(username, password)) { router.push('/dashboard') } else { setError('Invalid credentials') } } return (