165 lines
6.4 KiB
TypeScript
165 lines
6.4 KiB
TypeScript
"use client"
|
|
|
|
import type React from "react"
|
|
|
|
import { useState } from "react"
|
|
import { useRouter } from "next/navigation"
|
|
import Link from "next/link"
|
|
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"
|
|
import { Eye, EyeOff, ArrowLeft, Stethoscope, Mail, Lock } from "lucide-react"
|
|
|
|
export default function PatientLogin() {
|
|
const [showPassword, setShowPassword] = useState(false)
|
|
const [email, setEmail] = useState("")
|
|
const [password, setPassword] = useState("")
|
|
const [isLoading, setIsLoading] = useState(false)
|
|
const router = useRouter()
|
|
|
|
const handleLogin = async (e: React.FormEvent) => {
|
|
e.preventDefault()
|
|
setIsLoading(true)
|
|
|
|
// Simulação de login - em produção, conectar com API real
|
|
setTimeout(() => {
|
|
if (email && password) {
|
|
// Salvar dados do usuário no localStorage para simulação
|
|
localStorage.setItem(
|
|
"patientData",
|
|
JSON.stringify({
|
|
name: "João Silva",
|
|
email: email,
|
|
phone: "(11) 99999-9999",
|
|
cpf: "123.456.789-00",
|
|
birthDate: "1990-01-01",
|
|
address: "Rua das Flores, 123 - São Paulo, SP",
|
|
}),
|
|
)
|
|
router.push("/patient/dashboard")
|
|
}
|
|
setIsLoading(false)
|
|
}, 1000)
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 flex items-center justify-center p-4">
|
|
<div className="w-full max-w-md">
|
|
<div className="mb-8">
|
|
<Link
|
|
href="/"
|
|
className="inline-flex items-center text-slate-600 hover:text-blue-600 transition-colors duration-200 font-medium"
|
|
>
|
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
|
Voltar ao início
|
|
</Link>
|
|
</div>
|
|
|
|
<Card className="shadow-xl border-0 bg-white/80 backdrop-blur-sm">
|
|
<CardHeader className="text-center pb-8">
|
|
<div className="mx-auto w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4">
|
|
<Stethoscope className="w-8 h-8 text-blue-600" />
|
|
</div>
|
|
<CardTitle className="text-3xl font-bold text-slate-800 mb-2">Área do Paciente</CardTitle>
|
|
<CardDescription className="text-slate-600 text-base">
|
|
Acesse sua conta para gerenciar consultas e laudos
|
|
</CardDescription>
|
|
</CardHeader>
|
|
|
|
<CardContent className="px-8 pb-8">
|
|
<form onSubmit={handleLogin} className="space-y-6">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="email" className="text-slate-700 font-medium">
|
|
Email
|
|
</Label>
|
|
<div className="relative">
|
|
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 w-5 h-5" />
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
placeholder="seu@email.com"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
className="pl-11 h-12 border-slate-200 focus:border-blue-500 focus:ring-blue-500"
|
|
required
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<Label htmlFor="password" className="text-slate-700 font-medium">
|
|
Senha
|
|
</Label>
|
|
<div className="relative">
|
|
<Lock className="absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400 w-5 h-5" />
|
|
<Input
|
|
id="password"
|
|
type={showPassword ? "text" : "password"}
|
|
placeholder="Sua senha"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
className="pl-11 pr-12 h-12 border-slate-200 focus:border-blue-500 focus:ring-blue-500"
|
|
required
|
|
/>
|
|
<Button
|
|
type="button"
|
|
variant="ghost"
|
|
size="sm"
|
|
className="absolute right-2 top-1/2 transform -translate-y-1/2 h-8 w-8 p-0 hover:bg-slate-100"
|
|
onClick={() => setShowPassword(!showPassword)}
|
|
>
|
|
{showPassword ? (
|
|
<EyeOff className="h-4 w-4 text-slate-400" />
|
|
) : (
|
|
<Eye className="h-4 w-4 text-slate-400" />
|
|
)}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<Button
|
|
type="submit"
|
|
className="w-full h-12 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition-all duration-200 shadow-lg hover:shadow-xl disabled:opacity-50"
|
|
disabled={isLoading}
|
|
>
|
|
{isLoading ? (
|
|
<div className="flex items-center">
|
|
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
|
Entrando...
|
|
</div>
|
|
) : (
|
|
"Entrar na minha conta"
|
|
)}
|
|
</Button>
|
|
</form>
|
|
|
|
<div className="mt-8 text-center">
|
|
<div className="relative">
|
|
<div className="absolute inset-0 flex items-center">
|
|
<div className="w-full border-t border-slate-200"></div>
|
|
</div>
|
|
<div className="relative flex justify-center text-sm">
|
|
<span className="px-4 bg-white text-slate-500">Novo por aqui?</span>
|
|
</div>
|
|
</div>
|
|
<div className="mt-4">
|
|
<Link
|
|
href="/patient/register"
|
|
className="inline-flex items-center justify-center w-full h-12 border border-slate-200 rounded-lg text-slate-700 hover:bg-slate-50 transition-colors duration-200 font-medium"
|
|
>
|
|
Criar nova conta
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
<div className="mt-8 text-center">
|
|
<p className="text-sm text-slate-500">Problemas para acessar? Entre em contato conosco</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|