From fffa3875f888aef2109dc7d91dc681069786fc0b Mon Sep 17 00:00:00 2001 From: Amine Mouafik Date: Wed, 18 Dec 2019 15:49:26 +0100 Subject: Better handling of account settings (if using without account) --- src/containers/settings/AccountScreen.js | 37 ++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/containers/settings/AccountScreen.js') 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'; import UserStore from '../../stores/UserStore'; import AppStore from '../../stores/AppStore'; import FeaturesStore from '../../stores/FeaturesStore'; +import SettingsStore from '../../stores/SettingsStore'; import AccountDashboard from '../../components/settings/account/AccountDashboard'; import ErrorBoundary from '../../components/util/ErrorBoundary'; import { WEBSITE } from '../../environment'; -export default @inject('stores', 'actions') @observer class AccountScreen extends Component { +export default +@inject('stores', 'actions') +@observer +class AccountScreen extends Component { onCloseWindow() { const { user, features } = this.props.stores; user.getUserInfoRequest.invalidate({ immediately: true }); @@ -32,7 +36,9 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend let url; if (api === 'https://api.franzinfra.com') { - url = stores.user.getAuthURL(`${WEBSITE}${route}?utm_source=app&utm_medium=account_dashboard`); + url = stores.user.getAuthURL( + `${WEBSITE}${route}?utm_source=app&utm_medium=account_dashboard`, + ); } else { url = `${api}${route}`; } @@ -41,11 +47,13 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend } render() { - const { user, payment, features } = this.props.stores; const { - user: userActions, - payment: paymentActions, - } = this.props.actions; + user, + payment, + features, + settings, + } = this.props.stores; + const { user: userActions, payment: paymentActions } = this.props.actions; const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; const isLoadingPlans = payment.plansRequest.isExecuting; @@ -55,19 +63,29 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend return ( this.reloadData()} onCloseSubscriptionWindow={() => this.onCloseWindow()} deleteAccount={userActions.delete} isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} - isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} + isDeleteAccountSuccessful={ + user.deleteAccountRequest.wasExecuted + && !user.deleteAccountRequest.isError + } openEditAccount={() => this.handleWebsiteLink('/user/profile')} - upgradeToPro={() => upgradeAccount({ planId: features.features.pricingConfig.plans.pro.yearly.id })} + upgradeToPro={() => upgradeAccount({ + planId: features.features.pricingConfig.plans.pro.yearly.id, + }) + } openBilling={() => this.handleWebsiteLink('/user/billing')} openInvoices={() => this.handleWebsiteLink('/user/invoices')} /> @@ -81,6 +99,7 @@ AccountScreen.wrappedComponent.propTypes = { user: PropTypes.instanceOf(UserStore).isRequired, features: PropTypes.instanceOf(FeaturesStore).isRequired, payment: PropTypes.instanceOf(PaymentStore).isRequired, + settings: PropTypes.instanceOf(SettingsStore).isRequired, app: PropTypes.instanceOf(AppStore).isRequired, }).isRequired, actions: PropTypes.shape({ -- cgit v1.2.3-70-g09d2