aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/settings')
-rw-r--r--src/containers/settings/AccountScreen.js25
-rw-r--r--src/containers/settings/EditServiceScreen.js10
-rw-r--r--src/containers/settings/EditSettingsScreen.js41
-rw-r--r--src/containers/settings/EditUserScreen.js2
-rw-r--r--src/containers/settings/RecipesScreen.js38
-rw-r--r--src/containers/settings/TeamScreen.js3
6 files changed, 44 insertions, 75 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js
index db3b2a4a7..8d92b01be 100644
--- a/src/containers/settings/AccountScreen.js
+++ b/src/containers/settings/AccountScreen.js
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react'; 3import { inject, observer } from 'mobx-react';
4 4
5import PaymentStore from '../../stores/PaymentStore';
6import UserStore from '../../stores/UserStore'; 5import UserStore from '../../stores/UserStore';
7import AppStore from '../../stores/AppStore'; 6import AppStore from '../../stores/AppStore';
8import FeaturesStore from '../../stores/FeaturesStore'; 7import FeaturesStore from '../../stores/FeaturesStore';
@@ -24,10 +23,9 @@ class AccountScreen extends Component {
24 } 23 }
25 24
26 reloadData() { 25 reloadData() {
27 const { user, payment } = this.props.stores; 26 const { user } = this.props.stores;
28 27
29 user.getUserInfoRequest.reload(); 28 user.getUserInfoRequest.reload();
30 payment.plansRequest.reload();
31 } 29 }
32 30
33 handleWebsiteLink(route) { 31 handleWebsiteLink(route) {
@@ -48,28 +46,17 @@ class AccountScreen extends Component {
48 } 46 }
49 47
50 render() { 48 render() {
51 const { 49 const { user, settings } = this.props.stores;
52 user, 50 const { user: userActions } = this.props.actions;
53 payment,
54 features,
55 settings,
56 } = this.props.stores;
57 const { user: userActions, payment: paymentActions } = this.props.actions;
58 51
59 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; 52 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
60 const isLoadingPlans = payment.plansRequest.isExecuting;
61
62 const { upgradeAccount } = paymentActions;
63 53
64 return ( 54 return (
65 <ErrorBoundary> 55 <ErrorBoundary>
66 <AccountDashboard 56 <AccountDashboard
67 server={settings.all.app.server} 57 server={settings.all.app.server}
68 user={user.data} 58 user={user.data}
69 isPremiumOverrideUser={user.isPremiumOverride}
70 isProUser={user.isPro}
71 isLoading={isLoadingUserInfo} 59 isLoading={isLoadingUserInfo}
72 isLoadingPlans={isLoadingPlans}
73 userInfoRequestFailed={ 60 userInfoRequestFailed={
74 user.getUserInfoRequest.wasExecuted 61 user.getUserInfoRequest.wasExecuted
75 && user.getUserInfoRequest.isError 62 && user.getUserInfoRequest.isError
@@ -83,10 +70,6 @@ class AccountScreen extends Component {
83 && !user.deleteAccountRequest.isError 70 && !user.deleteAccountRequest.isError
84 } 71 }
85 openEditAccount={() => this.handleWebsiteLink('/user/profile')} 72 openEditAccount={() => this.handleWebsiteLink('/user/profile')}
86 upgradeToPro={() => upgradeAccount({
87 planId: features.features.pricingConfig.plans.pro.yearly.id,
88 })}
89 openBilling={() => this.handleWebsiteLink('/user/billing')}
90 openInvoices={() => this.handleWebsiteLink('/user/invoices')} 73 openInvoices={() => this.handleWebsiteLink('/user/invoices')}
91 /> 74 />
92 </ErrorBoundary> 75 </ErrorBoundary>
@@ -98,12 +81,10 @@ AccountScreen.wrappedComponent.propTypes = {
98 stores: PropTypes.shape({ 81 stores: PropTypes.shape({
99 user: PropTypes.instanceOf(UserStore).isRequired, 82 user: PropTypes.instanceOf(UserStore).isRequired,
100 features: PropTypes.instanceOf(FeaturesStore).isRequired, 83 features: PropTypes.instanceOf(FeaturesStore).isRequired,
101 payment: PropTypes.instanceOf(PaymentStore).isRequired,
102 settings: PropTypes.instanceOf(SettingsStore).isRequired, 84 settings: PropTypes.instanceOf(SettingsStore).isRequired,
103 app: PropTypes.instanceOf(AppStore).isRequired, 85 app: PropTypes.instanceOf(AppStore).isRequired,
104 }).isRequired, 86 }).isRequired,
105 actions: PropTypes.shape({ 87 actions: PropTypes.shape({
106 payment: PropTypes.instanceOf(PaymentStore).isRequired,
107 app: PropTypes.instanceOf(AppStore).isRequired, 88 app: PropTypes.instanceOf(AppStore).isRequired,
108 user: PropTypes.instanceOf(UserStore).isRequired, 89 user: PropTypes.instanceOf(UserStore).isRequired,
109 }).isRequired, 90 }).isRequired,
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index ddf2d2d25..c880e97ae 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -19,7 +19,6 @@ import { required, url, oneRequired } from '../../helpers/validation-helpers';
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 19import { getSelectOptions } from '../../helpers/i18n-helpers';
20 20
21import { config as proxyFeature } from '../../features/serviceProxy'; 21import { config as proxyFeature } from '../../features/serviceProxy';
22import { config as spellcheckerFeature } from '../../features/spellchecker';
23 22
24import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; 23import { SPELLCHECKER_LOCALES } from '../../i18n/languages';
25 24
@@ -346,7 +345,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
346 345
347 render() { 346 render() {
348 const { 347 const {
349 recipes, services, user, settings, 348 recipes, services, user,
350 } = this.props.stores; 349 } = this.props.stores;
351 const { action } = this.props.router.params; 350 const { action } = this.props.router.params;
352 351
@@ -395,13 +394,10 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
395 status={services.actionStatus} 394 status={services.actionStatus}
396 isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} 395 isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting}
397 isDeleting={services.deleteServiceRequest.isExecuting} 396 isDeleting={services.deleteServiceRequest.isExecuting}
398 onSubmit={d => this.onSubmit(d)} 397 onSubmit={(d) => this.onSubmit(d)}
399 onDelete={() => this.deleteService()} 398 onDelete={() => this.deleteService()}
400 openRecipeFile={file => this.openRecipeFile(file)} 399 openRecipeFile={(file) => this.openRecipeFile(file)}
401 isProxyFeatureEnabled={proxyFeature.isEnabled} 400 isProxyFeatureEnabled={proxyFeature.isEnabled}
402 isServiceProxyIncludedInCurrentPlan={proxyFeature.isIncludedInCurrentPlan}
403 isSpellcheckerIncludedInCurrentPlan={spellcheckerFeature.isIncludedInCurrentPlan}
404 isHibernationFeatureActive={settings.app.hibernate}
405 /> 401 />
406 </ErrorBoundary> 402 </ErrorBoundary>
407 ); 403 );
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index d601e03d4..0d718489a 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -11,10 +11,9 @@ import Form from '../../lib/Form';
11import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; 11import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages';
12import { 12import {
13 HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, SEARCH_ENGINE_NAMES, TODO_APPS, 13 HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, SEARCH_ENGINE_NAMES, TODO_APPS,
14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, 14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, WAKE_UP_STRATEGIES,
15} from '../../config'; 15} from '../../config';
16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; 16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment';
17import { config as spellcheckerConfig } from '../../features/spellchecker';
18 17
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 18import { getSelectOptions } from '../../helpers/i18n-helpers';
20import { hash } from '../../helpers/password-helpers'; 19import { hash } from '../../helpers/password-helpers';
@@ -27,6 +26,8 @@ import globalMessages from '../../i18n/globalMessages';
27import WorkspacesStore from '../../features/workspaces/store'; 26import WorkspacesStore from '../../features/workspaces/store';
28import ServicesStore from '../../stores/ServicesStore'; 27import ServicesStore from '../../stores/ServicesStore';
29 28
29const debug = require('debug')('Ferdi:EditSettingsScreen');
30
30const messages = defineMessages({ 31const messages = defineMessages({
31 autoLaunchOnStart: { 32 autoLaunchOnStart: {
32 id: 'settings.app.form.autoLaunchOnStart', 33 id: 'settings.app.form.autoLaunchOnStart',
@@ -88,10 +89,6 @@ const messages = defineMessages({
88 id: 'settings.app.form.sentry', 89 id: 'settings.app.form.sentry',
89 defaultMessage: '!!!Send telemetry data', 90 defaultMessage: '!!!Send telemetry data',
90 }, 91 },
91 hibernate: {
92 id: 'settings.app.form.hibernate',
93 defaultMessage: '!!!Enable service hibernation',
94 },
95 hibernateOnStartup: { 92 hibernateOnStartup: {
96 id: 'settings.app.form.hibernateOnStartup', 93 id: 'settings.app.form.hibernateOnStartup',
97 defaultMessage: '!!!Keep services in hibernation on startup', 94 defaultMessage: '!!!Keep services in hibernation on startup',
@@ -100,6 +97,10 @@ const messages = defineMessages({
100 id: 'settings.app.form.hibernationStrategy', 97 id: 'settings.app.form.hibernationStrategy',
101 defaultMessage: '!!!Hibernation strategy', 98 defaultMessage: '!!!Hibernation strategy',
102 }, 99 },
100 wakeUpStrategy: {
101 id: 'settings.app.form.wakeUpStrategy',
102 defaultMessage: '!!!Wake up strategy',
103 },
103 predefinedTodoServer: { 104 predefinedTodoServer: {
104 id: 'settings.app.form.predefinedTodoServer', 105 id: 'settings.app.form.predefinedTodoServer',
105 defaultMessage: '!!!Todo Server', 106 defaultMessage: '!!!Todo Server',
@@ -242,6 +243,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
242 openInBackground: settingsData.autoLaunchInBackground, 243 openInBackground: settingsData.autoLaunchInBackground,
243 }); 244 });
244 245
246 debug(`Updating settings store with data: ${settingsData}`);
247
245 settings.update({ 248 settings.update({
246 type: 'app', 249 type: 'app',
247 data: { 250 data: {
@@ -257,9 +260,9 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
257 navigationBarBehaviour: settingsData.navigationBarBehaviour, 260 navigationBarBehaviour: settingsData.navigationBarBehaviour,
258 searchEngine: settingsData.searchEngine, 261 searchEngine: settingsData.searchEngine,
259 sentry: settingsData.sentry, 262 sentry: settingsData.sentry,
260 hibernate: settingsData.hibernate,
261 hibernateOnStartup: settingsData.hibernateOnStartup, 263 hibernateOnStartup: settingsData.hibernateOnStartup,
262 hibernationStrategy: settingsData.hibernationStrategy, 264 hibernationStrategy: settingsData.hibernationStrategy,
265 wakeUpStrategy: settingsData.wakeUpStrategy,
263 predefinedTodoServer: settingsData.predefinedTodoServer, 266 predefinedTodoServer: settingsData.predefinedTodoServer,
264 customTodoServer: settingsData.customTodoServer, 267 customTodoServer: settingsData.customTodoServer,
265 lockingFeatureEnabled: settingsData.lockingFeatureEnabled, 268 lockingFeatureEnabled: settingsData.lockingFeatureEnabled,
@@ -339,6 +342,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
339 sort: false, 342 sort: false,
340 }); 343 });
341 344
345 const wakeUpStrategies = getSelectOptions({
346 locales: WAKE_UP_STRATEGIES,
347 sort: false,
348 });
349
342 const todoApp = getSelectOptions({ 350 const todoApp = getSelectOptions({
343 locales: TODO_APPS, 351 locales: TODO_APPS,
344 sort: false, 352 sort: false,
@@ -433,11 +441,6 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
433 value: settings.all.app.sentry, 441 value: settings.all.app.sentry,
434 default: DEFAULT_APP_SETTINGS.sentry, 442 default: DEFAULT_APP_SETTINGS.sentry,
435 }, 443 },
436 hibernate: {
437 label: intl.formatMessage(messages.hibernate),
438 value: settings.all.app.hibernate,
439 default: DEFAULT_APP_SETTINGS.hibernate,
440 },
441 hibernateOnStartup: { 444 hibernateOnStartup: {
442 label: intl.formatMessage(messages.hibernateOnStartup), 445 label: intl.formatMessage(messages.hibernateOnStartup),
443 value: settings.all.app.hibernateOnStartup, 446 value: settings.all.app.hibernateOnStartup,
@@ -449,6 +452,12 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
449 options: hibernationStrategies, 452 options: hibernationStrategies,
450 default: DEFAULT_APP_SETTINGS.hibernationStrategy, 453 default: DEFAULT_APP_SETTINGS.hibernationStrategy,
451 }, 454 },
455 wakeUpStrategy: {
456 label: intl.formatMessage(messages.wakeUpStrategy),
457 value: settings.all.app.wakeUpStrategy,
458 options: wakeUpStrategies,
459 default: DEFAULT_APP_SETTINGS.wakeUpStrategy,
460 },
452 predefinedTodoServer: { 461 predefinedTodoServer: {
453 label: intl.formatMessage(messages.predefinedTodoServer), 462 label: intl.formatMessage(messages.predefinedTodoServer),
454 value: settings.all.app.predefinedTodoServer, 463 value: settings.all.app.predefinedTodoServer,
@@ -516,8 +525,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
516 }, 525 },
517 enableSpellchecking: { 526 enableSpellchecking: {
518 label: intl.formatMessage(messages.enableSpellchecking), 527 label: intl.formatMessage(messages.enableSpellchecking),
519 value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking, 528 value: settings.all.app.enableSpellchecking,
520 default: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, 529 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
521 }, 530 },
522 spellcheckerLanguage: { 531 spellcheckerLanguage: {
523 label: intl.formatMessage(globalMessages.spellcheckerLanguage), 532 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
@@ -646,16 +655,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
646 isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE} 655 isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE}
647 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} 656 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE}
648 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} 657 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED}
649 onSubmit={d => this.onSubmit(d)} 658 onSubmit={(d) => this.onSubmit(d)}
650 getCacheSize={() => app.cacheSize} 659 getCacheSize={() => app.cacheSize}
651 isClearingAllCache={isClearingAllCache} 660 isClearingAllCache={isClearingAllCache}
652 onClearAllCache={clearAllCache} 661 onClearAllCache={clearAllCache}
653 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan}
654 isTodosEnabled={todos.isFeatureActive} 662 isTodosEnabled={todos.isFeatureActive}
655 isWorkspaceEnabled={workspaces.isFeatureActive} 663 isWorkspaceEnabled={workspaces.isFeatureActive}
656 lockingFeatureEnabled={lockingFeatureEnabled} 664 lockingFeatureEnabled={lockingFeatureEnabled}
657 automaticUpdates={this.props.stores.settings.app.automaticUpdates} 665 automaticUpdates={this.props.stores.settings.app.automaticUpdates}
658 hibernationEnabled={this.props.stores.settings.app.hibernate}
659 isDarkmodeEnabled={this.props.stores.settings.app.darkMode} 666 isDarkmodeEnabled={this.props.stores.settings.app.darkMode}
660 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode} 667 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode}
661 isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser} 668 isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser}
diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js
index 8e93164de..820b5e4d3 100644
--- a/src/containers/settings/EditUserScreen.js
+++ b/src/containers/settings/EditUserScreen.js
@@ -141,7 +141,7 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten
141 status={user.actionStatus} 141 status={user.actionStatus}
142 form={form} 142 form={form}
143 isSaving={user.updateUserInfoRequest.isExecuting} 143 isSaving={user.updateUserInfoRequest.isExecuting}
144 onSubmit={d => this.onSubmit(d)} 144 onSubmit={(d) => this.onSubmit(d)}
145 /> 145 />
146 </ErrorBoundary> 146 </ErrorBoundary>
147 ); 147 );
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index f12f67b1f..52bf31383 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -1,11 +1,9 @@
1import { shell } from 'electron'; 1import { shell } from 'electron';
2import { app } from '@electron/remote'; 2import { ensureDirSync, readJsonSync } from 'fs-extra';
3import fs from 'fs-extra';
4import React, { Component } from 'react'; 3import React, { Component } from 'react';
5import PropTypes from 'prop-types'; 4import PropTypes from 'prop-types';
6import { autorun } from 'mobx'; 5import { autorun } from 'mobx';
7import { inject, observer } from 'mobx-react'; 6import { inject, observer } from 'mobx-react';
8import path from 'path';
9 7
10import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; 8import RecipePreviewsStore from '../../stores/RecipePreviewsStore';
11import RecipeStore from '../../stores/RecipesStore'; 9import RecipeStore from '../../stores/RecipesStore';
@@ -15,7 +13,7 @@ import UserStore from '../../stores/UserStore';
15import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; 13import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard';
16import ErrorBoundary from '../../components/util/ErrorBoundary'; 14import ErrorBoundary from '../../components/util/ErrorBoundary';
17import { CUSTOM_WEBSITE_RECIPE_ID, FRANZ_DEV_DOCS } from '../../config'; 15import { CUSTOM_WEBSITE_RECIPE_ID, FRANZ_DEV_DOCS } from '../../config';
18import { RECIPES_PATH } from '../../environment'; 16import { asarRecipesPath, userDataRecipesPath } from '../../environment';
19import { communityRecipesStore } from '../../features/communityRecipes'; 17import { communityRecipesStore } from '../../features/communityRecipes';
20import RecipePreview from '../../models/RecipePreview'; 18import RecipePreview from '../../models/RecipePreview';
21import AppStore from '../../stores/AppStore'; 19import AppStore from '../../stores/AppStore';
@@ -45,18 +43,16 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
45 constructor(props) { 43 constructor(props) {
46 super(props); 44 super(props);
47 45
48 this.customRecipes = fs.readJsonSync(path.join(RECIPES_PATH, 'all.json')); 46 this.customRecipes = readJsonSync(asarRecipesPath('all.json'));
49 } 47 }
50 48
51 componentDidMount() { 49 componentDidMount() {
52 this.autorunDisposer = autorun(() => { 50 this.autorunDisposer = autorun(() => {
53 const { filter } = this.props.params; 51 const { filter } = { filter: 'all', ...this.props.params };
54 const { currentFilter } = this.state; 52 const { currentFilter } = this.state;
55 53
56 if (filter === 'all' && currentFilter !== 'all') { 54 if (filter === 'all' && currentFilter !== 'all') {
57 this.setState({ currentFilter: 'all' }); 55 this.setState({ currentFilter: 'all' });
58 } else if (filter === 'featured' && currentFilter !== 'featured') {
59 this.setState({ currentFilter: 'featured' });
60 } else if (filter === 'dev' && currentFilter !== 'dev') { 56 } else if (filter === 'dev' && currentFilter !== 'dev') {
61 this.setState({ currentFilter: 'dev' }); 57 this.setState({ currentFilter: 'dev' });
62 } 58 }
@@ -82,7 +78,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
82 return recipes 78 return recipes
83 // Filter out duplicate recipes 79 // Filter out duplicate recipes
84 .filter((recipe, index, self) => { 80 .filter((recipe, index, self) => {
85 const ids = self.map(rec => rec.id); 81 const ids = self.map((rec) => rec.id);
86 return ids.indexOf(recipe.id) === index; 82 return ids.indexOf(recipe.id) === index;
87 83
88 // Sort alphabetically 84 // Sort alphabetically
@@ -95,7 +91,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
95 91
96 // Create an array of RecipePreviews from an array of recipe objects 92 // Create an array of RecipePreviews from an array of recipe objects
97 createPreviews(recipes) { 93 createPreviews(recipes) {
98 return recipes.map(recipe => new RecipePreview(recipe)); 94 return recipes.map((recipe) => new RecipePreview(recipe));
99 } 95 }
100 96
101 resetSearch() { 97 resetSearch() {
@@ -107,7 +103,6 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
107 recipePreviews, 103 recipePreviews,
108 recipes, 104 recipes,
109 services, 105 services,
110 user,
111 } = this.props.stores; 106 } = this.props.stores;
112 107
113 const { 108 const {
@@ -115,7 +110,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
115 service: serviceActions, 110 service: serviceActions,
116 } = this.props.actions; 111 } = this.props.actions;
117 112
118 const { filter } = this.props.params; 113 const { filter } = { filter: 'all', ...this.props.params };
119 let recipeFilter; 114 let recipeFilter;
120 115
121 if (filter === 'all') { 116 if (filter === 'all') {
@@ -125,8 +120,6 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
125 ]); 120 ]);
126 } else if (filter === 'dev') { 121 } else if (filter === 'dev') {
127 recipeFilter = communityRecipesStore.communityRecipes; 122 recipeFilter = communityRecipesStore.communityRecipes;
128 } else {
129 recipeFilter = recipePreviews.featured;
130 } 123 }
131 124
132 const allRecipes = this.state.needle ? this.prepareRecipes([ 125 const allRecipes = this.state.needle ? this.prepareRecipes([
@@ -135,18 +128,17 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
135 // All search recipes from local recipes 128 // All search recipes from local recipes
136 ...this.createPreviews( 129 ...this.createPreviews(
137 this.customRecipes 130 this.customRecipes
138 .filter(service => service.name.toLowerCase().includes(this.state.needle.toLowerCase())), 131 .filter((service) => service.name.toLowerCase().includes(this.state.needle.toLowerCase()) || (service.aliases || []).some(alias => alias.toLowerCase().includes(this.state.needle.toLowerCase()))),
139 ), 132 ),
140 ]) : recipeFilter; 133 ]) : recipeFilter;
141 134
142 const customWebsiteRecipe = recipePreviews.all.find(service => service.id === CUSTOM_WEBSITE_RECIPE_ID); 135 const customWebsiteRecipe = recipePreviews.all.find((service) => service.id === CUSTOM_WEBSITE_RECIPE_ID);
143 136
144 const isLoading = recipePreviews.featuredRecipePreviewsRequest.isExecuting 137 const isLoading = recipePreviews.allRecipePreviewsRequest.isExecuting
145 || recipePreviews.allRecipePreviewsRequest.isExecuting
146 || recipes.installRecipeRequest.isExecuting 138 || recipes.installRecipeRequest.isExecuting
147 || recipePreviews.searchRecipePreviewsRequest.isExecuting; 139 || recipePreviews.searchRecipePreviewsRequest.isExecuting;
148 140
149 const recipeDirectory = path.join(app.getPath('userData'), 'recipes', 'dev'); 141 const recipeDirectory = userDataRecipesPath('dev');
150 142
151 return ( 143 return (
152 <ErrorBoundary> 144 <ErrorBoundary>
@@ -155,24 +147,20 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
155 customWebsiteRecipe={customWebsiteRecipe} 147 customWebsiteRecipe={customWebsiteRecipe}
156 isLoading={isLoading} 148 isLoading={isLoading}
157 addedServiceCount={services.all.length} 149 addedServiceCount={services.all.length}
158 isPremium={user.data.isPremium}
159 hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted}
160 showAddServiceInterface={serviceActions.showAddServiceInterface} 150 showAddServiceInterface={serviceActions.showAddServiceInterface}
161 searchRecipes={e => this.searchRecipes(e)} 151 searchRecipes={(e) => this.searchRecipes(e)}
162 resetSearch={() => this.resetSearch()} 152 resetSearch={() => this.resetSearch()}
163 searchNeedle={this.state.needle} 153 searchNeedle={this.state.needle}
164 serviceStatus={services.actionStatus} 154 serviceStatus={services.actionStatus}
165 recipeFilter={filter} 155 recipeFilter={filter}
166 recipeDirectory={recipeDirectory} 156 recipeDirectory={recipeDirectory}
167 openRecipeDirectory={async () => { 157 openRecipeDirectory={async () => {
168 await fs.ensureDir(recipeDirectory); 158 ensureDirSync(recipeDirectory);
169 shell.openExternal(`file://${recipeDirectory}`); 159 shell.openExternal(`file://${recipeDirectory}`);
170 }} 160 }}
171 openDevDocs={() => { 161 openDevDocs={() => {
172 appActions.openExternalUrl({ url: FRANZ_DEV_DOCS }); 162 appActions.openExternalUrl({ url: FRANZ_DEV_DOCS });
173 }} 163 }}
174 isCommunityRecipesIncludedInCurrentPlan={communityRecipesStore.isCommunityRecipesIncludedInCurrentPlan}
175 isUserPremiumUser={user.isPremium}
176 /> 164 />
177 </ErrorBoundary> 165 </ErrorBoundary>
178 ); 166 );
diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js
index a627a047a..10c2e36ef 100644
--- a/src/containers/settings/TeamScreen.js
+++ b/src/containers/settings/TeamScreen.js
@@ -9,7 +9,6 @@ import SettingsStore from '../../stores/SettingsStore';
9import TeamDashboard from '../../components/settings/team/TeamDashboard'; 9import TeamDashboard from '../../components/settings/team/TeamDashboard';
10import ErrorBoundary from '../../components/util/ErrorBoundary'; 10import ErrorBoundary from '../../components/util/ErrorBoundary';
11import { DEV_API_FRANZ_WEBSITE } from '../../config'; 11import { DEV_API_FRANZ_WEBSITE } from '../../config';
12import PaymentStore from '../../stores/PaymentStore';
13 12
14export default @inject('stores', 'actions') @observer class TeamScreen extends Component { 13export default @inject('stores', 'actions') @observer class TeamScreen extends Component {
15 handleWebsiteLink(route) { 14 handleWebsiteLink(route) {
@@ -33,7 +32,6 @@ export default @inject('stores', 'actions') @observer class TeamScreen extends C
33 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} 32 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError}
34 retryUserInfoRequest={() => this.reloadData()} 33 retryUserInfoRequest={() => this.reloadData()}
35 openTeamManagement={() => this.handleWebsiteLink('/user/team')} 34 openTeamManagement={() => this.handleWebsiteLink('/user/team')}
36 isProUser={user.isPro}
37 server={server} 35 server={server}
38 /> 36 />
39 </ErrorBoundary> 37 </ErrorBoundary>
@@ -48,7 +46,6 @@ TeamScreen.wrappedComponent.propTypes = {
48 settings: PropTypes.instanceOf(SettingsStore).isRequired, 46 settings: PropTypes.instanceOf(SettingsStore).isRequired,
49 }).isRequired, 47 }).isRequired,
50 actions: PropTypes.shape({ 48 actions: PropTypes.shape({
51 payment: PropTypes.instanceOf(PaymentStore).isRequired,
52 app: PropTypes.instanceOf(AppStore).isRequired, 49 app: PropTypes.instanceOf(AppStore).isRequired,
53 user: PropTypes.instanceOf(UserStore).isRequired, 50 user: PropTypes.instanceOf(UserStore).isRequired,
54 }).isRequired, 51 }).isRequired,