From 816997803a26d0dbbeca1eb2d22c437575829a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Carvalho?= Date: Tue, 11 Aug 2026 07:31:19 -0300 Subject: [PATCH] fix(ClickParticles): clear remaining particles and remove click effects when animations are disabled (#178) --- src/components/common/ClickParticles.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) => (