diff --git a/src/components/common/ClickParticles.tsx b/src/components/common/ClickParticles.tsx index 3e0628b..90f6c7b 100644 --- a/src/components/common/ClickParticles.tsx +++ b/src/components/common/ClickParticles.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from "react"; +import { useConfig } from "../../context/LauncherContext"; const SGA_CHARS = "abcdefghijklmnopqrstuvwxyz".split(""); @@ -15,7 +16,11 @@ interface Particle { export const ClickParticles: React.FC = React.memo(() => { const [bursts, setBursts] = useState([]); + const { animationsEnabled } = useConfig(); + useEffect(() => { + if (!animationsEnabled) return; + const handlePressSound = (e: MouseEvent) => { const newParticles: Particle[] = []; const particleCount = 8; @@ -40,8 +45,14 @@ export const ClickParticles: React.FC = React.memo(() => { window.addEventListener("mousedown", handlePressSound); return () => window.removeEventListener("mousedown", handlePressSound); - }, []); + }, [animationsEnabled]); + useEffect(() => { + if (!animationsEnabled) { + setBursts([]); + } + }, [animationsEnabled]) + return (
{bursts.map((p) => (