Skip to content

Commit f10e3d3

Browse files
authored
Merge pull request #614 from MetaCell/feature/519
Feature/519
2 parents a457ba3 + 0424951 commit f10e3d3

1 file changed

Lines changed: 23 additions & 17 deletions

File tree

webapp/components/topbar/dialogs/ActionDialog.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,25 @@ class ActionDialog extends React.Component {
7272
if (errorMessage === '') {
7373
title = this.props.title;
7474
action = (
75-
<Button
76-
id="appBarPerformActionButton"
77-
key="appBarPerformActionButton"
78-
variant="contained"
79-
color="primary"
80-
onClick={this.performAction}
75+
<>
76+
<Button
77+
onClick={this.cancelDialog}
78+
style={styles.cancel}
79+
key="CANCEL"
8180
>
82-
{this.props.buttonLabel}
81+
CANCEL
8382
</Button>
83+
<Button
84+
id="appBarPerformActionButton"
85+
key="appBarPerformActionButton"
86+
variant="contained"
87+
color="primary"
88+
onClick={this.performAction}
89+
>
90+
{this.props.buttonLabel}
91+
</Button>
92+
</>
93+
8494
);
8595

8696
content = this.props.children;
@@ -89,10 +99,10 @@ class ActionDialog extends React.Component {
8999
<Button
90100
variant="contained"
91101
color="primary"
92-
key="BACK"
102+
key="CLOSE"
93103
onClick={() => this.handleClickGoBack()}
94104
>
95-
BACK
105+
CLOSE
96106
</Button>
97107
);
98108

@@ -102,11 +112,13 @@ class ActionDialog extends React.Component {
102112
}
103113
}
104114

115+
const shouldDisplay = Boolean(!this.state.hide || this.props.openErrorDialogBox);
105116
return (
117+
shouldDisplay ?(
106118
<Dialog
107119
fullWidth
108120
maxWidth={this.props.openErrorDialogBox ? 'md' : 'sm'}
109-
open={Boolean(!this.state.hide || this.props.openErrorDialogBox)}
121+
open={shouldDisplay}
110122
onClose={() => this.cancelDialog()}
111123
className={classes.root}
112124
>
@@ -115,16 +127,10 @@ class ActionDialog extends React.Component {
115127
{content}
116128
</DialogContent>
117129
<DialogActions>
118-
<Button
119-
onClick={this.cancelDialog}
120-
style={styles.cancel}
121-
key="CANCEL"
122-
>
123-
CANCEL
124-
</Button>
125130
{action}
126131
</DialogActions>
127132
</Dialog>
133+
): <></>
128134
);
129135
}
130136
}

0 commit comments

Comments
 (0)