Skip to content

Commit 220863d

Browse files
committed
feat: integrate FlowExecutionWatcherComponent and refactor tab management with Zustand store
1 parent c7a9211 commit 220863d

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • src/app/(flow)/namespace/[namespaceId]/project/[projectId]/flow/[flowId]

src/app/(flow)/namespace/[namespaceId]/project/[projectId]/flow/[flowId]/page.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
} from "@code0-tech/pictor/dist/components/resizable/Resizable";
1515
import {Layout} from "@code0-tech/pictor/dist/components/layout/Layout";
1616
import {FlowExecutionResultView} from "@edition/flow/views/FlowExecutionResultView";
17+
import {FlowExecutionWatcherComponent} from "@edition/flow/components/FlowExecutionWatcherComponent";
18+
import {useFlowViewStore} from "@edition/flow/hooks/Flow.view.hook";
1719
import {useHotkeys} from "react-hotkeys-hook";
1820
import {Node, useReactFlow} from "@xyflow/react";
1921

@@ -28,17 +30,18 @@ export default function Page() {
2830
const flowIndex = params.flowId as any as number
2931
const flowId: Flow['id'] = `gid://sagittarius/Flow/${flowIndex}`
3032

31-
const [tab, setTab] = React.useState<string | undefined>(undefined);
33+
const tab = useFlowViewStore(s => s.tab)
34+
const toggleTab = useFlowViewStore(s => s.toggleTab)
3235
const reactFlow = useReactFlow()
3336

3437
useHotkeys('shift+1', (keyboardEvent) => {
35-
setTab(prevState => prevState === "file" ? undefined : "file")
38+
toggleTab("file")
3639
keyboardEvent.stopPropagation()
3740
keyboardEvent.preventDefault()
3841
}, [])
3942

4043
useHotkeys('shift+2', (keyboardEvent) => {
41-
setTab(prevState => prevState === "execution" ? undefined : "execution")
44+
toggleTab("execution")
4245
keyboardEvent.stopPropagation()
4346
keyboardEvent.preventDefault()
4447
}, [])
@@ -57,15 +60,16 @@ export default function Page() {
5760
}, [tab, reactFlow])
5861

5962
return <ResizablePanel id={"2"}>
63+
<FlowExecutionWatcherComponent/>
6064
<Layout layoutGap={0} showLayoutSplitter={false} rightContent={
6165
<Flex pl={0.7} style={{flexDirection: "column", gap: "0.7rem"}}>
6266
<Button aria-selected={tab === "file"}
63-
onClick={() => setTab(prevState => prevState === "file" ? undefined : "file")} variant={"none"}
67+
onClick={() => toggleTab("file")} variant={"none"}
6468
paddingSize={"xs"}>
6569
<IconFile size={16}/>
6670
</Button>
6771
<Button aria-selected={tab === "execution"}
68-
onClick={() => setTab(prevState => prevState === "execution" ? undefined : "execution")}
72+
onClick={() => toggleTab("execution")}
6973
variant={"none"}
7074
paddingSize={"xs"}>
7175
<IconPlayerPlay size={16}/>

0 commit comments

Comments
 (0)