@@ -2,7 +2,14 @@ import {Meta} from "@storybook/react-vite";
22import { DResizableHandle , DResizablePanel , DResizablePanelGroup } from "./DResizable" ;
33import React from "react" ;
44import { 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" ;
613import { useReactiveArrayService } from "../../utils" ;
714import { FileTabsView } from "../file-tabs/FileTabs.view" ;
815import { FileTabsService } from "../file-tabs/FileTabs.service" ;
@@ -23,10 +30,11 @@ import {
2330import { Flex } from "../flex/Flex" ;
2431import { Button } from "../button/Button" ;
2532import { Text } from "../text/Text" ;
26- import { DFlowFolder } from "../d-flow-folder" ;
33+ import { DFlowFolder , DFlowFolderHandle } from "../d-flow-folder" ;
2734import { DataTypeView , DFlowDataTypeReactiveService } from "../d-flow-data-type" ;
2835import { DFlowFunctionReactiveService , FunctionDefinitionView } from "../d-flow-function" ;
2936import { DFlowTypeReactiveService , FlowTypeView } from "../d-flow-type" ;
37+ import { Tooltip , TooltipArrow , TooltipContent , TooltipPortal , TooltipTrigger } from "../tooltip/Tooltip" ;
3038
3139const 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