@@ -5,12 +5,14 @@ import { useHistory } from 'react-router-dom';
55
66import { PropertiesTab } from '../../../pages/editor/properties-tab/PropertiesTab' ;
77import { tabListStore } from '../../stores' ;
8- import { DownloadService , openContextMenu , ProjectsStorage } from '../../services' ;
8+ import { DownloadService , FlowToJs , openContextMenu , ProjectsStorage } from '../../services' ;
99import { useEditorContext } from '../../hooks' ;
1010import { TabButtonSimple } from '../tabs' ;
1111import { TabList } from '../tab-list' ;
1212import { Modal } from '../modal' ;
1313import './ToolBar.css' ;
14+ import { ProjectParser } from '../../models' ;
15+ import { EComponentType } from '../../enuns' ;
1416
1517export const ToolBar : React . FC = memo ( ( ) => {
1618 const [ isOpenModalProps , setIsOpenModalProps ] = useState ( false ) ;
@@ -58,8 +60,27 @@ export const ToolBar: React.FC = memo(() => {
5860 } , [ ] ) ;
5961
6062 const handleExport = useCallback ( ( ) => {
61- DownloadService . downloadFilesAsZip ( [ { name : 'src' , isFolder : true , children : [ ] } ] ) ;
62- } , [ ] ) ;
63+ DownloadService . downloadFilesAsZip ( [
64+ { name : '.codeeasy' , isFolder : true , children : [ { name : 'config' , type : 'json' , isFolder : false , content : ProjectParser . stringify ( project ) } ] } ,
65+ { name : 'package' , type : 'json' , isFolder : false , content : '{}' } ,
66+ { name : 'Routes' , type : 'js' , isFolder : false , content : '' } ,
67+ { name : 'index' , type : 'js' , isFolder : false , content : '' } ,
68+ {
69+ name : 'src' ,
70+ isFolder : true ,
71+ children : project . tabs . value . map ( tab => ( {
72+ name : tab . label . value ,
73+ isFolder : true ,
74+ children : tab . items . value . map ( treeItem => ( {
75+ isFolder : treeItem . type . value === EComponentType . grouper ,
76+ content : FlowToJs ( treeItem , treeItem . items . value ) ,
77+ name : treeItem . label . value ,
78+ type : 'js' ,
79+ } ) )
80+ } ) )
81+ } ,
82+ ] ) ;
83+ } , [ project ] ) ;
6384
6485 const openMoreOption = useCallback ( ( e : React . MouseEvent < HTMLButtonElement , MouseEvent > ) => {
6586 openContextMenu ( e . clientX , 35 , [
0 commit comments