feat: confetti

Closes #5
This commit is contained in:
2026-03-11 10:39:51 +01:00
parent dfc8ace186
commit e59a588a9d
2 changed files with 39 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
import { Link } from "@tanstack/react-router";
import { useState } from "react";
import confetti from "canvas-confetti";
import { useEffect, useRef, useState } from "react";
import { CountdownBanner } from "@/components/homepage/CountdownBanner";
import { PerformerForm } from "@/components/registration/PerformerForm";
import { SuccessScreen } from "@/components/registration/SuccessScreen";
@@ -8,6 +9,33 @@ import { WatcherForm } from "@/components/registration/WatcherForm";
import { authClient } from "@/lib/auth-client";
import { useRegistrationOpen } from "@/lib/useRegistrationOpen";
function fireConfetti() {
const colors = ["#d82560", "#52979b", "#d09035", "#214e51", "#ffffff"];
confetti({
particleCount: 120,
spread: 80,
origin: { x: 0.3, y: 0.6 },
colors,
});
setTimeout(() => {
confetti({
particleCount: 120,
spread: 80,
origin: { x: 0.7, y: 0.6 },
colors,
});
}, 200);
setTimeout(() => {
confetti({
particleCount: 80,
spread: 100,
origin: { x: 0.5, y: 0.5 },
colors,
});
}, 400);
}
type RegistrationType = "performer" | "watcher";
interface SuccessState {
@@ -19,6 +47,15 @@ interface SuccessState {
export default function EventRegistrationForm() {
const { data: session } = authClient.useSession();
const { isOpen } = useRegistrationOpen();
const confettiFired = useRef(false);
useEffect(() => {
if (isOpen && !confettiFired.current) {
confettiFired.current = true;
fireConfetti();
}
}, [isOpen]);
const [selectedType, setSelectedType] = useState<RegistrationType | null>(
null,
);