fix: move plotblock to plotview

Plots should be types of views instead of blocks. This corrects that.
This commit is contained in:
Sylvia Crowe 2024-05-15 13:36:50 -07:00
parent a093486607
commit c826d8e840
5 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import { atoms } from "@/store/global";
import { TerminalView } from "@/app/view/term"; import { TerminalView } from "@/app/view/term";
import { PreviewView } from "@/app/view/preview"; import { PreviewView } from "@/app/view/preview";
import { PlotView } from "@/app/view/plotview";
import { CenteredLoadingDiv } from "@/element/quickelems"; import { CenteredLoadingDiv } from "@/element/quickelems";
import "./block.less"; import "./block.less";
@ -32,6 +33,8 @@ const Block = ({ blockId }: { blockId: string }) => {
blockElem = <TerminalView blockId={blockId} />; blockElem = <TerminalView blockId={blockId} />;
} else if (blockData.view === "preview") { } else if (blockData.view === "preview") {
blockElem = <PreviewView blockId={blockId} />; blockElem = <PreviewView blockId={blockId} />;
} else if (blockData.view === "plot") {
blockElem = <PlotView />;
} }
return ( return (
<div className="block" ref={blockRef}> <div className="block" ref={blockRef}>

View File

@ -18,7 +18,7 @@ const blockId2 = uuidv4();
const blockId3 = uuidv4(); const blockId3 = uuidv4();
const tabArr: TabData[] = [ 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] }, { name: "Tab 2", tabid: tabId2, blockIds: [blockId3] },
]; ];
@ -34,7 +34,7 @@ const blockAtomFamily = atomFamily<string, jotai.Atom<BlockData>>((blockId: stri
}); });
} }
if (blockId === blockId3) { if (blockId === blockId3) {
return jotai.atom({ blockid: blockId3, view: "term" }); return jotai.atom({ blockid: blockId3, view: "plot" });
} }
return jotai.atom(null); return jotai.atom(null);
}); });

View File

@ -5,7 +5,6 @@ import * as React from "react";
import * as jotai from "jotai"; import * as jotai from "jotai";
import { Block } from "@/app/block/block"; import { Block } from "@/app/block/block";
import { atoms } from "@/store/global"; import { atoms } from "@/store/global";
import { PlotBlock } from "@/app/block/plotblock";
import "./tab.less"; import "./tab.less";
@ -24,7 +23,6 @@ const TabContent = ({ tabId }: { tabId: string }) => {
</div> </div>
); );
})} })}
<PlotBlock />
</div> </div>
); );
}; };

View File

@ -24,7 +24,7 @@ function evalAsync(Plot: any, d3: any, funcText: string): Promise<unknown> {
}); });
} }
function PlotBlock() { function PlotView() {
const containerRef = React.useRef<HTMLInputElement>(); const containerRef = React.useRef<HTMLInputElement>();
const [plotDef, setPlotDef] = React.useState<string>(); const [plotDef, setPlotDef] = React.useState<string>();
/* /*
@ -99,4 +99,4 @@ function PlotBlock() {
); );
} }
export { PlotBlock }; export { PlotView };