From 365a3883ecf4a1b679c9f6ea0c69fec09e0cfe43 Mon Sep 17 00:00:00 2001 From: YeonV Date: Mon, 17 Apr 2023 03:42:52 +0200 Subject: [PATCH] Support Matrix Rendering --- src/components/PixelGraph.tsx | 9 ++++++--- src/pages/Device/Effects.tsx | 18 +++++++++++++++++- .../DeviceCard/DeviceCard.interface.tsx | 5 +++++ src/pages/Devices/DeviceCard/DeviceCard.tsx | 2 ++ .../Devices/DeviceCard/DeviceCard.wrapper.tsx | 2 ++ src/pages/Settings/UICard.tsx | 9 ++++++++- src/store/ui/storeGeneral.tsx | 10 ++++++++++ 7 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/components/PixelGraph.tsx b/src/components/PixelGraph.tsx index 075375ee..26f3f8b0 100644 --- a/src/components/PixelGraph.tsx +++ b/src/components/PixelGraph.tsx @@ -9,12 +9,14 @@ const PixelGraph = ({ className = '', active = false, intGraphs = false, + showMatrix = false, }: { virtId: string; dummy?: boolean; className?: string; active?: boolean; intGraphs?: boolean; + showMatrix?: boolean; }) => { const [pixels, setPixels] = useState([]); const pixelGraphs = useStore((state) => state.pixelGraphs); @@ -23,7 +25,8 @@ const PixelGraph = ({ const graphs = useStore((state) => state.graphs); const rows = virtuals[virtId].is_device ? devices[virtuals[virtId].is_device]?.config?.rows || virtuals[virtId].config.rows || 1 : virtuals[virtId].config.rows || 1; - + console.log(rows, pixels[0]?.length) + useEffect(() => { const handleWebsockets = (e: any) => { if (e.detail.id === virtId) { @@ -62,7 +65,7 @@ const PixelGraph = ({ }} /> - ) : pixels && pixels[0] && pixels[0].length && rows > 1 ?
1 && showMatrix ?
{[0,1,2,3,4,5,6,7,8].map((row) => ( + >{Array.from(Array(rows).keys()).map((row) => (
{ const [fade, setFade] = useState(false); + const [matrix, setMatrix] = useState(false); const getVirtuals = useStore((state) => state.getVirtuals); const getSchemas = useStore((state) => state.getSchemas); const clearVirtualEffect = useStore((state) => state.clearVirtualEffect); @@ -171,6 +179,13 @@ const EffectsCard = ({ virtId }: { virtId: string }) => { > */} +