aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings
diff options
context:
space:
mode:
authorLibravatar Amine Mouafik <amine@mouafik.fr>2019-05-12 20:00:41 +0700
committerLibravatar Amine Mouafik <amine@mouafik.fr>2019-05-12 20:00:41 +0700
commitd8a1d5f9151cc31f4c2b5c0096a35e49b2c74d61 (patch)
tree3974d449d8ef389fc61bf880ae758b5debc22a80 /src/containers/settings
parentUse dark background in SVG logo (diff)
parentUpdate CHANGELOG.md (diff)
downloadferdium-app-d8a1d5f9151cc31f4c2b5c0096a35e49b2c74d61.tar.gz
ferdium-app-d8a1d5f9151cc31f4c2b5c0096a35e49b2c74d61.tar.zst
ferdium-app-d8a1d5f9151cc31f4c2b5c0096a35e49b2c74d61.zip
Merge tag 'v5.1.0'
# Conflicts: # README.md # src/components/layout/AppLayout.js
Diffstat (limited to 'src/containers/settings')
-rw-r--r--src/containers/settings/AccountScreen.js56
-rw-r--r--src/containers/settings/EditServiceScreen.js45
-rw-r--r--src/containers/settings/EditSettingsScreen.js21
-rw-r--r--src/containers/settings/EditUserScreen.js49
-rw-r--r--src/containers/settings/InviteScreen.js6
-rw-r--r--src/containers/settings/RecipesScreen.js6
-rw-r--r--src/containers/settings/ServicesScreen.js5
-rw-r--r--src/containers/settings/SettingsWindow.js2
-rw-r--r--src/containers/settings/TeamScreen.js57
9 files changed, 121 insertions, 126 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js
index d681d5226..b3f967353 100644
--- a/src/containers/settings/AccountScreen.js
+++ b/src/containers/settings/AccountScreen.js
@@ -1,4 +1,3 @@
1import { remote } from 'electron';
2import React, { Component } from 'react'; 1import React, { Component } from 'react';
3import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
4import { inject, observer } from 'mobx-react'; 3import { inject, observer } from 'mobx-react';
@@ -6,92 +5,55 @@ import { inject, observer } from 'mobx-react';
6import PaymentStore from '../../stores/PaymentStore'; 5import PaymentStore from '../../stores/PaymentStore';
7import UserStore from '../../stores/UserStore'; 6import UserStore from '../../stores/UserStore';
8import AppStore from '../../stores/AppStore'; 7import AppStore from '../../stores/AppStore';
9import { gaPage } from '../../lib/analytics';
10 8
11import AccountDashboard from '../../components/settings/account/AccountDashboard'; 9import AccountDashboard from '../../components/settings/account/AccountDashboard';
12import ErrorBoundary from '../../components/util/ErrorBoundary'; 10import ErrorBoundary from '../../components/util/ErrorBoundary';
13 11import { WEBSITE } from '../../environment';
14const { BrowserWindow } = remote;
15 12
16export default @inject('stores', 'actions') @observer class AccountScreen extends Component { 13export default @inject('stores', 'actions') @observer class AccountScreen extends Component {
17 componentWillMount() {
18 const {
19 user,
20 } = this.props.stores;
21
22 user.getUserInfoRequest.invalidate({ immediately: true });
23 }
24
25 componentDidMount() {
26 gaPage('Settings/Account Dashboard');
27 }
28
29 onCloseWindow() { 14 onCloseWindow() {
30 const { user, payment } = this.props.stores; 15 const { user } = this.props.stores;
31 user.getUserInfoRequest.invalidate({ immediately: true }); 16 user.getUserInfoRequest.invalidate({ immediately: true });
32 payment.ordersDataRequest.invalidate({ immediately: true });
33 } 17 }
34 18
35 reloadData() { 19 reloadData() {
36 const { user, payment } = this.props.stores; 20 const { user, payment } = this.props.stores;
37 21
38 user.getUserInfoRequest.reload(); 22 user.getUserInfoRequest.reload();
39 payment.ordersDataRequest.reload();
40 payment.plansRequest.reload(); 23 payment.plansRequest.reload();
41 } 24 }
42 25
43 async handlePaymentDashboard() { 26 handleWebsiteLink(route) {
44 const { actions, stores } = this.props; 27 const { actions, stores } = this.props;
45 28
46 actions.payment.createDashboardUrl(); 29 const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`;
47 30 console.log(url);
48 const dashboard = await stores.payment.createDashboardUrlRequest;
49
50 if (dashboard.url) {
51 const paymentWindow = new BrowserWindow({
52 title: '🔒 Franz Subscription Dashboard',
53 parent: remote.getCurrentWindow(),
54 modal: false,
55 width: 900,
56 minWidth: 600,
57 webPreferences: {
58 nodeIntegration: false,
59 },
60 });
61 paymentWindow.loadURL(dashboard.url);
62 31
63 paymentWindow.on('closed', () => { 32 actions.app.openExternalUrl({ url });
64 this.onCloseWindow();
65 });
66 }
67 } 33 }
68 34
69 render() { 35 render() {
70 const { user, payment } = this.props.stores; 36 const { user, payment } = this.props.stores;
71 const { openExternalUrl } = this.props.actions.app;
72 const { user: userActions } = this.props.actions; 37 const { user: userActions } = this.props.actions;
73 38
74 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; 39 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
75 const isLoadingOrdersInfo = payment.ordersDataRequest.isExecuting;
76 const isLoadingPlans = payment.plansRequest.isExecuting; 40 const isLoadingPlans = payment.plansRequest.isExecuting;
77 41
78 return ( 42 return (
79 <ErrorBoundary> 43 <ErrorBoundary>
80 <AccountDashboard 44 <AccountDashboard
81 user={user.data} 45 user={user.data}
82 orders={payment.orders}
83 isLoading={isLoadingUserInfo} 46 isLoading={isLoadingUserInfo}
84 isLoadingOrdersInfo={isLoadingOrdersInfo}
85 isLoadingPlans={isLoadingPlans} 47 isLoadingPlans={isLoadingPlans}
86 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} 48 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError}
87 retryUserInfoRequest={() => this.reloadData()} 49 retryUserInfoRequest={() => this.reloadData()}
88 isCreatingPaymentDashboardUrl={payment.createDashboardUrlRequest.isExecuting}
89 openDashboard={price => this.handlePaymentDashboard(price)}
90 openExternalUrl={url => openExternalUrl({ url })}
91 onCloseSubscriptionWindow={() => this.onCloseWindow()} 50 onCloseSubscriptionWindow={() => this.onCloseWindow()}
92 deleteAccount={userActions.delete} 51 deleteAccount={userActions.delete}
93 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} 52 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting}
94 isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} 53 isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError}
54 openEditAccount={() => this.handleWebsiteLink('/user/profile')}
55 openBilling={() => this.handleWebsiteLink('/user/billing')}
56 openInvoices={() => this.handleWebsiteLink('/user/invoices')}
95 /> 57 />
96 </ErrorBoundary> 58 </ErrorBoundary>
97 ); 59 );
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index b46908344..870ca4ecd 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -9,7 +9,6 @@ import ServicesStore from '../../stores/ServicesStore';
9import SettingsStore from '../../stores/SettingsStore'; 9import SettingsStore from '../../stores/SettingsStore';
10import FeaturesStore from '../../stores/FeaturesStore'; 10import FeaturesStore from '../../stores/FeaturesStore';
11import Form from '../../lib/Form'; 11import Form from '../../lib/Form';
12import { gaPage } from '../../lib/analytics';
13 12
14import ServiceError from '../../components/settings/services/ServiceError'; 13import ServiceError from '../../components/settings/services/ServiceError';
15import EditServiceForm from '../../components/settings/services/EditServiceForm'; 14import EditServiceForm from '../../components/settings/services/EditServiceForm';
@@ -19,9 +18,12 @@ import { required, url, oneRequired } from '../../helpers/validation-helpers';
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 18import { getSelectOptions } from '../../helpers/i18n-helpers';
20 19
21import { config as proxyFeature } from '../../features/serviceProxy'; 20import { config as proxyFeature } from '../../features/serviceProxy';
21import { config as spellcheckerFeature } from '../../features/spellchecker';
22 22
23import { SPELLCHECKER_LOCALES } from '../../i18n/languages'; 23import { SPELLCHECKER_LOCALES } from '../../i18n/languages';
24 24
25import globalMessages from '../../i18n/globalMessages';
26
25const messages = defineMessages({ 27const messages = defineMessages({
26 name: { 28 name: {
27 id: 'settings.service.form.name', 29 id: 'settings.service.form.name',
@@ -83,14 +85,6 @@ const messages = defineMessages({
83 id: 'settings.service.form.proxy.password', 85 id: 'settings.service.form.proxy.password',
84 defaultMessage: '!!!Password', 86 defaultMessage: '!!!Password',
85 }, 87 },
86 spellcheckerLanguage: {
87 id: 'settings.service.form.spellcheckerLanguage',
88 defaultMessage: '!!!Spell checking Language',
89 },
90 spellcheckerSystemDefault: {
91 id: 'settings.service.form.spellcheckerLanguage.default',
92 defaultMessage: '!!!Use System Default ({default})',
93 },
94}); 88});
95 89
96export default @inject('stores', 'actions') @observer class EditServiceScreen extends Component { 90export default @inject('stores', 'actions') @observer class EditServiceScreen extends Component {
@@ -98,10 +92,6 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
98 intl: intlShape, 92 intl: intlShape,
99 }; 93 };
100 94
101 componentDidMount() {
102 gaPage('Settings/Service/Edit');
103 }
104
105 onSubmit(data) { 95 onSubmit(data) {
106 const { action } = this.props.router.params; 96 const { action } = this.props.router.params;
107 const { recipes, services } = this.props.stores; 97 const { recipes, services } = this.props.stores;
@@ -118,12 +108,26 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
118 } 108 }
119 109
120 prepareForm(recipe, service, proxy) { 110 prepareForm(recipe, service, proxy) {
111 const {
112 intl,
113 } = this.context;
114
115 const {
116 stores,
117 } = this.props;
118
119 let defaultSpellcheckerLanguage = SPELLCHECKER_LOCALES[stores.settings.app.spellcheckerLanguage];
120
121 if (stores.settings.app.spellcheckerLanguage === 'automatic') {
122 defaultSpellcheckerLanguage = intl.formatMessage(globalMessages.spellcheckerAutomaticDetectionShort);
123 }
124
121 const spellcheckerLanguage = getSelectOptions({ 125 const spellcheckerLanguage = getSelectOptions({
122 locales: SPELLCHECKER_LOCALES, 126 locales: SPELLCHECKER_LOCALES,
123 resetToDefaultText: this.context.intl.formatMessage(messages.spellcheckerSystemDefault, { default: SPELLCHECKER_LOCALES[this.props.stores.settings.app.spellcheckerLanguage] }), 127 resetToDefaultText: intl.formatMessage(globalMessages.spellcheckerSystemDefault, { default: defaultSpellcheckerLanguage }),
128 automaticDetectionText: stores.settings.app.spellcheckerLanguage !== 'automatic' ? intl.formatMessage(globalMessages.spellcheckerAutomaticDetection) : '',
124 }); 129 });
125 130
126 const { intl } = this.context;
127 const config = { 131 const config = {
128 fields: { 132 fields: {
129 name: { 133 name: {
@@ -160,13 +164,13 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
160 isDarkModeEnabled: { 164 isDarkModeEnabled: {
161 label: intl.formatMessage(messages.enableDarkMode), 165 label: intl.formatMessage(messages.enableDarkMode),
162 value: service.isDarkModeEnabled, 166 value: service.isDarkModeEnabled,
163 default: this.props.stores.settings.app.darkMode, 167 default: stores.settings.app.darkMode,
164 }, 168 },
165 spellcheckerLanguage: { 169 spellcheckerLanguage: {
166 label: intl.formatMessage(messages.spellcheckerLanguage), 170 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
167 value: service.spellcheckerLanguage, 171 value: service.spellcheckerLanguage,
168 options: spellcheckerLanguage, 172 options: spellcheckerLanguage,
169 disabled: !this.props.stores.settings.app.enableSpellchecking, 173 disabled: !stores.settings.app.enableSpellchecking,
170 }, 174 },
171 }, 175 },
172 }; 176 };
@@ -220,7 +224,7 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
220 } 224 }
221 225
222 if (proxy.isEnabled) { 226 if (proxy.isEnabled) {
223 const serviceProxyConfig = this.props.stores.settings.proxy[service.id] || {}; 227 const serviceProxyConfig = stores.settings.proxy[service.id] || {};
224 228
225 Object.assign(config.fields, { 229 Object.assign(config.fields, {
226 proxy: { 230 proxy: {
@@ -326,7 +330,8 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
326 onSubmit={d => this.onSubmit(d)} 330 onSubmit={d => this.onSubmit(d)}
327 onDelete={() => this.deleteService()} 331 onDelete={() => this.deleteService()}
328 isProxyFeatureEnabled={proxyFeature.isEnabled} 332 isProxyFeatureEnabled={proxyFeature.isEnabled}
329 isProxyFeaturePremiumFeature={proxyFeature.isPremium} 333 isProxyPremiumFeature={proxyFeature.isPremium}
334 isSpellcheckerPremiumFeature={spellcheckerFeature.isPremium}
330 /> 335 />
331 </ErrorBoundary> 336 </ErrorBoundary>
332 ); 337 );
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index f1706a721..97c1fa3b1 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -8,16 +8,16 @@ import SettingsStore from '../../stores/SettingsStore';
8import UserStore from '../../stores/UserStore'; 8import UserStore from '../../stores/UserStore';
9import Form from '../../lib/Form'; 9import Form from '../../lib/Form';
10import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; 10import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages';
11import { gaPage } from '../../lib/analytics';
12import { DEFAULT_APP_SETTINGS } from '../../config'; 11import { DEFAULT_APP_SETTINGS } from '../../config';
13import { config as spellcheckerConfig } from '../../features/spellchecker'; 12import { config as spellcheckerConfig } from '../../features/spellchecker';
14 13
15import { getSelectOptions } from '../../helpers/i18n-helpers'; 14import { getSelectOptions } from '../../helpers/i18n-helpers';
16 15
17
18import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; 16import EditSettingsForm from '../../components/settings/settings/EditSettingsForm';
19import ErrorBoundary from '../../components/util/ErrorBoundary'; 17import ErrorBoundary from '../../components/util/ErrorBoundary';
20 18
19import globalMessages from '../../i18n/globalMessages';
20
21const messages = defineMessages({ 21const messages = defineMessages({
22 autoLaunchOnStart: { 22 autoLaunchOnStart: {
23 id: 'settings.app.form.autoLaunchOnStart', 23 id: 'settings.app.form.autoLaunchOnStart',
@@ -63,10 +63,6 @@ const messages = defineMessages({
63 id: 'settings.app.form.enableGPUAcceleration', 63 id: 'settings.app.form.enableGPUAcceleration',
64 defaultMessage: '!!!Enable GPU Acceleration', 64 defaultMessage: '!!!Enable GPU Acceleration',
65 }, 65 },
66 spellcheckerLanguage: {
67 id: 'settings.app.form.spellcheckerLanguage',
68 defaultMessage: '!!!Language for spell checking',
69 },
70 beta: { 66 beta: {
71 id: 'settings.app.form.beta', 67 id: 'settings.app.form.beta',
72 defaultMessage: '!!!Include beta versions', 68 defaultMessage: '!!!Include beta versions',
@@ -78,10 +74,6 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
78 intl: intlShape, 74 intl: intlShape,
79 }; 75 };
80 76
81 componentDidMount() {
82 gaPage('Settings/App');
83 }
84
85 onSubmit(settingsData) { 77 onSubmit(settingsData) {
86 const { app, settings, user } = this.props.actions; 78 const { app, settings, user } = this.props.actions;
87 79
@@ -125,6 +117,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
125 117
126 const spellcheckingLanguages = getSelectOptions({ 118 const spellcheckingLanguages = getSelectOptions({
127 locales: SPELLCHECKER_LOCALES, 119 locales: SPELLCHECKER_LOCALES,
120 automaticDetectionText: this.context.intl.formatMessage(globalMessages.spellcheckerAutomaticDetection),
128 }); 121 });
129 122
130 const config = { 123 const config = {
@@ -166,11 +159,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
166 }, 159 },
167 enableSpellchecking: { 160 enableSpellchecking: {
168 label: intl.formatMessage(messages.enableSpellchecking), 161 label: intl.formatMessage(messages.enableSpellchecking),
169 value: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremiumFeature ? false : settings.all.app.enableSpellchecking, 162 value: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremium ? false : settings.all.app.enableSpellchecking,
170 default: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremiumFeature ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, 163 default: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremium ? false : DEFAULT_APP_SETTINGS.enableSpellchecking,
171 }, 164 },
172 spellcheckerLanguage: { 165 spellcheckerLanguage: {
173 label: intl.formatMessage(messages.spellcheckerLanguage), 166 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
174 value: settings.all.app.spellcheckerLanguage, 167 value: settings.all.app.spellcheckerLanguage,
175 options: spellcheckingLanguages, 168 options: spellcheckingLanguages,
176 default: DEFAULT_APP_SETTINGS.spellcheckerLanguage, 169 default: DEFAULT_APP_SETTINGS.spellcheckerLanguage,
@@ -230,7 +223,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
230 cacheSize={cacheSize} 223 cacheSize={cacheSize}
231 isClearingAllCache={isClearingAllCache} 224 isClearingAllCache={isClearingAllCache}
232 onClearAllCache={clearAllCache} 225 onClearAllCache={clearAllCache}
233 isSpellcheckerPremiumFeature={spellcheckerConfig.isPremiumFeature} 226 isSpellcheckerPremiumFeature={spellcheckerConfig.isPremium}
234 /> 227 />
235 </ErrorBoundary> 228 </ErrorBoundary>
236 ); 229 );
diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js
index 3d35effc5..81f689400 100644
--- a/src/containers/settings/EditUserScreen.js
+++ b/src/containers/settings/EditUserScreen.js
@@ -9,7 +9,6 @@ import EditUserForm from '../../components/settings/user/EditUserForm';
9import ErrorBoundary from '../../components/util/ErrorBoundary'; 9import ErrorBoundary from '../../components/util/ErrorBoundary';
10 10
11import { required, email, minLength } from '../../helpers/validation-helpers'; 11import { required, email, minLength } from '../../helpers/validation-helpers';
12import { gaPage } from '../../lib/analytics';
13 12
14const messages = defineMessages({ 13const messages = defineMessages({
15 firstname: { 14 firstname: {
@@ -24,23 +23,21 @@ const messages = defineMessages({
24 id: 'settings.user.form.email', 23 id: 'settings.user.form.email',
25 defaultMessage: '!!!Email', 24 defaultMessage: '!!!Email',
26 }, 25 },
27 accountType: { 26 accountTypeLabel: {
28 label: { 27 id: 'settings.user.form.accountType.label',
29 id: 'settings.user.form.accountType.label', 28 defaultMessage: '!!!Account type',
30 defaultMessage: '!!!Account type', 29 },
31 }, 30 accountTypeIndividual: {
32 individual: { 31 id: 'settings.user.form.accountType.individual',
33 id: 'settings.user.form.accountType.individual', 32 defaultMessage: '!!!Individual',
34 defaultMessage: '!!!Individual', 33 },
35 }, 34 accountTypeNonProfit: {
36 nonProfit: { 35 id: 'settings.user.form.accountType.non-profit',
37 id: 'settings.user.form.accountType.non-profit', 36 defaultMessage: '!!!Non-Profit',
38 defaultMessage: '!!!Non-Profit', 37 },
39 }, 38 accountTypeCompany: {
40 company: { 39 id: 'settings.user.form.accountType.company',
41 id: 'settings.user.form.accountType.company', 40 defaultMessage: '!!!Company',
42 defaultMessage: '!!!Company',
43 },
44 }, 41 },
45 currentPassword: { 42 currentPassword: {
46 id: 'settings.user.form.currentPassword', 43 id: 'settings.user.form.currentPassword',
@@ -57,10 +54,6 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten
57 intl: intlShape, 54 intl: intlShape,
58 }; 55 };
59 56
60 componentDidMount() {
61 gaPage('Settings/Account/Edit');
62 }
63
64 componentWillUnmount() { 57 componentWillUnmount() {
65 this.props.actions.user.resetStatus(); 58 this.props.actions.user.resetStatus();
66 } 59 }
@@ -99,21 +92,21 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten
99 accountType: { 92 accountType: {
100 value: user.accountType, 93 value: user.accountType,
101 validators: [required], 94 validators: [required],
102 label: intl.formatMessage(messages.accountType.label), 95 label: intl.formatMessage(messages.accountTypeLabel),
103 options: [{ 96 options: [{
104 value: 'individual', 97 value: 'individual',
105 label: intl.formatMessage(messages.accountType.individual), 98 label: intl.formatMessage(messages.accountTypeIndividual),
106 }, { 99 }, {
107 value: 'non-profit', 100 value: 'non-profit',
108 label: intl.formatMessage(messages.accountType.nonProfit), 101 label: intl.formatMessage(messages.accountTypeNonProfit),
109 }, { 102 }, {
110 value: 'company', 103 value: 'company',
111 label: intl.formatMessage(messages.accountType.company), 104 label: intl.formatMessage(messages.accountTypeCompany),
112 }], 105 }],
113 }, 106 },
114 organization: { 107 organization: {
115 label: intl.formatMessage(messages.accountType.company), 108 label: intl.formatMessage(messages.accountTypeCompany),
116 placeholder: intl.formatMessage(messages.accountType.company), 109 placeholder: intl.formatMessage(messages.accountTypeCompany),
117 value: user.organization, 110 value: user.organization,
118 }, 111 },
119 oldPassword: { 112 oldPassword: {
diff --git a/src/containers/settings/InviteScreen.js b/src/containers/settings/InviteScreen.js
index cd36610e4..cc36849e8 100644
--- a/src/containers/settings/InviteScreen.js
+++ b/src/containers/settings/InviteScreen.js
@@ -5,13 +5,7 @@ import { inject, observer } from 'mobx-react';
5import Invite from '../../components/auth/Invite'; 5import Invite from '../../components/auth/Invite';
6import ErrorBoundary from '../../components/util/ErrorBoundary'; 6import ErrorBoundary from '../../components/util/ErrorBoundary';
7 7
8import { gaPage } from '../../lib/analytics';
9
10export default @inject('stores', 'actions') @observer class InviteScreen extends Component { 8export default @inject('stores', 'actions') @observer class InviteScreen extends Component {
11 componentDidMount() {
12 gaPage('Settings/Invite');
13 }
14
15 componentWillUnmount() { 9 componentWillUnmount() {
16 this.props.stores.user.inviteRequest.reset(); 10 this.props.stores.user.inviteRequest.reset();
17 } 11 }
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js
index b3d758c87..eda5ae54c 100644
--- a/src/containers/settings/RecipesScreen.js
+++ b/src/containers/settings/RecipesScreen.js
@@ -7,7 +7,6 @@ import RecipePreviewsStore from '../../stores/RecipePreviewsStore';
7import RecipeStore from '../../stores/RecipesStore'; 7import RecipeStore from '../../stores/RecipesStore';
8import ServiceStore from '../../stores/ServicesStore'; 8import ServiceStore from '../../stores/ServicesStore';
9import UserStore from '../../stores/UserStore'; 9import UserStore from '../../stores/UserStore';
10import { gaPage } from '../../lib/analytics';
11 10
12import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; 11import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard';
13import ErrorBoundary from '../../components/util/ErrorBoundary'; 12import ErrorBoundary from '../../components/util/ErrorBoundary';
@@ -33,20 +32,15 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend
33 autorunDisposer = null; 32 autorunDisposer = null;
34 33
35 componentDidMount() { 34 componentDidMount() {
36 gaPage('Settings/Recipe Dashboard/Featured');
37
38 this.autorunDisposer = autorun(() => { 35 this.autorunDisposer = autorun(() => {
39 const { filter } = this.props.params; 36 const { filter } = this.props.params;
40 const { currentFilter } = this.state; 37 const { currentFilter } = this.state;
41 38
42 if (filter === 'all' && currentFilter !== 'all') { 39 if (filter === 'all' && currentFilter !== 'all') {
43 gaPage('Settings/Recipe Dashboard/All');
44 this.setState({ currentFilter: 'all' }); 40 this.setState({ currentFilter: 'all' });
45 } else if (filter === 'featured' && currentFilter !== 'featured') { 41 } else if (filter === 'featured' && currentFilter !== 'featured') {
46 gaPage('Settings/Recipe Dashboard/Featured');
47 this.setState({ currentFilter: 'featured' }); 42 this.setState({ currentFilter: 'featured' });
48 } else if (filter === 'dev' && currentFilter !== 'dev') { 43 } else if (filter === 'dev' && currentFilter !== 'dev') {
49 gaPage('Settings/Recipe Dashboard/Dev');
50 this.setState({ currentFilter: 'dev' }); 44 this.setState({ currentFilter: 'dev' });
51 } 45 }
52 }); 46 });
diff --git a/src/containers/settings/ServicesScreen.js b/src/containers/settings/ServicesScreen.js
index b70a5506e..a501bf530 100644
--- a/src/containers/settings/ServicesScreen.js
+++ b/src/containers/settings/ServicesScreen.js
@@ -6,16 +6,11 @@ import { RouterStore } from 'mobx-react-router';
6// import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; 6// import RecipePreviewsStore from '../../stores/RecipePreviewsStore';
7import UserStore from '../../stores/UserStore'; 7import UserStore from '../../stores/UserStore';
8import ServiceStore from '../../stores/ServicesStore'; 8import ServiceStore from '../../stores/ServicesStore';
9import { gaPage } from '../../lib/analytics';
10 9
11import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; 10import ServicesDashboard from '../../components/settings/services/ServicesDashboard';
12import ErrorBoundary from '../../components/util/ErrorBoundary'; 11import ErrorBoundary from '../../components/util/ErrorBoundary';
13 12
14export default @inject('stores', 'actions') @observer class ServicesScreen extends Component { 13export default @inject('stores', 'actions') @observer class ServicesScreen extends Component {
15 componentDidMount() {
16 gaPage('Settings/Service Dashboard');
17 }
18
19 componentWillUnmount() { 14 componentWillUnmount() {
20 this.props.actions.service.resetFilter(); 15 this.props.actions.service.resetFilter();
21 this.props.actions.service.resetStatus(); 16 this.props.actions.service.resetStatus();
diff --git a/src/containers/settings/SettingsWindow.js b/src/containers/settings/SettingsWindow.js
index 6d9e0ee77..663b9e2e4 100644
--- a/src/containers/settings/SettingsWindow.js
+++ b/src/containers/settings/SettingsWindow.js
@@ -7,6 +7,7 @@ import ServicesStore from '../../stores/ServicesStore';
7import Layout from '../../components/settings/SettingsLayout'; 7import Layout from '../../components/settings/SettingsLayout';
8import Navigation from '../../components/settings/navigation/SettingsNavigation'; 8import Navigation from '../../components/settings/navigation/SettingsNavigation';
9import ErrorBoundary from '../../components/util/ErrorBoundary'; 9import ErrorBoundary from '../../components/util/ErrorBoundary';
10import { workspaceStore } from '../../features/workspaces';
10 11
11export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { 12export default @inject('stores', 'actions') @observer class SettingsContainer extends Component {
12 render() { 13 render() {
@@ -16,6 +17,7 @@ export default @inject('stores', 'actions') @observer class SettingsContainer ex
16 const navigation = ( 17 const navigation = (
17 <Navigation 18 <Navigation
18 serviceCount={stores.services.all.length} 19 serviceCount={stores.services.all.length}
20 workspaceCount={workspaceStore.workspaces.length}
19 /> 21 />
20 ); 22 );
21 23
diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js
new file mode 100644
index 000000000..c69d5ad08
--- /dev/null
+++ b/src/containers/settings/TeamScreen.js
@@ -0,0 +1,57 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react';
4
5import UserStore from '../../stores/UserStore';
6import AppStore from '../../stores/AppStore';
7
8import TeamDashboard from '../../components/settings/team/TeamDashboard';
9import ErrorBoundary from '../../components/util/ErrorBoundary';
10import { WEBSITE } from '../../environment';
11
12export default @inject('stores', 'actions') @observer class TeamScreen extends Component {
13 handleWebsiteLink(route) {
14 const { actions, stores } = this.props;
15
16 const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`;
17 console.log(url);
18
19 actions.app.openExternalUrl({ url });
20 }
21
22 render() {
23 const { user } = this.props.stores;
24
25 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
26
27 return (
28 <ErrorBoundary>
29 <TeamDashboard
30 isLoading={isLoadingUserInfo}
31 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError}
32 retryUserInfoRequest={() => this.reloadData()}
33 openTeamManagement={() => this.handleWebsiteLink('/user/team')}
34 />
35 </ErrorBoundary>
36 );
37 }
38}
39
40TeamScreen.wrappedComponent.propTypes = {
41 stores: PropTypes.shape({
42 user: PropTypes.instanceOf(UserStore).isRequired,
43 app: PropTypes.instanceOf(AppStore).isRequired,
44 }).isRequired,
45 actions: PropTypes.shape({
46 payment: PropTypes.shape({
47 createDashboardUrl: PropTypes.func.isRequired,
48 }).isRequired,
49 app: PropTypes.shape({
50 openExternalUrl: PropTypes.func.isRequired,
51 }).isRequired,
52 user: PropTypes.shape({
53 update: PropTypes.func.isRequired,
54 delete: PropTypes.func.isRequired,
55 }).isRequired,
56 }).isRequired,
57};