UI fixes in SessionRestoreErrorDialog

* Make the 'delete my data' button not the default
 * Make it red
 * Give it a confirmation dialog
 * Remove the 'cancel' button: what does it mean to cancel an error?
   In this case, it tried again and almost certainly got the same error.
 * Remove the top-right 'x' and don't cancel on esc for the same reason.
 * Move 'send bug report' to a button rather than a 'click here' link
 * Add a 'refresh' button which, even if it's no more likely to work,
   will at least look like it's doing something (it's mostly so if you
   don't have a bug report endpoint, there's still a button other
   than the one that deletes all your data).
This commit is contained in:
David Baker 2018-04-27 12:38:49 +01:00
parent 0323f8ed0c
commit 6d9e07580b
5 changed files with 79 additions and 43 deletions

View file

@ -1,5 +1,6 @@
/*
Copyright 2017 Aidan Gauland
Copyright 2018 New Vector Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,8 +15,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
import React from "react";
import PropTypes from "prop-types";
import { _t } from '../../../languageHandler';
@ -33,12 +32,21 @@ module.exports = React.createClass({
// onClick handler for the primary button.
onPrimaryButtonClick: PropTypes.func.isRequired,
// should there be a cancel button? default: true
hasCancel: PropTypes.bool,
// onClick handler for the cancel button.
onCancel: PropTypes.func.isRequired,
onCancel: PropTypes.func,
focus: PropTypes.bool,
},
getDefaultProps: function() {
return {
hasCancel: true,
}
},
_onCancelClick: function() {
this.props.onCancel();
},
@ -57,9 +65,9 @@ module.exports = React.createClass({
{ this.props.primaryButton }
</button>
{ this.props.children }
<button onClick={this._onCancelClick}>
{ this.props.hasCancel ? <button onClick={this._onCancelClick}>
{ _t("Cancel") }
</button>
</button> : null }
</div>
);
},