You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Desktop, Mobile: Display a message when Joplin Cloud user don't have access to email to note feature (#10322)
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
.inbox-email-value {
|
.inbox-email-value {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-warn {
|
||||||
|
background-color: var(--joplin-background-color);
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
p {
|
||||||
|
padding: calc(var(--joplin-font-size) * 0.8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,11 @@ import { AppState } from '../app.reducer';
|
|||||||
import { _ } from '@joplin/lib/locale';
|
import { _ } from '@joplin/lib/locale';
|
||||||
import { clipboard } from 'electron';
|
import { clipboard } from 'electron';
|
||||||
import Button from './Button/Button';
|
import Button from './Button/Button';
|
||||||
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
type JoplinCloudConfigScreenProps = {
|
type JoplinCloudConfigScreenProps = {
|
||||||
inboxEmail: string;
|
inboxEmail: string;
|
||||||
|
joplinCloudAccountType: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const JoplinCloudConfigScreen = (props: JoplinCloudConfigScreenProps) => {
|
const JoplinCloudConfigScreen = (props: JoplinCloudConfigScreenProps) => {
|
||||||
@@ -13,12 +15,21 @@ const JoplinCloudConfigScreen = (props: JoplinCloudConfigScreenProps) => {
|
|||||||
clipboard.writeText(props.inboxEmail);
|
clipboard.writeText(props.inboxEmail);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isEmailToNoteAvailableInAccount = props.joplinCloudAccountType !== 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2>{_('Email to note')}</h2>
|
<h2>{_('Email to note')}</h2>
|
||||||
<p>{_('Any email sent to this address will be converted into a note and added to your collection. The note will be saved into the Inbox notebook')}</p>
|
<p>{_('Any email sent to this address will be converted into a note and added to your collection. The note will be saved into the Inbox notebook')}</p>
|
||||||
<p className='inbox-email-value'>{props.inboxEmail}</p>
|
{
|
||||||
<Button onClick={copyToClipboard} title={_('Copy to clipboard')} />
|
isEmailToNoteAvailableInAccount ? <Fragment>
|
||||||
|
<p className='inbox-email-value'>{props.inboxEmail}</p>
|
||||||
|
<Button onClick={copyToClipboard} title={_('Copy to clipboard')} />
|
||||||
|
</Fragment>
|
||||||
|
: <div className='alert-warn'>
|
||||||
|
<p>{_('Your account doesn\'t have access to this feature')}</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -26,6 +37,7 @@ const JoplinCloudConfigScreen = (props: JoplinCloudConfigScreenProps) => {
|
|||||||
const mapStateToProps = (state: AppState) => {
|
const mapStateToProps = (state: AppState) => {
|
||||||
return {
|
return {
|
||||||
inboxEmail: state.settings['sync.10.inboxEmail'],
|
inboxEmail: state.settings['sync.10.inboxEmail'],
|
||||||
|
joplinCloudAccountType: state.settings['sync.10.accountType'],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -345,6 +345,7 @@ class ConfigScreenComponent extends BaseScreenComponent<ConfigScreenProps, Confi
|
|||||||
description={options?.description}
|
description={options?.description}
|
||||||
statusComponent={options?.statusComp}
|
statusComponent={options?.statusComp}
|
||||||
styles={this.styles()}
|
styles={this.styles()}
|
||||||
|
disabled={options?.disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -513,18 +514,27 @@ class ConfigScreenComponent extends BaseScreenComponent<ConfigScreenProps, Confi
|
|||||||
if (section.name === 'joplinCloud') {
|
if (section.name === 'joplinCloud') {
|
||||||
const label = _('Email to note');
|
const label = _('Email to note');
|
||||||
const description = _('Any email sent to this address will be converted into a note and added to your collection. The note will be saved into the Inbox notebook');
|
const description = _('Any email sent to this address will be converted into a note and added to your collection. The note will be saved into the Inbox notebook');
|
||||||
|
const isEmailToNoteAvailableInAccount = this.props.settings['sync.10.accountType'] !== 1;
|
||||||
|
const inboxEmailValue = isEmailToNoteAvailableInAccount ? this.props.settings['sync.10.inboxEmail'] : '-';
|
||||||
addSettingComponent(
|
addSettingComponent(
|
||||||
<View key="joplinCloud">
|
<View key="joplinCloud">
|
||||||
<View style={this.styles().styleSheet.settingContainerNoBottomBorder}>
|
<View style={this.styles().styleSheet.settingContainerNoBottomBorder}>
|
||||||
<Text style={this.styles().styleSheet.settingText}>{label}</Text>
|
<Text style={this.styles().styleSheet.settingText}>{label}</Text>
|
||||||
<Text style={this.styles().styleSheet.settingTextEmphasis}>{this.props.settings['sync.10.inboxEmail']}</Text>
|
<Text style={this.styles().styleSheet.settingTextEmphasis}>{inboxEmailValue}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
{
|
||||||
|
!isEmailToNoteAvailableInAccount && (
|
||||||
|
<View style={this.styles().styleSheet.settingContainerNoBottomBorder}>
|
||||||
|
<Text style={this.styles().styleSheet.descriptionAlert}>{_('Your account doesn\'t have access to this feature')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
{
|
{
|
||||||
this.renderButton(
|
this.renderButton(
|
||||||
'sync.10.inboxEmail',
|
'sync.10.inboxEmail',
|
||||||
_('Copy to clipboard'),
|
_('Copy to clipboard'),
|
||||||
() => Clipboard.setString(this.props.settings['sync.10.inboxEmail']),
|
() => isEmailToNoteAvailableInAccount && Clipboard.setString(this.props.settings['sync.10.inboxEmail']),
|
||||||
{ description },
|
{ description, disabled: !isEmailToNoteAvailableInAccount },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</View>,
|
</View>,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export interface ConfigScreenStyleSheet {
|
|||||||
settingTextEmphasis: TextStyle;
|
settingTextEmphasis: TextStyle;
|
||||||
linkText: TextStyle;
|
linkText: TextStyle;
|
||||||
descriptionText: TextStyle;
|
descriptionText: TextStyle;
|
||||||
|
descriptionAlert: TextStyle;
|
||||||
warningText: TextStyle;
|
warningText: TextStyle;
|
||||||
|
|
||||||
sliderUnits: TextStyle;
|
sliderUnits: TextStyle;
|
||||||
@@ -119,6 +120,11 @@ const configScreenStyles = (themeId: number): ConfigScreenStyles => {
|
|||||||
fontSize: theme.fontSizeSmaller,
|
fontSize: theme.fontSizeSmaller,
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
|
descriptionAlert: {
|
||||||
|
color: theme.color,
|
||||||
|
fontSize: theme.fontSizeSmaller,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
linkText: {
|
linkText: {
|
||||||
...settingTextStyle,
|
...settingTextStyle,
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user