From 57cb3b33cc98fb8bf0a4397712139956aa7894f1 Mon Sep 17 00:00:00 2001 From: Joao Pedro Date: Mon, 10 Aug 2026 21:46:46 -0300 Subject: [PATCH] fix(ClickParticles): clear remaining particles and remove click effects when animations are disabled --- 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) => (