pairing device modal: display errors if any

pull/725/head
Audric Ackermann 6 years ago
parent 14561d33f5
commit 2765b6c146

@ -55,6 +55,22 @@ export class DevicePairingDialog extends React.Component<Props, State> {
this.closeDialog(); this.closeDialog();
} }
public renderErrors() {
const { errors } = this.state;
return (
<>
{errors && (
<>
<div className="spacer-xs" />
<div className="session-label danger">{errors}</div>
</>
)}
</>
);
}
public renderFilterRequestsView() { public renderFilterRequestsView() {
const { currentPubKey, accepted, deviceAlias } = this.state; const { currentPubKey, accepted, deviceAlias } = this.state;
let secretWords: undefined; let secretWords: undefined;
@ -70,6 +86,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
onClose={this.closeDialog} onClose={this.closeDialog}
> >
<div className="session-modal__centered"> <div className="session-modal__centered">
{this.renderErrors()}
<input <input
type="text" type="text"
onChange={this.handleUpdateDeviceAlias} onChange={this.handleUpdateDeviceAlias}
@ -96,6 +113,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
onClose={this.closeDialog} onClose={this.closeDialog}
> >
<div className="session-modal__centered"> <div className="session-modal__centered">
{this.renderErrors()}
<label>{window.i18n('secretWords')}</label> <label>{window.i18n('secretWords')}</label>
<div className="text-subtle">{secretWords}</div> <div className="text-subtle">{secretWords}</div>
<div className="session-modal__button-group"> <div className="session-modal__button-group">
@ -125,6 +143,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
return ( return (
<SessionModal title={title} onOk={() => null} onClose={this.closeDialog}> <SessionModal title={title} onOk={() => null} onClose={this.closeDialog}>
<div className="session-modal__centered"> <div className="session-modal__centered">
{this.renderErrors()}
<h4>{window.i18n('waitingForDeviceToRegister')}</h4> <h4>{window.i18n('waitingForDeviceToRegister')}</h4>
<small className="text-subtle"> <small className="text-subtle">
{window.i18n('pairNewDevicePrompt')} {window.i18n('pairNewDevicePrompt')}
@ -182,6 +201,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
onClose={this.closeDialog} onClose={this.closeDialog}
> >
<div className="session-modal__centered"> <div className="session-modal__centered">
{this.renderErrors()}
<p className="session-modal__description"> <p className="session-modal__description">
{window.i18n('confirmUnpairingTitle')} {window.i18n('confirmUnpairingTitle')}
<br /> <br />
@ -280,9 +300,6 @@ export class DevicePairingDialog extends React.Component<Props, State> {
if (conv) { if (conv) {
conv.setNickname(this.state.deviceAlias); conv.setNickname(this.state.deviceAlias);
} }
// FIXME display error somewhere
// FIXME display list of linked device
// FIXME do not show linked device in list of contacts // FIXME do not show linked device in list of contacts
console.log('FIXME'); console.log('FIXME');

Loading…
Cancel
Save