11import { ReactNode , memo , useCallback , useMemo , useState } from "react"
22import styled from "styled-components"
33import { Button , Space , Tooltip , theme } from "antd"
4- import { FunctionOutlined , ControlOutlined , CloseOutlined , AppstoreOutlined } from "@ant-design/icons"
4+ import { FunctionOutlined , ControlOutlined , CloseOutlined , PartitionOutlined , NodeIndexOutlined } from "@ant-design/icons"
55import { FXes } from "./FXes"
66import { Flows } from "./Flows"
77import { LeftNav } from "../common/LeftNav"
@@ -13,6 +13,7 @@ import { activityMaterialCategories, activityMaterialLocales } from "../minion-m
1313import { IActivityMaterial } from "@rxdrag/minions-schema"
1414import { Toolbar } from "./Toolbar"
1515import { useThemeMode } from "@rxdrag/react-core"
16+ import { ComponentTree } from "./ComponentTree"
1617
1718const Content = styled . div `
1819 flex: 1;
@@ -24,6 +25,7 @@ const SaveButton = styled(Button)`
2425`
2526
2627enum NavType {
28+ componentTree = "componentTree" ,
2729 toolbox = "toolbox" ,
2830 flows = "flows" ,
2931 fxes = "fxes" ,
@@ -43,6 +45,10 @@ export const FlowDesigner = memo(() => {
4345 return materials . concat ( ...activityMaterialCategories . map ( category => category . materials ) )
4446 } , [ ] )
4547
48+ const handleToggleComponents = useCallback ( ( ) => {
49+ setNavType ( type => type === NavType . componentTree ? null : NavType . componentTree )
50+ } , [ ] )
51+
4652 const handleToggleToolbox = useCallback ( ( ) => {
4753 setNavType ( type => type === NavType . toolbox ? null : NavType . toolbox )
4854 } , [ ] )
@@ -73,17 +79,25 @@ export const FlowDesigner = memo(() => {
7379 < Tooltip title = "元件箱" placement = "right" >
7480 < Button
7581 type = { navType === NavType . toolbox ? "link" : "text" }
76- icon = { < AppstoreOutlined /> }
82+ icon = { < NodeIndexOutlined /> }
7783 onClick = { handleToggleToolbox }
7884 />
7985 </ Tooltip >
86+ < Tooltip title = "组件树" placement = "right" >
87+ < Button
88+ type = { navType === NavType . componentTree ? "link" : "text" }
89+ icon = { < PartitionOutlined /> }
90+ onClick = { handleToggleComponents }
91+ />
92+ </ Tooltip >
8093 < Tooltip title = "编排" placement = "right" >
8194 < Button
8295 type = { navType === NavType . flows ? "link" : "text" }
8396 icon = { < ControlOutlined /> }
8497 onClick = { handleToggleFlows }
8598 />
8699 </ Tooltip >
100+
87101 < Tooltip title = "子编排" placement = "right" >
88102 < Button
89103 type = { navType === NavType . fxes ? "link" : "text" }
@@ -100,10 +114,16 @@ export const FlowDesigner = memo(() => {
100114 minWidth = { 160 }
101115 >
102116 < Title >
117+ {
118+ NavType . componentTree === navType &&
119+ < span >
120+ 组件树
121+ </ span >
122+ }
103123 {
104124 NavType . toolbox === navType &&
105125 < span >
106- 元件
126+ 元件箱
107127 </ span >
108128 }
109129 {
@@ -125,6 +145,10 @@ export const FlowDesigner = memo(() => {
125145 onClick = { handleCloseLeft }
126146 />
127147 </ Title >
148+ {
149+ navType === NavType . componentTree &&
150+ < ComponentTree />
151+ }
128152 {
129153 navType === NavType . toolbox &&
130154 < Toolbox materialCategories = { activityMaterialCategories } />
0 commit comments