@@ -90,25 +90,6 @@ const FolderTree: React.FunctionComponent<IFolderTreeProps> = (props) => {
90
90
current,
91
91
} = folderTree ;
92
92
93
- const handleAddRootFolder = ( ) => {
94
- createTreeNode ?.( 'RootFolder' ) ;
95
- } ;
96
-
97
- const welcomePage = (
98
- < div data-content = { panel . id } >
99
- { entry ? (
100
- < > { entry } </ >
101
- ) : (
102
- < div style = { { padding : '10px 5px' } } >
103
- you have not yet opened a folder
104
- < Button onClick = { handleAddRootFolder } > Add Folder</ Button >
105
- </ div >
106
- ) }
107
- </ div >
108
- ) ;
109
-
110
- if ( ! data . length ) return welcomePage ;
111
-
112
93
const inputRef = useRef < HTMLInputElement > ( null ) ;
113
94
// tree context view
114
95
const contextMenu = useRef < ReturnType < typeof useContextMenu > > ( ) ;
@@ -221,6 +202,10 @@ const FolderTree: React.FunctionComponent<IFolderTreeProps> = (props) => {
221
202
onDropTree ?.( source , target ) ;
222
203
} ;
223
204
205
+ const handleAddRootFolder = ( ) => {
206
+ createTreeNode ?.( 'RootFolder' ) ;
207
+ } ;
208
+
224
209
useEffect ( ( ) => {
225
210
if ( folderPanelContextMenu . length > 0 ) {
226
211
contextMenu . current = initContextMenu ( ) ;
@@ -230,6 +215,21 @@ const FolderTree: React.FunctionComponent<IFolderTreeProps> = (props) => {
230
215
} ;
231
216
} , [ data . length ] ) ;
232
217
218
+ const welcomePage = (
219
+ < div data-content = { panel . id } >
220
+ { entry ? (
221
+ < > { entry } </ >
222
+ ) : (
223
+ < div style = { { padding : '10px 5px' } } >
224
+ you have not yet opened a folder
225
+ < Button onClick = { handleAddRootFolder } > Add Folder</ Button >
226
+ </ div >
227
+ ) }
228
+ </ div >
229
+ ) ;
230
+
231
+ if ( ! data . length ) return welcomePage ;
232
+
233
233
return (
234
234
< Scrollable noScrollX isShowShadow >
235
235
< div data-content = { panel . id } style = { { height : '100%' } } >
0 commit comments