"use client"; import {useRef} from "react"; import {Button} from "@nextui-org/react"; import {trackEvent} from "@/utils/va"; export const CustomButton = () => { const buttonRef = useRef(null); const handleConfetti = async () => { const {clientWidth, clientHeight} = document.documentElement; const boundingBox = buttonRef.current?.getBoundingClientRect?.(); const targetY = boundingBox?.y ?? 0; const targetX = boundingBox?.x ?? 0; const targetWidth = boundingBox?.width ?? 0; const targetCenterX = targetX + targetWidth / 2; const confetti = (await import("canvas-confetti")).default; confetti({ zIndex: 999, particleCount: 100, spread: 70, origin: { y: targetY / clientHeight, x: targetCenterX / clientWidth, }, }); trackEvent("LandingPage - Confetti Button", { action: "press", category: "landing-page", }); }; return ( ); };