aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/AccountScreen.js
diff options
context:
space:
mode:
authorLibravatar Amine Mouafik <amine@mouafik.fr>2019-12-18 15:49:26 +0100
committerLibravatar Amine Mouafik <amine@mouafik.fr>2019-12-18 15:49:26 +0100
commitfffa3875f888aef2109dc7d91dc681069786fc0b (patch)
treec96b67b275d8ebae6f793a0455a75ae8edc87d3c /src/containers/settings/AccountScreen.js
parentUpdate Electron and Sentry for latest fixes (diff)
downloadferdium-app-fffa3875f888aef2109dc7d91dc681069786fc0b.tar.gz
ferdium-app-fffa3875f888aef2109dc7d91dc681069786fc0b.tar.zst
ferdium-app-fffa3875f888aef2109dc7d91dc681069786fc0b.zip
Better handling of account settings (if using without account)
Diffstat (limited to 'src/containers/settings/AccountScreen.js')
-rw-r--r--src/containers/settings/AccountScreen.js37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js
index 93ab44690..12c912bac 100644
--- a/src/containers/settings/AccountScreen.js
+++ b/src/containers/settings/AccountScreen.js
@@ -6,12 +6,16 @@ import PaymentStore from '../../stores/PaymentStore';
6import UserStore from '../../stores/UserStore'; 6import UserStore from '../../stores/UserStore';
7import AppStore from '../../stores/AppStore'; 7import AppStore from '../../stores/AppStore';
8import FeaturesStore from '../../stores/FeaturesStore'; 8import FeaturesStore from '../../stores/FeaturesStore';
9import SettingsStore from '../../stores/SettingsStore';
9 10
10import AccountDashboard from '../../components/settings/account/AccountDashboard'; 11import AccountDashboard from '../../components/settings/account/AccountDashboard';
11import ErrorBoundary from '../../components/util/ErrorBoundary'; 12import ErrorBoundary from '../../components/util/ErrorBoundary';
12import { WEBSITE } from '../../environment'; 13import { WEBSITE } from '../../environment';
13 14
14export default @inject('stores', 'actions') @observer class AccountScreen extends Component { 15export default
16@inject('stores', 'actions')
17@observer
18class AccountScreen extends Component {
15 onCloseWindow() { 19 onCloseWindow() {
16 const { user, features } = this.props.stores; 20 const { user, features } = this.props.stores;
17 user.getUserInfoRequest.invalidate({ immediately: true }); 21 user.getUserInfoRequest.invalidate({ immediately: true });
@@ -32,7 +36,9 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend
32 36
33 let url; 37 let url;
34 if (api === 'https://api.franzinfra.com') { 38 if (api === 'https://api.franzinfra.com') {
35 url = stores.user.getAuthURL(`${WEBSITE}${route}?utm_source=app&utm_medium=account_dashboard`); 39 url = stores.user.getAuthURL(
40 `${WEBSITE}${route}?utm_source=app&utm_medium=account_dashboard`,
41 );
36 } else { 42 } else {
37 url = `${api}${route}`; 43 url = `${api}${route}`;
38 } 44 }
@@ -41,11 +47,13 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend
41 } 47 }
42 48
43 render() { 49 render() {
44 const { user, payment, features } = this.props.stores;
45 const { 50 const {
46 user: userActions, 51 user,
47 payment: paymentActions, 52 payment,
48 } = this.props.actions; 53 features,
54 settings,
55 } = this.props.stores;
56 const { user: userActions, payment: paymentActions } = this.props.actions;
49 57
50 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; 58 const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
51 const isLoadingPlans = payment.plansRequest.isExecuting; 59 const isLoadingPlans = payment.plansRequest.isExecuting;
@@ -55,19 +63,29 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend
55 return ( 63 return (
56 <ErrorBoundary> 64 <ErrorBoundary>
57 <AccountDashboard 65 <AccountDashboard
66 server={settings.all.app.server}
58 user={user.data} 67 user={user.data}
59 isPremiumOverrideUser={user.isPremiumOverride} 68 isPremiumOverrideUser={user.isPremiumOverride}
60 isProUser={user.isPro} 69 isProUser={user.isPro}
61 isLoading={isLoadingUserInfo} 70 isLoading={isLoadingUserInfo}
62 isLoadingPlans={isLoadingPlans} 71 isLoadingPlans={isLoadingPlans}
63 userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} 72 userInfoRequestFailed={
73 user.getUserInfoRequest.wasExecuted
74 && user.getUserInfoRequest.isError
75 }
64 retryUserInfoRequest={() => this.reloadData()} 76 retryUserInfoRequest={() => this.reloadData()}
65 onCloseSubscriptionWindow={() => this.onCloseWindow()} 77 onCloseSubscriptionWindow={() => this.onCloseWindow()}
66 deleteAccount={userActions.delete} 78 deleteAccount={userActions.delete}
67 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} 79 isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting}
68 isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} 80 isDeleteAccountSuccessful={
81 user.deleteAccountRequest.wasExecuted
82 && !user.deleteAccountRequest.isError
83 }
69 openEditAccount={() => this.handleWebsiteLink('/user/profile')} 84 openEditAccount={() => this.handleWebsiteLink('/user/profile')}
70 upgradeToPro={() => upgradeAccount({ planId: features.features.pricingConfig.plans.pro.yearly.id })} 85 upgradeToPro={() => upgradeAccount({
86 planId: features.features.pricingConfig.plans.pro.yearly.id,
87 })
88 }
71 openBilling={() => this.handleWebsiteLink('/user/billing')} 89 openBilling={() => this.handleWebsiteLink('/user/billing')}
72 openInvoices={() => this.handleWebsiteLink('/user/invoices')} 90 openInvoices={() => this.handleWebsiteLink('/user/invoices')}
73 /> 91 />
@@ -81,6 +99,7 @@ AccountScreen.wrappedComponent.propTypes = {
81 user: PropTypes.instanceOf(UserStore).isRequired, 99 user: PropTypes.instanceOf(UserStore).isRequired,
82 features: PropTypes.instanceOf(FeaturesStore).isRequired, 100 features: PropTypes.instanceOf(FeaturesStore).isRequired,
83 payment: PropTypes.instanceOf(PaymentStore).isRequired, 101 payment: PropTypes.instanceOf(PaymentStore).isRequired,
102 settings: PropTypes.instanceOf(SettingsStore).isRequired,
84 app: PropTypes.instanceOf(AppStore).isRequired, 103 app: PropTypes.instanceOf(AppStore).isRequired,
85 }).isRequired, 104 }).isRequired,
86 actions: PropTypes.shape({ 105 actions: PropTypes.shape({