Disable signature image upload if you are signed out of Mailspring ID

This commit is contained in:
Ben Gotow 2021-04-25 13:02:09 -05:00
parent 30ef802f84
commit dae008534b

View file

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { localized, PropTypes, MailspringAPIRequest } from 'mailspring-exports'; import { localized, PropTypes, MailspringAPIRequest, IdentityStore } from 'mailspring-exports';
import { RetinaImg, DropZone } from 'mailspring-component-kit'; import { RetinaImg, DropZone } from 'mailspring-component-kit';
const MAX_IMAGE_RES = 250; const MAX_IMAGE_RES = 250;
@ -157,6 +157,8 @@ export default class SignaturePhotoPicker extends React.Component<
// we don't display the <input> for data URLs because they can be // we don't display the <input> for data URLs because they can be
// long and the UI becomes slow. // long and the UI becomes slow.
const isMailspringURL = resolvedURL && resolvedURL.includes('getmailspring.com'); const isMailspringURL = resolvedURL && resolvedURL.includes('getmailspring.com');
const isUploadEnabled = IdentityStore.identity() !== null;
const dropNote = const dropNote =
resolvedURL && resolvedURL !== '' resolvedURL && resolvedURL !== ''
? localized('Click to replace') ? localized('Click to replace')
@ -169,6 +171,7 @@ export default class SignaturePhotoPicker extends React.Component<
<div className="field photo-picker"> <div className="field photo-picker">
<label>Picture</label> <label>Picture</label>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{isUploadEnabled && (
<div> <div>
<DropZone <DropZone
onClick={this._onChooseImage} onClick={this._onChooseImage}
@ -189,6 +192,7 @@ export default class SignaturePhotoPicker extends React.Component<
)} )}
</DropZone> </DropZone>
</div> </div>
)}
<div className="photo-options"> <div className="photo-options">
<select <select
id="photoURL" id="photoURL"
@ -223,7 +227,7 @@ export default class SignaturePhotoPicker extends React.Component<
))} ))}
</div> </div>
</div> </div>
<div className="drop-note">{dropNote}</div> {isUploadEnabled && <div className="drop-note">{dropNote}</div>}
</div> </div>
); );
} }