From 79670b4c51ebbdd242b894a5f0678618054cc2ef Mon Sep 17 00:00:00 2001 From: zwlucas Date: Mon, 31 Mar 2025 23:34:04 -0300 Subject: create eletrocast-eleicoes --- app/votar/page.tsx | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 app/votar/page.tsx (limited to 'app/votar/page.tsx') diff --git a/app/votar/page.tsx b/app/votar/page.tsx new file mode 100644 index 0000000..8946f73 --- /dev/null +++ b/app/votar/page.tsx @@ -0,0 +1,113 @@ +"use client"; + +import { useState, useEffect } from "react"; +import { useRouter, useSearchParams } from "next/navigation"; +import { Button } from "@/components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +export default function VotarPage() { + const router = useRouter(); + const searchParams = useSearchParams(); + const rm = searchParams.get("rm") || ""; + const nome = searchParams.get("nome") || ""; + const cpf = searchParams.get("cpf") || ""; + const [selectedOption, setSelectedOption] = useState(null); + const [audioContext, setAudioContext] = useState(null); + + useEffect(() => { + if (!rm || !nome || !cpf) { + router.push("/"); + return; + } + + setAudioContext( + new (window.AudioContext || (window as any).webkitContext)() + ); + }, [rm, nome, cpf, router]); + + const handleVote = (option: string) => { + setSelectedOption(option); + + if (!audioContext) return; + + const oscillator = audioContext.createOscillator(); + const gainNode = audioContext.createGain(); + + oscillator.type = "sine"; + oscillator.frequency.setValueAtTime(1000, audioContext.currentTime); + gainNode.gain.setValueAtTime(0.5, audioContext.currentTime); + + oscillator.connect(gainNode); + gainNode.connect(audioContext.destination); + + oscillator.start(); + oscillator.stop(audioContext.currentTime + 0.2); + + setTimeout(() => { + router.push( + `/obrigado?rm=${rm}&nome=${encodeURIComponent( + nome + )}&cpf=${cpf}&option=${option}` + ); + }, 500); + }; + + return ( +
+
+
+
+
+ JUSTIÇA ELEITORAL +
+
+
+
+ + + + SEU VOTO PARA + + CHAPA DO GREMIO ESTUDANTIL + + + +
+ + +
+
+ Toque no quadro correspondente para VOTAR +
+
+
+ +
+
+ © {new Date().getFullYear()} Justiça Eleitoral Estudantil +
+
+
+
+ ); +} -- cgit v1.2.3