import React, { useState } from 'react'; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { useAuth } from "@/hooks/useAuth"; import { useToast } from "@/hooks/use-toast"; interface LoginPageProps { onLogin: () => void; } export const LoginPage = ({ onLogin }: LoginPageProps) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const { signIn } = useAuth(); const { toast } = useToast(); const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); try { const { error } = await signIn(email, password); if (error) { toast({ title: "Login Error", description: error.message, variant: "destructive" }); return; } toast({ title: "Success", description: "Logged in successfully!" }); onLogin(); } catch (err) { toast({ title: "Error", description: "An unexpected error occurred", variant: "destructive" }); } finally { setLoading(false); } }; return (
{/* Left side with purple gradient */}

Cash Management Dashboard

Real-time Cash Reconciliation – Ensuring Accuracy & Transparency

{/* Right side with login form */}

Sign In to Your Dashboard

setEmail(e.target.value)} className="w-full h-12 px-4 border border-gray-300 rounded-lg focus:border-purple-500 focus:ring-purple-500" disabled={loading} />
setPassword(e.target.value)} className="w-full h-12 px-4 border border-gray-300 rounded-lg focus:border-purple-500 focus:ring-purple-500" disabled={loading} />
); };