"use client"; import type React from "react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { BarChart3 } from "lucide-react"; export default function Home() { const [rm, setRm] = useState(""); const [nome, setNome] = useState(""); const [errors, setErrors] = useState<{ rm?: string; nome?: string; }>({}); const router = useRouter(); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); const newErrors: { rm?: string; nome?: string } = {}; if (!/^\d{5}$/.test(rm)) { newErrors.rm = "O RM deve conter exatamente 5 dígitos numéricos."; } const validPrefixes = ["22", "23", "24", "25", "19", "20", "21", "10", "13"]; if (!validPrefixes.includes(rm.substring(0, 2))) { newErrors.rm = "O RM não é valido"; } if (!nome || nome.trim().length < 3) { newErrors.nome = "Por favor, insira seu nome completo."; } if (Object.keys(newErrors).length > 0) { setErrors(newErrors); return; } setErrors({}); router.push(`/confirmar?rm=${rm}&nome=${encodeURIComponent(nome)}`); }; return (
As eleições foram encerradas, obrigado pelo seu voto!