From 25cc7ab4f50c1b9ac896625f50108b93dd52d9c1 Mon Sep 17 00:00:00 2001 From: Louis Dion-Marcil Date: Wed, 3 Apr 2024 20:58:52 -0400 Subject: [PATCH] Implement "Auto Download", downloads every callback to local disk --- src/components/header/index.tsx | 25 +++++++++++++++++++++++++ src/components/header/styles.scss | 14 ++++++++++++++ src/lib/index.ts | 6 ++++++ src/lib/localStorage/index.ts | 1 + src/lib/types/storedData.ts | 1 + src/pages/homePage/index.tsx | 4 ++++ 6 files changed, 51 insertions(+) diff --git a/src/components/header/index.tsx b/src/components/header/index.tsx index aac0d86..8d55e3c 100644 --- a/src/components/header/index.tsx +++ b/src/components/header/index.tsx @@ -11,7 +11,9 @@ import { ReactComponent as ThemeDarkButtonIcon } from "assets/svg/theme_dark_but import { ReactComponent as ThemeSynthButtonIcon } from "assets/svg/theme_synth_button.svg"; import NotificationsPopup from "components/notificationsPopup"; import ResetPopup from "components/resetPopup"; +import ToggleBtn from "components/toggleBtn"; import { handleDataExport } from "lib"; +import { getStoredData, writeStoredData } from "lib/localStorage"; import { ThemeName, showThemeName } from "theme"; import "./styles.scss"; @@ -69,6 +71,19 @@ const Header = ({ ); + const data = getStoredData(); + const [inputData, setInputData] = useState({ + responseExport: data.responseExport + }); + + const handleToggleBtn = (e: any) => { + + const currentStoredData = getStoredData(); + + setInputData({ ...inputData, responseExport: e.target.checked}); + writeStoredData({ ...currentStoredData, responseExport: e.target.checked}); + }; + return ( + +
Auto Download
+
+ +
+