From c826d8e8407569d218af3e084b1ea47d7e8bb4ec Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Wed, 15 May 2024 13:36:50 -0700 Subject: [PATCH] fix: move plotblock to plotview Plots should be types of views instead of blocks. This corrects that. --- frontend/app/block/block.tsx | 3 +++ frontend/app/store/global.ts | 4 ++-- frontend/app/tab/tab.tsx | 2 -- frontend/app/{block/plotblock.less => view/plotview.less} | 0 frontend/app/{block/plotblock.tsx => view/plotview.tsx} | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) rename frontend/app/{block/plotblock.less => view/plotview.less} (100%) rename frontend/app/{block/plotblock.tsx => view/plotview.tsx} (98%) diff --git a/frontend/app/block/block.tsx b/frontend/app/block/block.tsx index d6232ee0d..b934d1104 100644 --- a/frontend/app/block/block.tsx +++ b/frontend/app/block/block.tsx @@ -7,6 +7,7 @@ import { atoms } from "@/store/global"; import { TerminalView } from "@/app/view/term"; import { PreviewView } from "@/app/view/preview"; +import { PlotView } from "@/app/view/plotview"; import { CenteredLoadingDiv } from "@/element/quickelems"; import "./block.less"; @@ -32,6 +33,8 @@ const Block = ({ blockId }: { blockId: string }) => { blockElem = ; } else if (blockData.view === "preview") { blockElem = ; + } else if (blockData.view === "plot") { + blockElem = ; } return (
diff --git a/frontend/app/store/global.ts b/frontend/app/store/global.ts index c9e64297f..1d4e03e1f 100644 --- a/frontend/app/store/global.ts +++ b/frontend/app/store/global.ts @@ -18,7 +18,7 @@ const blockId2 = uuidv4(); const blockId3 = uuidv4(); const tabArr: TabData[] = [ - { name: "Tab 1", tabid: tabId1, blockIds: [blockId1, blockId2] }, + { name: "Tab 1", tabid: tabId1, blockIds: [blockId1, blockId2, blockId3] }, { name: "Tab 2", tabid: tabId2, blockIds: [blockId3] }, ]; @@ -34,7 +34,7 @@ const blockAtomFamily = atomFamily>((blockId: stri }); } if (blockId === blockId3) { - return jotai.atom({ blockid: blockId3, view: "term" }); + return jotai.atom({ blockid: blockId3, view: "plot" }); } return jotai.atom(null); }); diff --git a/frontend/app/tab/tab.tsx b/frontend/app/tab/tab.tsx index c6763e344..cb71ce9c0 100644 --- a/frontend/app/tab/tab.tsx +++ b/frontend/app/tab/tab.tsx @@ -5,7 +5,6 @@ import * as React from "react"; import * as jotai from "jotai"; import { Block } from "@/app/block/block"; import { atoms } from "@/store/global"; -import { PlotBlock } from "@/app/block/plotblock"; import "./tab.less"; @@ -24,7 +23,6 @@ const TabContent = ({ tabId }: { tabId: string }) => {
); })} - ); }; diff --git a/frontend/app/block/plotblock.less b/frontend/app/view/plotview.less similarity index 100% rename from frontend/app/block/plotblock.less rename to frontend/app/view/plotview.less diff --git a/frontend/app/block/plotblock.tsx b/frontend/app/view/plotview.tsx similarity index 98% rename from frontend/app/block/plotblock.tsx rename to frontend/app/view/plotview.tsx index 04653e027..59bb2222b 100644 --- a/frontend/app/block/plotblock.tsx +++ b/frontend/app/view/plotview.tsx @@ -24,7 +24,7 @@ function evalAsync(Plot: any, d3: any, funcText: string): Promise { }); } -function PlotBlock() { +function PlotView() { const containerRef = React.useRef(); const [plotDef, setPlotDef] = React.useState(); /* @@ -99,4 +99,4 @@ function PlotBlock() { ); } -export { PlotBlock }; +export { PlotView };