UI spinner when clicking "they don't match"

This commit is contained in:
Bruno Windels 2020-02-25 13:18:27 +01:00
parent 2127edb7b8
commit b0c87b0eaf

View file

@ -48,6 +48,11 @@ export default class VerificationShowSas extends React.Component {
this.props.onDone(); this.props.onDone();
}; };
onDontMatchClick = () => {
this.setState({ cancelling: true });
this.props.onCancel();
};
render() { render() {
let sasDisplay; let sasDisplay;
let sasCaption; let sasCaption;
@ -98,9 +103,14 @@ export default class VerificationShowSas extends React.Component {
} }
let confirm; let confirm;
if (this.state.pending || this.state.cancelling) {
let text;
if (this.state.pending) { if (this.state.pending) {
const {displayName} = this.props; const {displayName} = this.props;
const text = _t("Waiting for %(displayName)s to verify…", {displayName}); text = _t("Waiting for %(displayName)s to verify…", {displayName});
} else {
text = _t("Waiting for network…");
}
confirm = <PendingActionSpinner text={text} />; confirm = <PendingActionSpinner text={text} />;
} else { } else {
// FIXME: stop using DialogButtons here once this component is only used in the right panel verification // FIXME: stop using DialogButtons here once this component is only used in the right panel verification
@ -109,7 +119,7 @@ export default class VerificationShowSas extends React.Component {
onPrimaryButtonClick={this.onMatchClick} onPrimaryButtonClick={this.onMatchClick}
primaryButtonClass="mx_UserInfo_wideButton" primaryButtonClass="mx_UserInfo_wideButton"
cancelButton={_t("They don't match")} cancelButton={_t("They don't match")}
onCancel={this.props.onCancel} onCancel={this.onDontMatchClick}
cancelButtonClass="mx_UserInfo_wideButton" cancelButtonClass="mx_UserInfo_wideButton"
/>; />;
} }