From 6d31f089dde936e75f588220c026d680529604d6 Mon Sep 17 00:00:00 2001 From: jLynx Date: Sun, 14 Jan 2024 21:37:57 +1300 Subject: [PATCH 1/4] init --- src/components/DeviceButtons/DeviceButtons.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DeviceButtons/DeviceButtons.tsx b/src/components/DeviceButtons/DeviceButtons.tsx index ba39acc..c650d5d 100644 --- a/src/components/DeviceButtons/DeviceButtons.tsx +++ b/src/components/DeviceButtons/DeviceButtons.tsx @@ -13,6 +13,7 @@ export const DeviceButtons = ({ const disableTransmitAction = false; useEffect(() => { + // Why is this not updating? console.log(disableTransmitAction); }, [disableTransmitAction]); From 8b0c00dfb5a9a11b66d31c5e4abaa07b2970e063 Mon Sep 17 00:00:00 2001 From: jLynx Date: Sun, 14 Jan 2024 21:48:37 +1300 Subject: [PATCH 2/4] WIP --- src/components/DeviceButtons/DeviceButtons.tsx | 8 ++++---- src/utils/serialUtils.tsx | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/DeviceButtons/DeviceButtons.tsx b/src/components/DeviceButtons/DeviceButtons.tsx index c650d5d..99910c4 100644 --- a/src/components/DeviceButtons/DeviceButtons.tsx +++ b/src/components/DeviceButtons/DeviceButtons.tsx @@ -7,10 +7,10 @@ export const DeviceButtons = ({ }: { autoUpdateFrame: boolean; }) => { - // const { write, disableTransmitAction } = useWriteCommand(); - const { write } = useWriteCommand(); + const { write, disableTransmitAction, loadingFrame } = useWriteCommand(); + // const { write } = useWriteCommand(); - const disableTransmitAction = false; + // const disableTransmitAction = false; useEffect(() => { // Why is this not updating? @@ -27,7 +27,7 @@ export const DeviceButtons = ({
write("button 2", autoUpdateFrame)} className="h-16 w-16 bg-green-500" shortcutKeys={"ArrowLeft"} diff --git a/src/utils/serialUtils.tsx b/src/utils/serialUtils.tsx index 43e5ad6..24e5ded 100644 --- a/src/utils/serialUtils.tsx +++ b/src/utils/serialUtils.tsx @@ -158,6 +158,7 @@ export const useWriteCommand = () => { downloadFile, uploadFile, disableTransmitAction, + loadingFrame, setLoadingFrame, }; }; From 0abcef2fc95cac0b5fe554b7df4b31b0dbac5540 Mon Sep 17 00:00:00 2001 From: jLynx Date: Sun, 14 Jan 2024 22:18:03 +1300 Subject: [PATCH 3/4] WIP --- src/app/page.tsx | 9 ++++--- .../DeviceButtons/DeviceButtons.tsx | 17 ++++++++----- .../SharedStateContext/SharedStateContext.tsx | 24 +++++++++++++++++++ src/utils/serialUtils.tsx | 18 +++++++++++--- 4 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 src/components/SharedStateContext/SharedStateContext.tsx diff --git a/src/app/page.tsx b/src/app/page.tsx index 6fe5fb1..d22e81b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,6 +3,7 @@ import dynamic from "next/dynamic"; import Controller from "@/components/Controller/Controller"; import { Loader } from "@/components/Loader/Loader"; +import SharedStateProvider from "@/components/SharedStateContext/SharedStateContext"; const Home = () => { const SerialLoader = dynamic( @@ -16,9 +17,11 @@ const Home = () => { return ( <>
- - - + + + + +