@@ -5,26 +5,31 @@ import Container from "@material-ui/core/Container";
5
5
import CloudUploadIcon from "@material-ui/icons/CloudUpload" ;
6
6
import css from "./index.module.less" ;
7
7
8
+ const dragsAndDrops = [
9
+ { name : "Domain" , fileType : ".pddl" , desc : "or predictes and actions." } ,
10
+ {
11
+ name : "Problem" ,
12
+ fileType : ".pddl" ,
13
+ desc : "for objects, initial state and goal." ,
14
+ } ,
15
+ {
16
+ name : "Animation" ,
17
+ fileType : ".pddl" ,
18
+ desc : "object is representation." ,
19
+ } ,
20
+ ] ;
8
21
class DropAndFetch extends React . Component {
9
22
constructor ( props ) {
10
23
super ( props ) ;
11
24
this . datas = { } ;
12
25
}
13
26
14
- state = {
15
- dragsAndDrops : [
16
- { name : "Domain" , fileType : ".pddl" , desc : "or predictes and actions." } ,
17
- {
18
- name : "Problem" ,
19
- fileType : ".pddl" ,
20
- desc : "for objects, initial state and goal." ,
21
- } ,
22
- {
23
- name : "Animation" ,
24
- fileType : ".pddl" ,
25
- desc : "object is representation." ,
26
- } ,
27
- ] ,
27
+
28
+
29
+ componentWillUnmount = ( ) => {
30
+ this . setState = ( state , callback ) => {
31
+ return ;
32
+ } ;
28
33
} ;
29
34
30
35
uploadPDDL = ( files ) => {
@@ -49,14 +54,14 @@ class DropAndFetch extends React.Component {
49
54
return resp ;
50
55
} ;
51
56
52
- handleSubmit = ( ) => {
57
+ handleSubmit = async ( ) => {
53
58
//Control check for files
54
59
if (
55
60
"domain" in this . datas &&
56
61
"problem" in this . datas &&
57
62
"animation" in this . datas
58
63
) {
59
- let resp = this . uploadPDDL ( this . datas ) ;
64
+ let resp = await this . uploadPDDL ( this . datas ) ;
60
65
console . log ( resp ) ;
61
66
} else {
62
67
console . log ( "Some files are missing" ) ;
@@ -73,7 +78,7 @@ class DropAndFetch extends React.Component {
73
78
< React . Fragment >
74
79
< div >
75
80
< Container component = "main" className = { css . dropareaBox } >
76
- { this . state . dragsAndDrops . map ( ( drag ) => (
81
+ { dragsAndDrops . map ( ( drag ) => (
77
82
< DropZone
78
83
key = { drag . name }
79
84
name = { drag . name }
@@ -83,11 +88,11 @@ class DropAndFetch extends React.Component {
83
88
/>
84
89
) ) }
85
90
</ Container >
86
- < Container maxWidth = "sm" component = "main" marginTop = "50" >
91
+ < Container maxWidth = "sm" component = "main" >
87
92
< div className = { css . buttonBox } >
88
93
< Button
89
94
variant = "contained"
90
- color = "#224878 "
95
+ color = "default "
91
96
onClick = { ( ) => this . props . onClick ( ) }
92
97
>
93
98
Cancel
0 commit comments