mirror of https://github.com/vector-im/riot-web
Use DialogButtons in UnknownDeviceDialog
Use DialogButtons to eliminate duplicate button code.pull/21833/head
parent
2674fcb6d3
commit
e6dbc3b863
|
@ -187,18 +187,11 @@ export default React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
let sendButton;
|
const sendButtonOnClick = haveUnknownDevices ? this._onSendAnywayClicked : this._onSendClicked;
|
||||||
if (haveUnknownDevices) {
|
const sendButtonLabel = haveUnknownDevices ? this.props.sendAnywayLabel : this.props.sendAnywayLabel;
|
||||||
sendButton = <button onClick={this._onSendAnywayClicked}>
|
|
||||||
{ this.props.sendAnywayLabel }
|
|
||||||
</button>;
|
|
||||||
} else {
|
|
||||||
sendButton = <button onClick={this._onSendClicked}>
|
|
||||||
{ this.props.sendLabel }
|
|
||||||
</button>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
return (
|
return (
|
||||||
<BaseDialog className='mx_UnknownDeviceDialog'
|
<BaseDialog className='mx_UnknownDeviceDialog'
|
||||||
onFinished={this.props.onFinished}
|
onFinished={this.props.onFinished}
|
||||||
|
@ -213,14 +206,9 @@ export default React.createClass({
|
||||||
|
|
||||||
<UnknownDeviceList devices={this.props.devices} />
|
<UnknownDeviceList devices={this.props.devices} />
|
||||||
</GeminiScrollbar>
|
</GeminiScrollbar>
|
||||||
<div className="mx_Dialog_buttons">
|
<DialogButtons primaryButton={sendButtonLabel}
|
||||||
{sendButton}
|
onPrimaryButtonClick={sendButtonOnClick}
|
||||||
<button className="mx_Dialog_primary" autoFocus={true}
|
onCancel={this._onDismissClicked} />
|
||||||
onClick={this._onDismissClicked}
|
|
||||||
>
|
|
||||||
{_t("Dismiss")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
// XXX: do we want to give the user the option to enable blacklistUnverifiedDevices for this room (or globally) at this point?
|
// XXX: do we want to give the user the option to enable blacklistUnverifiedDevices for this room (or globally) at this point?
|
||||||
|
|
Loading…
Reference in New Issue