Skip to content

Commit d2bd2bd

Browse files
committed
feat: add Folder component with flow management buttons and tooltips in DResizable stories
1 parent 18eff5a commit d2bd2bd

File tree

1 file changed

+106
-4
lines changed

1 file changed

+106
-4
lines changed

src/components/d-resizable/DResizable.stories.tsx

Lines changed: 106 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import {Meta} from "@storybook/react-vite";
22
import {DResizableHandle, DResizablePanel, DResizablePanelGroup} from "./DResizable";
33
import React from "react";
44
import {DFullScreen} from "../d-fullscreen/DFullScreen";
5-
import {IconDatabase, IconFile, IconMessageChatbot} from "@tabler/icons-react";
5+
import {
6+
IconArrowsMaximize,
7+
IconArrowsMinimize,
8+
IconCircleDot,
9+
IconDatabase,
10+
IconFile,
11+
IconMessageChatbot
12+
} from "@tabler/icons-react";
613
import {useReactiveArrayService} from "../../utils";
714
import {FileTabsView} from "../file-tabs/FileTabs.view";
815
import {FileTabsService} from "../file-tabs/FileTabs.service";
@@ -23,10 +30,11 @@ import {
2330
import {Flex} from "../flex/Flex";
2431
import {Button} from "../button/Button";
2532
import {Text} from "../text/Text";
26-
import {DFlowFolder} from "../d-flow-folder";
33+
import {DFlowFolder, DFlowFolderHandle} from "../d-flow-folder";
2734
import {DataTypeView, DFlowDataTypeReactiveService} from "../d-flow-data-type";
2835
import {DFlowFunctionReactiveService, FunctionDefinitionView} from "../d-flow-function";
2936
import {DFlowTypeReactiveService, FlowTypeView} from "../d-flow-type";
37+
import {Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipTrigger} from "../tooltip/Tooltip";
3038

3139
const meta: Meta = {
3240
title: "Dashboard Resizable",
@@ -80,6 +88,42 @@ export const Dashboard = () => {
8088
nodes: {
8189
nodes: []
8290
}
91+
}, {
92+
id: "gid://sagittarius/Flow/2",
93+
type: {
94+
id: "gid://sagittarius/FlowType/867",
95+
},
96+
name: "de/codezero/examples-2/REST Flow",
97+
settings: {
98+
nodes: [{
99+
flowSettingIdentifier: "HTTP_URL",
100+
}, {
101+
flowSettingIdentifier: "HTTP_METHOD",
102+
}, {
103+
flowSettingIdentifier: "HTTP_HOST",
104+
}]
105+
},
106+
nodes: {
107+
nodes: []
108+
}
109+
}, {
110+
id: "gid://sagittarius/Flow/3",
111+
type: {
112+
id: "gid://sagittarius/FlowType/867",
113+
},
114+
name: "en/codezero/examples/REST Flow",
115+
settings: {
116+
nodes: [{
117+
flowSettingIdentifier: "HTTP_URL",
118+
}, {
119+
flowSettingIdentifier: "HTTP_METHOD",
120+
}, {
121+
flowSettingIdentifier: "HTTP_HOST",
122+
}]
123+
},
124+
nodes: {
125+
nodes: []
126+
}
83127
}]);
84128
// @ts-ignore
85129
const [flowTypeStore, flowTypeService] = useReactiveArrayService<FlowTypeView, DFlowTypeReactiveService>(DFlowTypeReactiveService, [...FlowTypeData.map(data => new FlowTypeView(data))]);
@@ -112,8 +156,8 @@ export const Dashboard = () => {
112156
</Flex>
113157
}>
114158
<DResizablePanelGroup direction={"horizontal"}>
115-
<DResizablePanel id={"1"} order={1} p={1} defaultSize={15}>
116-
<DFlowFolder activeFlowId={"gid://sagittarius/Flow/1"}/>
159+
<DResizablePanel id={"1"} order={1} defaultSize={15}>
160+
<Folder/>
117161
</DResizablePanel>
118162
<DResizableHandle/>
119163
<DResizablePanel id={"2"} order={2}>
@@ -132,4 +176,62 @@ export const Dashboard = () => {
132176
</ContextStoreProvider>
133177
</DFullScreen>
134178

179+
}
180+
181+
const Folder = () => {
182+
183+
const ref = React.useRef<DFlowFolderHandle>(null)
184+
185+
return <DLayout topContent={
186+
<Flex style={{gap: "0.35rem"}} align={"center"} justify={"space-between"} p={0.75}>
187+
<Button paddingSize={"xxs"} variant={"filled"} color={"success"}>
188+
<Text>Create new flow</Text>
189+
</Button>
190+
<Flex style={{gap: "0.35rem"}}>
191+
<Tooltip>
192+
<TooltipTrigger asChild>
193+
<Button variant={"none"} paddingSize={"xxs"} onClick={() => ref.current?.openActivePath()}>
194+
<IconCircleDot size={16}/>
195+
</Button>
196+
</TooltipTrigger>
197+
<TooltipPortal>
198+
<TooltipContent>
199+
<Text>Open active flow</Text>
200+
<TooltipArrow/>
201+
</TooltipContent>
202+
</TooltipPortal>
203+
</Tooltip>
204+
<Tooltip>
205+
<TooltipTrigger asChild>
206+
<Button variant={"none"} paddingSize={"xxs"} onClick={() => ref.current?.closeAll()}>
207+
<IconArrowsMinimize size={16}/>
208+
</Button>
209+
</TooltipTrigger>
210+
<TooltipPortal>
211+
<TooltipContent>
212+
<Text>Close all</Text>
213+
<TooltipArrow/>
214+
</TooltipContent>
215+
</TooltipPortal>
216+
</Tooltip>
217+
<Tooltip>
218+
<TooltipTrigger asChild>
219+
<Button paddingSize={"xxs"} variant={"none"} onClick={() => ref.current?.openAll()}>
220+
<IconArrowsMaximize size={16}/>
221+
</Button>
222+
</TooltipTrigger>
223+
<TooltipPortal>
224+
<TooltipContent>
225+
<Text>Open all</Text>
226+
<TooltipArrow/>
227+
</TooltipContent>
228+
</TooltipPortal>
229+
</Tooltip>
230+
</Flex>
231+
</Flex>
232+
}>
233+
<div style={{padding: "0.75rem"}}>
234+
<DFlowFolder ref={ref} activeFlowId={"gid://sagittarius/Flow/1"}/>
235+
</div>
236+
</DLayout>
135237
}

0 commit comments

Comments
 (0)