aboutsummaryrefslogtreecommitdiff
path: root/app/votar
diff options
context:
space:
mode:
authorzwlucas <lucas.oliveira1676@etec.sp.gov.br>2025-04-01 11:19:35 +0000
committerzwlucas <lucas.oliveira1676@etec.sp.gov.br>2025-04-01 11:19:35 +0000
commita871cf8d8339f5dea203f9fc17d978ee1932c8e0 (patch)
tree20fdc21537ff324ad8a958a616602da790cdbd5b /app/votar
parent4702b783ca217449fda31915efba0d26fa1be0af (diff)
downloadeleicoes-a871cf8d8339f5dea203f9fc17d978ee1932c8e0.tar.gz
eleicoes-a871cf8d8339f5dea203f9fc17d978ee1932c8e0.zip
new vote audio and vote list page
Diffstat (limited to 'app/votar')
-rw-r--r--app/votar/page.tsx33
1 files changed, 20 insertions, 13 deletions
diff --git a/app/votar/page.tsx b/app/votar/page.tsx
index 8946f73..62c1bb1 100644
--- a/app/votar/page.tsx
+++ b/app/votar/page.tsx
@@ -19,6 +19,7 @@ export default function VotarPage() {
const cpf = searchParams.get("cpf") || "";
const [selectedOption, setSelectedOption] = useState<string | null>(null);
const [audioContext, setAudioContext] = useState<AudioContext | null>(null);
+ const [audioElement, setAudioElement] = useState<HTMLAudioElement>()
useEffect(() => {
if (!rm || !nome || !cpf) {
@@ -26,28 +27,34 @@ export default function VotarPage() {
return;
}
- setAudioContext(
- new (window.AudioContext || (window as any).webkitContext)()
- );
+ // setAudioContext(
+ // new (window.AudioContext || (window as any).webkitContext)()
+ // );
+
+ const audio = new Audio('/confirma.mp3')
+ setAudioElement(audio)
}, [rm, nome, cpf, router]);
const handleVote = (option: string) => {
setSelectedOption(option);
- if (!audioContext) return;
+ if (!audioElement) return;
+ audioElement.play()
+
+ // if (!audioContext) return;
- const oscillator = audioContext.createOscillator();
- const gainNode = audioContext.createGain();
+ // 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.type = "sine";
+ // oscillator.frequency.setValueAtTime(1000, audioContext.currentTime);
+ // gainNode.gain.setValueAtTime(0.5, audioContext.currentTime);
- oscillator.connect(gainNode);
- gainNode.connect(audioContext.destination);
+ // oscillator.connect(gainNode);
+ // gainNode.connect(audioContext.destination);
- oscillator.start();
- oscillator.stop(audioContext.currentTime + 0.2);
+ // oscillator.start();
+ // oscillator.stop(audioContext.currentTime + 0.2);
setTimeout(() => {
router.push(