From 04e8b49c46c0d901b9c798270301021d922322be Mon Sep 17 00:00:00 2001 From: bandinopla Date: Tue, 3 Dec 2024 20:54:28 +0000 Subject: [PATCH] button to turn the snow effect off... --- public/changelog.txt | 3 +++ src/componentes/snow.js | 28 ++++++++++++++++++++++++++-- src/version.json | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/public/changelog.txt b/public/changelog.txt index 6254962..c59a1d4 100644 --- a/public/changelog.txt +++ b/public/changelog.txt @@ -1,3 +1,6 @@ +- 2.34.4 : 2024-12-03 + * requested by @Willem a way to turn off the snow effect because it made some browsers lag a lot. + - 2.34.3 : 2024-11-26 + added total reps and total sets count on the journal's post. * fixed/retouched the colors on dark mode because I know dark mode looked like shit... diff --git a/src/componentes/snow.js b/src/componentes/snow.js index c7d8ce3..a9b937a 100644 --- a/src/componentes/snow.js +++ b/src/componentes/snow.js @@ -1,13 +1,35 @@ // credit to: https://pajasevi.github.io/CSSnowflakes/ +import { useEffect, useState } from "react"; +import AcUnitIcon from '@material-ui/icons/AcUnit'; + const now = new Date(); const isChristmasSeason = now.getMonth() === 11; // December only export function Snowfall() { + const [on, setOn] = useState(false); + + useEffect(()=>{ + + const state = window.localStorage?.getItem("snow") ?? "1"; + + setOn(state=="1"); + + },[]); + + const toggleSnow = ()=>{ + const newState = on? "0" : "1"; + window.localStorage?.setItem("snow", newState); + setOn(!on); + } if (!isChristmasSeason) return; - return } + +; } // CSS styles (include in your CSS file or add inline) diff --git a/src/version.json b/src/version.json index 315b0cf..03d230e 100644 --- a/src/version.json +++ b/src/version.json @@ -1 +1 @@ -{"buildMajor":"2","buildMinor":34,"buildRevision":3,"buildTag":"RELEASE","when":"Tue, 26 Nov 2024 12:03:48 GMT"} \ No newline at end of file +{"buildMajor":"2","buildMinor":34,"buildRevision":4,"buildTag":"RELEASE","when":"Tue, 03 Dec 2024 20:44:50 GMT"} \ No newline at end of file