Sets up the foundational structure for the CAR Auto Center application using Vite and React. Includes project dependencies, basic HTML structure, TypeScript configuration, and initial README content. This commit establishes the project's build tool, core libraries, and essential configuration files.
76 lines
3.1 KiB
TypeScript
76 lines
3.1 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { Lock, Info } from 'lucide-react';
|
|
|
|
export const Login: React.FC = () => {
|
|
const [email, setEmail] = useState('');
|
|
const [password, setPassword] = useState('');
|
|
const [error, setError] = useState('');
|
|
const navigate = useNavigate();
|
|
|
|
const handleLogin = (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
if (email === 'cliente@carautocenter.com.br' && password === '123456') {
|
|
localStorage.setItem('admin_auth', 'true');
|
|
navigate('/admin/dashboard');
|
|
} else {
|
|
setError('Credenciais inválidas. Tente novamente.');
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="min-h-screen bg-zinc-950 flex items-center justify-center p-4">
|
|
<div className="max-w-md w-full bg-zinc-900 border border-zinc-800 p-8 rounded-xl shadow-2xl">
|
|
<div className="text-center mb-8">
|
|
<div className="w-16 h-16 bg-[#FF6200]/10 rounded-full flex items-center justify-center mx-auto mb-4 text-[#FF6200]">
|
|
<Lock size={32} />
|
|
</div>
|
|
<h2 className="text-2xl font-bold text-white">Acesso Administrativo</h2>
|
|
<p className="text-gray-400 mt-2">CMS CAR Auto Center</p>
|
|
</div>
|
|
|
|
{/* Demo Credentials Hint */}
|
|
<div className="bg-zinc-800/50 border border-zinc-700 rounded p-3 mb-6 flex items-start gap-3">
|
|
<Info className="text-[#FF6200] shrink-0 mt-0.5" size={16} />
|
|
<div className="text-xs text-gray-300">
|
|
<p className="font-bold text-white mb-1">Credenciais de Demonstração:</p>
|
|
<p>Email: <span className="text-gray-400 font-mono">cliente@carautocenter.com.br</span></p>
|
|
<p>Senha: <span className="text-gray-400 font-mono">123456</span></p>
|
|
</div>
|
|
</div>
|
|
|
|
<form onSubmit={handleLogin} className="space-y-6">
|
|
<div>
|
|
<label className="block text-sm font-medium text-gray-400 mb-2">Email</label>
|
|
<input
|
|
type="email"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
className="w-full bg-black border border-zinc-800 rounded p-3 text-white focus:border-[#FF6200] focus:outline-none focus:ring-1 focus:ring-[#FF6200]"
|
|
placeholder="seu@email.com"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label className="block text-sm font-medium text-gray-400 mb-2">Senha</label>
|
|
<input
|
|
type="password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
className="w-full bg-black border border-zinc-800 rounded p-3 text-white focus:border-[#FF6200] focus:outline-none focus:ring-1 focus:ring-[#FF6200]"
|
|
placeholder="••••••"
|
|
/>
|
|
</div>
|
|
|
|
{error && <p className="text-red-500 text-sm text-center">{error}</p>}
|
|
|
|
<button
|
|
type="submit"
|
|
className="w-full bg-[#FF6200] text-white font-bold py-3 rounded hover:bg-orange-700 transition-colors"
|
|
>
|
|
Entrar no Painel
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
);
|
|
}; |