From 537697a6e9757f118d09d9e76362ba1ff617e2c6 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Mon, 13 Sep 2021 14:45:46 +0200 Subject: chore: upgrade intl dependencies (#1920) --- src/containers/settings/AccountScreen.js | 11 +- src/containers/settings/EditServiceScreen.js | 121 ++++++++++--------- src/containers/settings/EditSettingsScreen.js | 166 ++++++++++++++------------ src/containers/settings/EditUserScreen.js | 60 +++++----- src/containers/settings/InviteScreen.js | 8 +- src/containers/settings/RecipesScreen.js | 92 ++++++++------ src/containers/settings/ServicesScreen.js | 17 +-- src/containers/settings/SettingsWindow.js | 21 ++-- src/containers/settings/SupportScreen.js | 9 +- src/containers/settings/TeamScreen.js | 11 +- 10 files changed, 289 insertions(+), 227 deletions(-) (limited to 'src/containers/settings') diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 8d92b01be..cc3929656 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js @@ -12,7 +12,6 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; import { LIVE_FRANZ_API } from '../../config'; import { WEBSITE } from '../../environment'; -export default @inject('stores', 'actions') @observer class AccountScreen extends Component { @@ -58,16 +57,16 @@ class AccountScreen extends Component { user={user.data} isLoading={isLoadingUserInfo} userInfoRequestFailed={ - user.getUserInfoRequest.wasExecuted - && user.getUserInfoRequest.isError + user.getUserInfoRequest.wasExecuted && + user.getUserInfoRequest.isError } retryUserInfoRequest={() => this.reloadData()} onCloseSubscriptionWindow={() => this.onCloseWindow()} deleteAccount={userActions.delete} isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} isDeleteAccountSuccessful={ - user.deleteAccountRequest.wasExecuted - && !user.deleteAccountRequest.isError + user.deleteAccountRequest.wasExecuted && + !user.deleteAccountRequest.isError } openEditAccount={() => this.handleWebsiteLink('/user/profile')} openInvoices={() => this.handleWebsiteLink('/user/invoices')} @@ -89,3 +88,5 @@ AccountScreen.wrappedComponent.propTypes = { user: PropTypes.instanceOf(UserStore).isRequired, }).isRequired, }; + +export default AccountScreen; diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index c880e97ae..12e7b9e95 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { inject, observer } from 'mobx-react'; -import { defineMessages, intlShape } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; import { RouterStore } from 'mobx-react-router'; import UserStore from '../../stores/UserStore'; @@ -27,87 +27,85 @@ import globalMessages from '../../i18n/globalMessages'; const messages = defineMessages({ name: { id: 'settings.service.form.name', - defaultMessage: '!!!Name', + defaultMessage: 'Name', }, enableService: { id: 'settings.service.form.enableService', - defaultMessage: '!!!Enable service', + defaultMessage: 'Enable service', }, enableHibernation: { id: 'settings.service.form.enableHibernation', - defaultMessage: '!!!Enable hibernation', + defaultMessage: 'Enable hibernation', }, enableNotification: { id: 'settings.service.form.enableNotification', - defaultMessage: '!!!Enable Notifications', + defaultMessage: 'Enable Notifications', }, enableBadge: { id: 'settings.service.form.enableBadge', - defaultMessage: '!!!Show unread message badges', + defaultMessage: 'Show unread message badges', }, enableAudio: { id: 'settings.service.form.enableAudio', - defaultMessage: '!!!Enable audio', + defaultMessage: 'Enable audio', }, team: { id: 'settings.service.form.team', - defaultMessage: '!!!Team', + defaultMessage: 'Team', }, customUrl: { id: 'settings.service.form.customUrl', - defaultMessage: '!!!Service URL', + defaultMessage: 'Service URL', }, indirectMessages: { id: 'settings.service.form.indirectMessages', - defaultMessage: '!!!Show message badge for all new messages', + defaultMessage: 'Show message badge for all new messages', }, icon: { id: 'settings.service.form.icon', - defaultMessage: '!!!Custom icon', + defaultMessage: 'Custom icon', }, enableDarkMode: { id: 'settings.service.form.enableDarkMode', - defaultMessage: '!!!Enable Dark Mode', + defaultMessage: 'Enable Dark Mode', }, darkReaderBrightness: { id: 'settings.service.form.darkReaderBrightness', - defaultMessage: '!!!Dark Reader Brightness', + defaultMessage: 'Dark Reader Brightness', }, darkReaderContrast: { id: 'settings.service.form.darkReaderContrast', - defaultMessage: '!!!Dark Reader Contrast', + defaultMessage: 'Dark Reader Contrast', }, darkReaderSepia: { id: 'settings.service.form.darkReaderSepia', - defaultMessage: '!!!Dark Reader Sepia', + defaultMessage: 'Dark Reader Sepia', }, enableProxy: { id: 'settings.service.form.proxy.isEnabled', - defaultMessage: '!!!Use Proxy', + defaultMessage: 'Use Proxy', }, proxyHost: { id: 'settings.service.form.proxy.host', - defaultMessage: '!!!Proxy Host/IP', + defaultMessage: 'Proxy Host/IP', }, proxyPort: { id: 'settings.service.form.proxy.port', - defaultMessage: '!!!Port', + defaultMessage: 'Port', }, proxyUser: { id: 'settings.service.form.proxy.user', - defaultMessage: '!!!User', + defaultMessage: 'User', }, proxyPassword: { id: 'settings.service.form.proxy.password', - defaultMessage: '!!!Password', + defaultMessage: 'Password', }, }); -export default @inject('stores', 'actions') @observer class EditServiceScreen extends Component { - static contextTypes = { - intl: intlShape, - }; - +@inject('stores', 'actions') +@observer +class EditServiceScreen extends Component { onSubmit(data) { const { action } = this.props.router.params; const { recipes, services } = this.props.stores; @@ -132,27 +130,31 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex } prepareForm(recipe, service, proxy) { - const { - intl, - } = this.context; + const { intl } = this.props; - const { - stores, - router, - } = this.props; + const { stores, router } = this.props; const { action } = router.params; - let defaultSpellcheckerLanguage = SPELLCHECKER_LOCALES[stores.settings.app.spellcheckerLanguage]; + let defaultSpellcheckerLanguage = + SPELLCHECKER_LOCALES[stores.settings.app.spellcheckerLanguage]; if (stores.settings.app.spellcheckerLanguage === 'automatic') { - defaultSpellcheckerLanguage = intl.formatMessage(globalMessages.spellcheckerAutomaticDetectionShort); + defaultSpellcheckerLanguage = intl.formatMessage( + globalMessages.spellcheckerAutomaticDetectionShort, + ); } const spellcheckerLanguage = getSelectOptions({ locales: SPELLCHECKER_LOCALES, - resetToDefaultText: intl.formatMessage(globalMessages.spellcheckerSystemDefault, { default: defaultSpellcheckerLanguage }), - automaticDetectionText: stores.settings.app.spellcheckerLanguage !== 'automatic' ? intl.formatMessage(globalMessages.spellcheckerAutomaticDetection) : '', + resetToDefaultText: intl.formatMessage( + globalMessages.spellcheckerSystemDefault, + { default: defaultSpellcheckerLanguage }, + ), + automaticDetectionText: + stores.settings.app.spellcheckerLanguage !== 'automatic' + ? intl.formatMessage(globalMessages.spellcheckerAutomaticDetection) + : '', }); const config = { @@ -169,7 +171,10 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex }, isHibernationEnabled: { label: intl.formatMessage(messages.enableHibernation), - value: action !== 'edit' ? recipe.autoHibernate : service.isHibernationEnabled, + value: + action !== 'edit' + ? recipe.autoHibernate + : service.isHibernationEnabled, default: true, }, isNotificationEnabled: { @@ -200,17 +205,23 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex }, darkReaderBrightness: { label: intl.formatMessage(messages.darkReaderBrightness), - value: service.darkReaderSettings ? service.darkReaderSettings.brightness : undefined, + value: service.darkReaderSettings + ? service.darkReaderSettings.brightness + : undefined, default: 100, }, darkReaderContrast: { label: intl.formatMessage(messages.darkReaderContrast), - value: service.darkReaderSettings ? service.darkReaderSettings.contrast : undefined, + value: service.darkReaderSettings + ? service.darkReaderSettings.contrast + : undefined, default: 90, }, darkReaderSepia: { label: intl.formatMessage(messages.darkReaderSepia), - value: service.darkReaderSettings ? service.darkReaderSettings.sepia : undefined, + value: service.darkReaderSettings + ? service.darkReaderSettings.sepia + : undefined, default: 10, }, spellcheckerLanguage: { @@ -252,7 +263,10 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex // More fine grained and use case specific validation rules if (recipe.hasTeamId && recipe.hasCustomUrl) { config.fields.team.validators = [oneRequired(['team', 'customUrl'])]; - config.fields.customUrl.validators = [url, oneRequired(['team', 'customUrl'])]; + config.fields.customUrl.validators = [ + url, + oneRequired(['team', 'customUrl']), + ]; } // If a service can be hosted and has a teamId or customUrl @@ -344,9 +358,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex } render() { - const { - recipes, services, user, - } = this.props.stores; + const { recipes, services, user } = this.props.stores; const { action } = this.props.router.params; let recipe; @@ -358,9 +370,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex // TODO: render error message when recipe is `null` if (!recipe) { - return ( - - ); + return ; } } else { service = services.activeSettings; @@ -372,13 +382,11 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex } if (isLoading) { - return (
Loading...
); + return
Loading...
; } if (!recipe) { - return ( -
something went wrong
- ); + return
something went wrong
; } const form = this.prepareForm(recipe, service, proxyFeature); @@ -392,11 +400,14 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex user={user.data} form={form} status={services.actionStatus} - isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} + isSaving={ + services.updateServiceRequest.isExecuting || + services.createServiceRequest.isExecuting + } isDeleting={services.deleteServiceRequest.isExecuting} - onSubmit={(d) => this.onSubmit(d)} + onSubmit={d => this.onSubmit(d)} onDelete={() => this.deleteService()} - openRecipeFile={(file) => this.openRecipeFile(file)} + openRecipeFile={file => this.openRecipeFile(file)} isProxyFeatureEnabled={proxyFeature.isEnabled} /> @@ -417,3 +428,5 @@ EditServiceScreen.wrappedComponent.propTypes = { service: PropTypes.instanceOf(ServicesStore).isRequired, }).isRequired, }; + +export default injectIntl(EditServiceScreen); diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 09244bc3c..8834aa1ae 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { inject, observer } from 'mobx-react'; -import { defineMessages, intlShape } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; import AppStore from '../../stores/AppStore'; import SettingsStore from '../../stores/SettingsStore'; @@ -10,8 +10,15 @@ import TodosStore from '../../features/todos/store'; import Form from '../../lib/Form'; import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; import { - HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, SEARCH_ENGINE_NAMES, TODO_APPS, - DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, WAKE_UP_STRATEGIES, + HIBERNATION_STRATEGIES, + SIDEBAR_WIDTH, + ICON_SIZES, + NAVIGATION_BAR_BEHAVIOURS, + SEARCH_ENGINE_NAMES, + TODO_APPS, + DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, + DEFAULT_IS_FEATURE_ENABLED_BY_USER, + WAKE_UP_STRATEGIES, } from '../../config'; import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; @@ -31,195 +38,193 @@ const debug = require('debug')('Ferdi:EditSettingsScreen'); const messages = defineMessages({ autoLaunchOnStart: { id: 'settings.app.form.autoLaunchOnStart', - defaultMessage: '!!!Launch Ferdi on start', + defaultMessage: 'Launch Ferdi on start', }, autoLaunchInBackground: { id: 'settings.app.form.autoLaunchInBackground', - defaultMessage: '!!!Open in background', + defaultMessage: 'Open in background', }, runInBackground: { id: 'settings.app.form.runInBackground', - defaultMessage: '!!!Keep Ferdi in background when closing the window', + defaultMessage: 'Keep Ferdi in background when closing the window', }, startMinimized: { id: 'settings.app.form.startMinimized', - defaultMessage: '!!!Start minimized', + defaultMessage: 'Start minimized', }, confirmOnQuit: { id: 'settings.app.form.confirmOnQuit', - defaultMessage: '!!!Confirm when quitting Ferdi', + defaultMessage: 'Confirm when quitting Ferdi', }, enableSystemTray: { id: 'settings.app.form.enableSystemTray', - defaultMessage: '!!!Always show Ferdi in System Tray', + defaultMessage: 'Always show Ferdi in System Tray', }, enableMenuBar: { id: 'settings.app.form.enableMenuBar', - defaultMessage: '!!!Always show Ferdi in Menu Bar', + defaultMessage: 'Always show Ferdi in Menu Bar', }, reloadAfterResume: { id: 'settings.app.form.reloadAfterResume', - defaultMessage: '!!!Reload Ferdi after system resume', + defaultMessage: 'Reload Ferdi after system resume', }, minimizeToSystemTray: { id: 'settings.app.form.minimizeToSystemTray', - defaultMessage: '!!!Minimize Ferdi to system tray', + defaultMessage: 'Minimize Ferdi to system tray', }, closeToSystemTray: { id: 'settings.app.form.closeToSystemTray', - defaultMessage: '!!!Close Ferdi to system tray', + defaultMessage: 'Close Ferdi to system tray', }, privateNotifications: { id: 'settings.app.form.privateNotifications', - defaultMessage: '!!!Don\'t show message content in notifications', + defaultMessage: "Don't show message content in notifications", }, clipboardNotifications: { id: 'settings.app.form.clipboardNotifications', - defaultMessage: '!!!Don\'t show notifications for clipboard events', + defaultMessage: "Don't show notifications for clipboard events", }, notifyTaskBarOnMessage: { id: 'settings.app.form.notifyTaskBarOnMessage', - defaultMessage: '!!!Notify TaskBar/Dock on new message', + defaultMessage: 'Notify TaskBar/Dock on new message', }, navigationBarBehaviour: { id: 'settings.app.form.navigationBarBehaviour', - defaultMessage: '!!!Navigation bar behaviour', + defaultMessage: 'Navigation bar behaviour', }, searchEngine: { id: 'settings.app.form.searchEngine', - defaultMessage: '!!!Search engine', + defaultMessage: 'Search engine', }, sentry: { id: 'settings.app.form.sentry', - defaultMessage: '!!!Send telemetry data', + defaultMessage: 'Send telemetry data', }, hibernateOnStartup: { id: 'settings.app.form.hibernateOnStartup', - defaultMessage: '!!!Keep services in hibernation on startup', + defaultMessage: 'Keep services in hibernation on startup', }, hibernationStrategy: { id: 'settings.app.form.hibernationStrategy', - defaultMessage: '!!!Hibernation strategy', + defaultMessage: 'Hibernation strategy', }, wakeUpStrategy: { id: 'settings.app.form.wakeUpStrategy', - defaultMessage: '!!!Wake up strategy', + defaultMessage: 'Wake up strategy', }, predefinedTodoServer: { id: 'settings.app.form.predefinedTodoServer', - defaultMessage: '!!!Todo Server', + defaultMessage: 'Todo Server', }, customTodoServer: { id: 'settings.app.form.customTodoServer', - defaultMessage: '!!!Custom TodoServer', + defaultMessage: 'Custom TodoServer', }, enableLock: { id: 'settings.app.form.enableLock', - defaultMessage: '!!!Enable Password Lock', + defaultMessage: 'Enable Password Lock', }, lockPassword: { id: 'settings.app.form.lockPassword', - defaultMessage: '!!!Password', + defaultMessage: 'Password', }, useTouchIdToUnlock: { id: 'settings.app.form.useTouchIdToUnlock', - defaultMessage: '!!!Allow using Touch ID to unlock', + defaultMessage: 'Allow using Touch ID to unlock', }, inactivityLock: { id: 'settings.app.form.inactivityLock', - defaultMessage: '!!!Lock after inactivity', + defaultMessage: 'Lock after inactivity', }, scheduledDNDEnabled: { id: 'settings.app.form.scheduledDNDEnabled', - defaultMessage: '!!!Enable scheduled Do-not-Disturb', + defaultMessage: 'Enable scheduled Do-not-Disturb', }, scheduledDNDStart: { id: 'settings.app.form.scheduledDNDStart', - defaultMessage: '!!!From', + defaultMessage: 'From', }, scheduledDNDEnd: { id: 'settings.app.form.scheduledDNDEnd', - defaultMessage: '!!!To', + defaultMessage: 'To', }, language: { id: 'settings.app.form.language', - defaultMessage: '!!!Language', + defaultMessage: 'Language', }, darkMode: { id: 'settings.app.form.darkMode', - defaultMessage: '!!!Dark Mode', + defaultMessage: 'Dark Mode', }, adaptableDarkMode: { id: 'settings.app.form.adaptableDarkMode', - defaultMessage: '!!!Synchronize dark mode with my OS\'s dark mode setting', + defaultMessage: "Synchronize dark mode with my OS's dark mode setting", }, universalDarkMode: { id: 'settings.app.form.universalDarkMode', - defaultMessage: '!!!Enable universal Dark Mode', + defaultMessage: 'Enable universal Dark Mode', }, serviceRibbonWidth: { id: 'settings.app.form.serviceRibbonWidth', - defaultMessage: '!!!Sidebar width', + defaultMessage: 'Sidebar width', }, iconSize: { id: 'settings.app.form.iconSize', - defaultMessage: '!!!Service icon size', + defaultMessage: 'Service icon size', }, useVerticalStyle: { id: 'settings.app.form.useVerticalStyle', - defaultMessage: '!!!Use horizontal style', + defaultMessage: 'Use horizontal style', }, alwaysShowWorkspaces: { id: 'settings.app.form.alwaysShowWorkspaces', - defaultMessage: '!!!Always show workspace drawer', + defaultMessage: 'Always show workspace drawer', }, accentColor: { id: 'settings.app.form.accentColor', - defaultMessage: '!!!Accent color', + defaultMessage: 'Accent color', }, showDisabledServices: { id: 'settings.app.form.showDisabledServices', - defaultMessage: '!!!Display disabled services tabs', + defaultMessage: 'Display disabled services tabs', }, showMessageBadgeWhenMuted: { id: 'settings.app.form.showMessagesBadgesWhenMuted', - defaultMessage: '!!!Show unread message badge when notifications are disabled', + defaultMessage: 'Show unread message badge when notifications are disabled', }, showDragArea: { id: 'settings.app.form.showDragArea', - defaultMessage: '!!!Show draggable area on window', + defaultMessage: 'Show draggable area on window', }, enableSpellchecking: { id: 'settings.app.form.enableSpellchecking', - defaultMessage: '!!!Enable spell checking', + defaultMessage: 'Enable spell checking', }, enableGPUAcceleration: { id: 'settings.app.form.enableGPUAcceleration', - defaultMessage: '!!!Enable GPU Acceleration', + defaultMessage: 'Enable GPU Acceleration', }, beta: { id: 'settings.app.form.beta', - defaultMessage: '!!!Include beta versions', + defaultMessage: 'Include beta versions', }, automaticUpdates: { id: 'settings.app.form.automaticUpdates', - defaultMessage: '!!!Enable updates', + defaultMessage: 'Enable updates', }, enableTodos: { id: 'settings.app.form.enableTodos', - defaultMessage: '!!!Enable Franz Todos', + defaultMessage: 'Enable Franz Todos', }, keepAllWorkspacesLoaded: { id: 'settings.app.form.keepAllWorkspacesLoaded', - defaultMessage: '!!!Keep all workspaces loaded', + defaultMessage: 'Keep all workspaces loaded', }, }); -export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { - static contextTypes = { - intl: intlShape, - }; - +@inject('stores', 'actions') +@observer +class EditSettingsScreen extends Component { constructor(props) { super(props); @@ -288,7 +293,9 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e useVerticalStyle: Boolean(settingsData.useVerticalStyle), alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces), accentColor: settingsData.accentColor, - showMessageBadgeWhenMuted: Boolean(settingsData.showMessageBadgeWhenMuted), + showMessageBadgeWhenMuted: Boolean( + settingsData.showMessageBadgeWhenMuted, + ), showDragArea: Boolean(settingsData.showDragArea), enableSpellchecking: Boolean(settingsData.enableSpellchecking), spellcheckerLanguage: settingsData.spellcheckerLanguage, @@ -309,24 +316,27 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e if (workspaces.isFeatureActive) { const { keepAllWorkspacesLoaded } = workspaces.settings; - if (Boolean(keepAllWorkspacesLoaded) !== Boolean(settingsData.keepAllWorkspacesLoaded)) { + if ( + Boolean(keepAllWorkspacesLoaded) !== + Boolean(settingsData.keepAllWorkspacesLoaded) + ) { workspaceActions.toggleKeepAllWorkspacesLoadedSetting(); } } if (todos.isFeatureActive) { const { isFeatureEnabledByUser } = todos.settings; - if (Boolean(isFeatureEnabledByUser) !== Boolean(settingsData.enableTodos)) { + if ( + Boolean(isFeatureEnabledByUser) !== Boolean(settingsData.enableTodos) + ) { todosActions.toggleTodosFeatureVisibility(); } } } prepareForm() { - const { - app, settings, user, todos, workspaces, - } = this.props.stores; - const { intl } = this.context; + const { app, settings, user, todos, workspaces } = this.props.stores; + const { intl } = this.props; const { lockedPassword } = this.state; const locales = getSelectOptions({ @@ -370,7 +380,9 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e const spellcheckingLanguages = getSelectOptions({ locales: SPELLCHECKER_LOCALES, - automaticDetectionText: this.context.intl.formatMessage(globalMessages.spellcheckerAutomaticDetection), + automaticDetectionText: intl.formatMessage( + globalMessages.spellcheckerAutomaticDetection, + ), }); const config = { @@ -401,7 +413,9 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e default: DEFAULT_APP_SETTINGS.confirmOnQuit, }, enableSystemTray: { - label: intl.formatMessage(isMac ? messages.enableMenuBar : messages.enableSystemTray), + label: intl.formatMessage( + isMac ? messages.enableMenuBar : messages.enableSystemTray, + ), value: settings.all.app.enableSystemTray, default: DEFAULT_APP_SETTINGS.enableSystemTray, }, @@ -637,23 +651,15 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e } render() { - const { - app, - todos, - workspaces, - services, - } = this.props.stores; + const { app, todos, workspaces, services } = this.props.stores; const { updateStatus, updateStatusTypes, isClearingAllCache, lockingFeatureEnabled, } = app; - const { - checkForUpdates, - installUpdate, - clearAllCache, - } = this.props.actions.app; + const { checkForUpdates, installUpdate, clearAllCache } = + this.props.actions.app; const form = this.prepareForm(); return ( @@ -666,7 +672,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE} noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} - onSubmit={(d) => this.onSubmit(d)} + onSubmit={d => this.onSubmit(d)} getCacheSize={() => app.cacheSize} isClearingAllCache={isClearingAllCache} onClearAllCache={clearAllCache} @@ -675,9 +681,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e lockingFeatureEnabled={lockingFeatureEnabled} automaticUpdates={this.props.stores.settings.app.automaticUpdates} isDarkmodeEnabled={this.props.stores.settings.app.darkMode} - isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode} + isAdaptableDarkModeEnabled={ + this.props.stores.settings.app.adaptableDarkMode + } isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser} - isUsingCustomTodoService={this.props.stores.todos.isUsingCustomTodoService} + isUsingCustomTodoService={ + this.props.stores.todos.isUsingCustomTodoService + } isNightlyEnabled={this.props.stores.settings.app.nightly} hasAddedTodosAsService={services.isTodosServiceAdded} isOnline={app.isOnline} @@ -704,3 +714,5 @@ EditSettingsScreen.wrappedComponent.propTypes = { workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired, }).isRequired, }; + +export default injectIntl(EditSettingsScreen); diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js index 820b5e4d3..92ef94c29 100644 --- a/src/containers/settings/EditUserScreen.js +++ b/src/containers/settings/EditUserScreen.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { inject, observer } from 'mobx-react'; -import { defineMessages, intlShape } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; import UserStore from '../../stores/UserStore'; import Form from '../../lib/Form'; @@ -13,47 +13,45 @@ import { required, email, minLength } from '../../helpers/validation-helpers'; const messages = defineMessages({ firstname: { id: 'settings.user.form.firstname', - defaultMessage: '!!!Firstname', + defaultMessage: 'Firstname', }, lastname: { id: 'settings.user.form.lastname', - defaultMessage: '!!!Lastname', + defaultMessage: 'Lastname', }, email: { id: 'settings.user.form.email', - defaultMessage: '!!!Email', + defaultMessage: 'Email', }, accountTypeLabel: { id: 'settings.user.form.accountType.label', - defaultMessage: '!!!Account type', + defaultMessage: 'Account type', }, accountTypeIndividual: { id: 'settings.user.form.accountType.individual', - defaultMessage: '!!!Individual', + defaultMessage: 'Individual', }, accountTypeNonProfit: { id: 'settings.user.form.accountType.non-profit', - defaultMessage: '!!!Non-Profit', + defaultMessage: 'Non-Profit', }, accountTypeCompany: { id: 'settings.user.form.accountType.company', - defaultMessage: '!!!Company', + defaultMessage: 'Company', }, currentPassword: { id: 'settings.user.form.currentPassword', - defaultMessage: '!!!Current password', + defaultMessage: 'Current password', }, newPassword: { id: 'settings.user.form.newPassword', - defaultMessage: '!!!New password', + defaultMessage: 'New password', }, }); -export default @inject('stores', 'actions') @observer class EditUserScreen extends Component { - static contextTypes = { - intl: intlShape, - }; - +@inject('stores', 'actions') +@observer +class EditUserScreen extends Component { componentWillUnmount() { this.props.actions.user.resetStatus(); } @@ -67,7 +65,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten } prepareForm(user) { - const { intl } = this.context; + const { intl } = this.props; const config = { fields: { @@ -93,16 +91,20 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten value: user.accountType, validators: [required], label: intl.formatMessage(messages.accountTypeLabel), - options: [{ - value: 'individual', - label: intl.formatMessage(messages.accountTypeIndividual), - }, { - value: 'non-profit', - label: intl.formatMessage(messages.accountTypeNonProfit), - }, { - value: 'company', - label: intl.formatMessage(messages.accountTypeCompany), - }], + options: [ + { + value: 'individual', + label: intl.formatMessage(messages.accountTypeIndividual), + }, + { + value: 'non-profit', + label: intl.formatMessage(messages.accountTypeNonProfit), + }, + { + value: 'company', + label: intl.formatMessage(messages.accountTypeCompany), + }, + ], }, organization: { label: intl.formatMessage(messages.accountTypeCompany), @@ -129,7 +131,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten const { user } = this.props.stores; if (user.getUserInfoRequest.isExecuting) { - return (
Loading...
); + return
Loading...
; } const form = this.prepareForm(user.data); @@ -141,7 +143,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten status={user.actionStatus} form={form} isSaving={user.updateUserInfoRequest.isExecuting} - onSubmit={(d) => this.onSubmit(d)} + onSubmit={d => this.onSubmit(d)} /> ); @@ -156,3 +158,5 @@ EditUserScreen.wrappedComponent.propTypes = { user: PropTypes.instanceOf(UserStore).isRequired, }).isRequired, }; + +export default injectIntl(EditUserScreen); diff --git a/src/containers/settings/InviteScreen.js b/src/containers/settings/InviteScreen.js index 4fdaef08b..f17f6390c 100644 --- a/src/containers/settings/InviteScreen.js +++ b/src/containers/settings/InviteScreen.js @@ -6,7 +6,9 @@ import Invite from '../../components/auth/Invite'; import ErrorBoundary from '../../components/util/ErrorBoundary'; import UserStore from '../../stores/UserStore'; -export default @inject('stores', 'actions') @observer class InviteScreen extends Component { +@inject('stores', 'actions') +@observer +class InviteScreen extends Component { componentWillUnmount() { this.props.stores.user.inviteRequest.reset(); } @@ -20,7 +22,9 @@ export default @inject('stores', 'actions') @observer class InviteScreen extends diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js index 784052bbe..06ddabe4c 100644 --- a/src/containers/settings/RecipesScreen.js +++ b/src/containers/settings/RecipesScreen.js @@ -18,7 +18,9 @@ import RecipePreview from '../../models/RecipePreview'; import AppStore from '../../stores/AppStore'; import { openPath } from '../../helpers/url-helpers'; -export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { +@inject('stores', 'actions') +@observer +class RecipesScreen extends Component { static propTypes = { params: PropTypes.shape({ filter: PropTypes.string, @@ -75,25 +77,32 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend } _sortByName(recipe1, recipe2) { - if (recipe1.name.toLowerCase() < recipe2.name.toLowerCase()) { return -1; } - if (recipe1.name.toLowerCase() > recipe2.name.toLowerCase()) { return 1; } + if (recipe1.name.toLowerCase() < recipe2.name.toLowerCase()) { + return -1; + } + if (recipe1.name.toLowerCase() > recipe2.name.toLowerCase()) { + return 1; + } return 0; } prepareRecipes(recipes) { - return recipes - // Filter out duplicate recipes - .filter((recipe, index, self) => { - const ids = self.map((rec) => rec.id); - return ids.indexOf(recipe.id) === index; - - // Sort alphabetically - }).sort(this._sortByName); + return ( + recipes + // Filter out duplicate recipes + .filter((recipe, index, self) => { + const ids = self.map(rec => rec.id); + return ids.indexOf(recipe.id) === index; + + // Sort alphabetically + }) + .sort(this._sortByName) + ); } // Create an array of RecipePreviews from an array of recipe objects createPreviews(recipes) { - return recipes.map((recipe) => new RecipePreview(recipe)); + return recipes.map(recipe => new RecipePreview(recipe)); } resetSearch() { @@ -101,16 +110,9 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend } render() { - const { - recipePreviews, - recipes, - services, - } = this.props.stores; + const { recipePreviews, recipes, services } = this.props.stores; - const { - app: appActions, - service: serviceActions, - } = this.props.actions; + const { app: appActions, service: serviceActions } = this.props.actions; const { filter } = { filter: 'all', ...this.props.params }; let recipeFilter; @@ -125,21 +127,33 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend } recipeFilter = recipeFilter.sort(this._sortByName); - const allRecipes = this.state.needle ? this.prepareRecipes([ - // All search recipes from server - ...recipePreviews.searchResults, - // All search recipes from local recipes - ...this.createPreviews( - this.customRecipes - .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase()) || (service.aliases || []).some(alias => alias.toLowerCase().includes(this.state.needle.toLowerCase()))), - ), - ]).sort(this._sortByName) : recipeFilter; - - const customWebsiteRecipe = recipePreviews.all.find((service) => service.id === CUSTOM_WEBSITE_RECIPE_ID); + const allRecipes = this.state.needle + ? this.prepareRecipes([ + // All search recipes from server + ...recipePreviews.searchResults, + // All search recipes from local recipes + ...this.createPreviews( + this.customRecipes.filter( + service => + service.name + .toLowerCase() + .includes(this.state.needle.toLowerCase()) || + (service.aliases || []).some(alias => + alias.toLowerCase().includes(this.state.needle.toLowerCase()), + ), + ), + ), + ]).sort(this._sortByName) + : recipeFilter; + + const customWebsiteRecipe = recipePreviews.all.find( + service => service.id === CUSTOM_WEBSITE_RECIPE_ID, + ); - const isLoading = recipePreviews.allRecipePreviewsRequest.isExecuting - || recipes.installRecipeRequest.isExecuting - || recipePreviews.searchRecipePreviewsRequest.isExecuting; + const isLoading = + recipePreviews.allRecipePreviewsRequest.isExecuting || + recipes.installRecipeRequest.isExecuting || + recipePreviews.searchRecipePreviewsRequest.isExecuting; const recipeDirectory = userDataRecipesPath('dev'); @@ -151,14 +165,16 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend isLoading={isLoading} addedServiceCount={services.all.length} showAddServiceInterface={serviceActions.showAddServiceInterface} - searchRecipes={(e) => this.searchRecipes(e)} + searchRecipes={e => this.searchRecipes(e)} resetSearch={() => this.resetSearch()} searchNeedle={this.state.needle} serviceStatus={services.actionStatus} recipeFilter={filter} recipeDirectory={recipeDirectory} openRecipeDirectory={() => openPath(recipeDirectory)} - openDevDocs={() => appActions.openExternalUrl({ url: FRANZ_DEV_DOCS })} + openDevDocs={() => + appActions.openExternalUrl({ url: FRANZ_DEV_DOCS }) + } /> ); @@ -180,3 +196,5 @@ RecipesScreen.wrappedComponent.propTypes = { }).isRequired, }).isRequired, }; + +export default RecipesScreen; diff --git a/src/containers/settings/ServicesScreen.js b/src/containers/settings/ServicesScreen.js index eb2b1bcb5..c9dfc68d0 100644 --- a/src/containers/settings/ServicesScreen.js +++ b/src/containers/settings/ServicesScreen.js @@ -10,7 +10,9 @@ import ServiceStore from '../../stores/ServicesStore'; import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; -export default @inject('stores', 'actions') @observer class ServicesScreen extends Component { +@inject('stores', 'actions') +@observer +class ServicesScreen extends Component { componentWillUnmount() { this.props.actions.service.resetFilter(); this.props.actions.service.resetStatus(); @@ -23,11 +25,7 @@ export default @inject('stores', 'actions') @observer class ServicesScreen exten render() { const { user, services, router } = this.props.stores; - const { - toggleService, - filter, - resetFilter, - } = this.props.actions.service; + const { toggleService, filter, resetFilter } = this.props.actions.service; const isLoading = services.allServicesRequest.isExecuting; let allServices = services.all; @@ -47,7 +45,10 @@ export default @inject('stores', 'actions') @observer class ServicesScreen exten filterServices={filter} resetFilter={resetFilter} goTo={router.push} - servicesRequestFailed={services.allServicesRequest.wasExecuted && services.allServicesRequest.isError} + servicesRequestFailed={ + services.allServicesRequest.wasExecuted && + services.allServicesRequest.isError + } retryServicesRequest={() => services.allServicesRequest.reload()} searchNeedle={services.filterNeedle} /> @@ -66,3 +67,5 @@ ServicesScreen.wrappedComponent.propTypes = { service: PropTypes.instanceOf(ServiceStore).isRequired, }).isRequired, }; + +export default ServicesScreen; diff --git a/src/containers/settings/SettingsWindow.js b/src/containers/settings/SettingsWindow.js index 9bb64b6fe..58e73f2f3 100644 --- a/src/containers/settings/SettingsWindow.js +++ b/src/containers/settings/SettingsWindow.js @@ -11,7 +11,9 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; import { workspaceStore } from '../../features/workspaces'; import UIStore from '../../stores/UIStore'; -export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { +@inject('stores', 'actions') +@observer +class SettingsContainer extends Component { portalRoot = document.querySelector('#portalContainer'); el = document.createElement('div'); @@ -36,16 +38,11 @@ export default @inject('stores', 'actions') @observer class SettingsContainer ex ); return ReactDOM.createPortal( - ( - - - {children} - - - ), + + + {children} + + , this.el, ); } @@ -60,3 +57,5 @@ SettingsContainer.wrappedComponent.propTypes = { ui: PropTypes.instanceOf(UIStore).isRequired, }).isRequired, }; + +export default SettingsContainer; diff --git a/src/containers/settings/SupportScreen.js b/src/containers/settings/SupportScreen.js index 7d3b22f19..646f672ce 100644 --- a/src/containers/settings/SupportScreen.js +++ b/src/containers/settings/SupportScreen.js @@ -6,7 +6,8 @@ import SupportFerdi from '../../components/settings/supportFerdi/SupportFerdiDas import ErrorBoundary from '../../components/util/ErrorBoundary'; import AppStore from '../../stores/AppStore'; -export default @inject('actions') class SupportScreen extends Component { +@inject('actions') +class SupportScreen extends Component { constructor(props) { super(props); @@ -20,9 +21,7 @@ export default @inject('actions') class SupportScreen extends Component { render() { return ( - + ); } @@ -33,3 +32,5 @@ SupportScreen.wrappedComponent.propTypes = { app: PropTypes.instanceOf(AppStore).isRequired, }).isRequired, }; + +export default SupportScreen; diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js index 10c2e36ef..ea447469b 100644 --- a/src/containers/settings/TeamScreen.js +++ b/src/containers/settings/TeamScreen.js @@ -10,7 +10,9 @@ import TeamDashboard from '../../components/settings/team/TeamDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; import { DEV_API_FRANZ_WEBSITE } from '../../config'; -export default @inject('stores', 'actions') @observer class TeamScreen extends Component { +@inject('stores', 'actions') +@observer +class TeamScreen extends Component { handleWebsiteLink(route) { const { actions, stores } = this.props; @@ -29,7 +31,10 @@ export default @inject('stores', 'actions') @observer class TeamScreen extends C this.reloadData()} openTeamManagement={() => this.handleWebsiteLink('/user/team')} server={server} @@ -50,3 +55,5 @@ TeamScreen.wrappedComponent.propTypes = { user: PropTypes.instanceOf(UserStore).isRequired, }).isRequired, }; + +export default TeamScreen; -- cgit v1.2.3-70-g09d2