mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-02 09:24:45 +08:00
Disable signature image upload if you are signed out of Mailspring ID
This commit is contained in:
parent
30ef802f84
commit
dae008534b
1 changed files with 26 additions and 22 deletions
|
@ -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,26 +171,28 @@ 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' }}>
|
||||||
<div>
|
{isUploadEnabled && (
|
||||||
<DropZone
|
<div>
|
||||||
onClick={this._onChooseImage}
|
<DropZone
|
||||||
onDragStateChange={({ isDropping }) => this.setState({ isDropping })}
|
onClick={this._onChooseImage}
|
||||||
onDrop={e => this._onChooseImageFilePath(e.dataTransfer.files[0].path)}
|
onDragStateChange={({ isDropping }) => this.setState({ isDropping })}
|
||||||
shouldAcceptDrop={e => (e as any).dataTransfer.types.includes('Files')}
|
onDrop={e => this._onChooseImageFilePath(e.dataTransfer.files[0].path)}
|
||||||
style={{
|
shouldAcceptDrop={e => (e as any).dataTransfer.types.includes('Files')}
|
||||||
backgroundImage: !isUploading && `url(${resolvedURL || emptyPlaceholderURL})`,
|
style={{
|
||||||
}}
|
backgroundImage: !isUploading && `url(${resolvedURL || emptyPlaceholderURL})`,
|
||||||
className={`photo-well ${isDropping && 'dropping'}`}
|
}}
|
||||||
>
|
className={`photo-well ${isDropping && 'dropping'}`}
|
||||||
{isUploading && (
|
>
|
||||||
<RetinaImg
|
{isUploading && (
|
||||||
style={{ width: 14, height: 14 }}
|
<RetinaImg
|
||||||
name="inline-loading-spinner.gif"
|
style={{ width: 14, height: 14 }}
|
||||||
mode={RetinaImg.Mode.ContentPreserve}
|
name="inline-loading-spinner.gif"
|
||||||
/>
|
mode={RetinaImg.Mode.ContentPreserve}
|
||||||
)}
|
/>
|
||||||
</DropZone>
|
)}
|
||||||
</div>
|
</DropZone>
|
||||||
|
</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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue