From 5fcaaf761a10cd9a3af38e64e0df0d7391e32d29 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Sun, 18 May 2025 12:43:07 +0200 Subject: [PATCH] chore: rename state variables --- .../components/app/twentytwentytwenty.svelte | 28 +++++++++---------- src/lib/state.svelte.ts | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/lib/components/app/twentytwentytwenty.svelte b/src/lib/components/app/twentytwentytwenty.svelte index abc2328..785cdce 100644 --- a/src/lib/components/app/twentytwentytwenty.svelte +++ b/src/lib/components/app/twentytwentytwenty.svelte @@ -17,10 +17,10 @@ const defaultFirst = 20 * 60; const defaultSecond = 20; - if (!appState.firstTimer) appState.firstTimer = defaultFirst; - if (!appState.secondTimer) appState.secondTimer = defaultSecond; + if (!appState.workRuleTimer) appState.workRuleTimer = defaultFirst; + if (!appState.restRuleTimer) appState.restRuleTimer = defaultSecond; - timeLeft = appState.firstTimer; + timeLeft = appState.workRuleTimer; }); function playSound(element: HTMLAudioElement) { @@ -52,20 +52,20 @@ } else { if (workPhase) { workPhase = false; - timeLeft = appState.secondTimer; + timeLeft = appState.restRuleTimer; playSound(startSoundElement); } else { workPhase = true; - timeLeft = appState.firstTimer; + timeLeft = appState.workRuleTimer; playSound(endSoundElement); - appState.is202020active = false; + appState.is202020Active = false; } } }, 1000); } $effect(() => { - if (appState.is202020active) { + if (appState.is202020Active) { startCountdown(); } else if (intervalHandle) { clearInterval(intervalHandle); @@ -76,26 +76,26 @@ if (intervalHandle) { clearInterval(intervalHandle); intervalHandle = null; - appState.is202020active = false; + appState.is202020Active = false; } }; }); function startTimer() { reset(); - timeLeft = appState.firstTimer; + timeLeft = appState.workRuleTimer; workPhase = true; - appState.is202020active = true; + appState.is202020Active = true; } function stopTimer() { reset(); - appState.is202020active = false; + appState.is202020Active = false; } function reset() { - appState.firstTimer = 20 * 60; // 20 * 60 on prod - appState.secondTimer = 20; // 20 on prod + appState.workRuleTimer = 20 * 60; // 20 * 60 on prod + appState.restRuleTimer = 20; // 20 on prod } @@ -130,7 +130,7 @@