@@ -22,11 +22,33 @@ const ExportIcon = props => <SvgIcon {...props}><svg viewBox='0 0 750 750'><path
2222const ImportIcon = props => < SvgIcon { ...props } > < svg viewBox = '0 0 750 750' > < path d = 'M16 288c-8.84 0-16 7.16-16 16v32c0 8.84 7.16 16 16 16h112v-64H16zm336-152V0H152c-13.3 0-24 10.7-24 24v264h127.99v-65.18c0-14.28 17.29-21.41 27.36-11.27l95.7 96.43c6.6 6.65 6.6 17.39 0 24.04l-95.7 96.42c-10.06 10.14-27.36 3.01-27.36-11.27V352H128v136c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H376c-13.2 0-24-10.8-24-24zm153-31L407.1 7c-4.5-4.5-10.6-7-17-7H384v128h128v-6.1c0-6.3-2.5-12.4-7-16.9z' > </ path > </ svg > </ SvgIcon > ;
2323const CellTemplateIcon = props => < SvgIcon { ...props } > < svg viewBox = "0 0 448 512" > < path d = "M448 75.2v361.7c0 24.3-19 43.2-43.2 43.2H43.2C19.3 480 0 461.4 0 436.8V75.2C0 51.1 18.8 32 43.2 32h361.7c24 0 43.1 18.8 43.1 43.2zm-37.3 361.6V75.2c0-3-2.6-5.8-5.8-5.8h-9.3L285.3 144 224 94.1 162.8 144 52.5 69.3h-9.3c-3.2 0-5.8 2.8-5.8 5.8v361.7c0 3 2.6 5.8 5.8 5.8h361.7c3.2.1 5.8-2.7 5.8-5.8zM150.2 186v37H76.7v-37h73.5zm0 74.4v37.3H76.7v-37.3h73.5zm11.1-147.3l54-43.7H96.8l64.5 43.7zm210 72.9v37h-196v-37h196zm0 74.4v37.3h-196v-37.3h196zm-84.6-147.3l64.5-43.7H232.8l53.9 43.7zM371.3 335v37.3h-99.4V335h99.4z" > </ path > </ svg > </ SvgIcon > ;
2424
25+ const OPTIONS = {
26+ Load : { component : LoadFile , } ,
27+ Save : { component : SaveFile } ,
28+ ImportHLS : {
29+ component : ImportExportHLS ,
30+ mode : 'IMPORT'
31+ } ,
32+ ExportHLS : {
33+ component : ImportExportHLS ,
34+ mode : 'EXPORT'
35+ } ,
36+ ImportCellTemplate : { component : ImportCellParams , } ,
37+ NewModel : { component : NewModel , } ,
38+ UploadFiles : {
39+ component : UploadDownloadFiles ,
40+ mode : 'UPLOAD'
41+ } ,
42+ DownloadFiles : {
43+ component : UploadDownloadFiles ,
44+ mode : 'DOWNLOAD'
45+ } ,
46+ }
47+
2548export default class NetPyNEToolBar extends React . Component {
2649 constructor ( props ) {
2750 super ( props ) ;
2851 this . state = {
29- openDialogBox : false ,
3052 open : false ,
3153 openSnackBar : false ,
3254 action : null
@@ -35,69 +57,73 @@ export default class NetPyNEToolBar extends React.Component {
3557 }
3658
3759 handleMenuItemClick = action => {
38- this . setState ( { action :action , openDialogBox :true , open : false } )
60+ this . props . openDrawerDialogBox ( )
61+ this . setState ( { action :action , open : false } )
3962 }
4063
4164 handleOpenSnackBar ( message ) {
4265 this . snackBarMessage = message
4366 this . setState ( { openSnackBar : true } )
4467 }
4568
46-
69+ handleClose ( ) {
70+ this . setState ( { open : false } )
71+ this . props . closeDrawerDialogBox ( )
72+ }
4773 render ( ) {
4874
49- if ( this . state . openDialogBox ) {
75+ if ( this . props . dialogBoxOpen ) {
5076 switch ( this . state . action ) {
5177 case 'Load' :
5278 var content = < LoadFile
53- open = { this . state . openDialogBox }
54- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
79+ open = { this . props . dialogBoxOpen }
80+ onRequestClose = { ( ) => this . handleClose ( ) }
5581 />
5682 break ;
5783 case 'Save' :
5884 var content = < SaveFile
59- open = { this . state . openDialogBox }
60- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
85+ open = { this . props . dialogBoxOpen }
86+ onRequestClose = { ( ) => this . handleClose ( ) }
6187 />
6288 break ;
6389 case 'ImportHLS' :
6490 var content = < ImportExportHLS
65- open = { this . state . openDialogBox }
66- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
91+ open = { this . props . dialogBoxOpen }
92+ onRequestClose = { ( ) => this . handleClose ( ) }
6793 mode = { "IMPORT" } />
6894 break ;
6995 case 'ExportHLS' :
7096 var content = < ImportExportHLS
71- open = { this . state . openDialogBox }
72- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
97+ open = { this . props . dialogBoxOpen }
98+ onRequestClose = { ( ) => this . handleClose ( ) }
7399 mode = { "EXPORT" }
74100 />
75101 break ;
76102 case 'ImportCellTemplate' :
77103 var content = < ImportCellParams
78- open = { this . state . openDialogBox }
79- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
104+ open = { this . props . dialogBoxOpen }
105+ onRequestClose = { ( ) => this . handleClose ( ) }
80106 />
81107 break ;
82108 case 'NewModel' :
83109 var content = < NewModel
84- open = { this . state . openDialogBox }
85- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
110+ open = { this . props . dialogBoxOpen }
111+ onRequestClose = { ( ) => this . handleClose ( ) }
86112 />
87113 break ;
88114 case 'UploadFiles' :
89115 var content = < UploadDownloadFiles
90- open = { this . state . openDialogBox }
91- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
116+ open = { this . props . dialogBoxOpen }
117+ onRequestClose = { ( ) => this . handleClose ( ) }
92118 openSnackBar = { message => {
93119 this . handleOpenSnackBar ( message )
94120 } }
95121 mode = { "UPLOAD" } />
96122 break ;
97123 case 'DownloadFiles' :
98124 var content = < UploadDownloadFiles
99- open = { this . state . openDialogBox }
100- onRequestClose = { ( ) => this . setState ( { openDialogBox : false } ) }
125+ open = { this . props . dialogBoxOpen }
126+ onRequestClose = { ( ) => this . handleClose ( ) }
101127 openSnackBar = { message => {
102128 this . handleOpenSnackBar ( message )
103129 } }
0 commit comments