import React, { useEffect } from 'react'; import useAppStore from './store/appStore'; import MainDashboard from './components/MainDashboard_production'; import ErrorBoundary from './components/ui/error-boundary'; import { FullPageLoader } from './components/ui/loading'; import { Card, CardHeader, CardTitle, CardContent } from './components/ui/card'; import { Button } from './components/ui/button'; import { Input } from './components/ui/input'; const LoginForm = () => { const { login, register, loading } = useAppStore(); const [isRegistering, setIsRegistering] = React.useState(false); const [formData, setFormData] = React.useState({ email: '', password: '', name: '' }); const [error, setError] = React.useState(''); const handleSubmit = async (e) => { e.preventDefault(); setError(''); const result = isRegistering ? await register(formData) : await login({ email: formData.email, password: formData.password }); if (!result.success) { setError(result.error); } }; const handleInputChange = (e) => { setFormData(prev => ({ ...prev, [e.target.name]: e.target.value })); }; return (
{isRegistering ? 'Join the Magical Order' : 'Enter the Sanctum'}