diff options
author | 2019-04-04 16:16:13 +0200 | |
---|---|---|
committer | 2019-04-04 16:16:13 +0200 | |
commit | afed692390713ceebd8c6610d1d93a6a4ac89076 (patch) | |
tree | 58a7422f0a3c9a079a6274756975a1820d8011a7 /src/features | |
parent | show workspaces intro in drawer when user has none yet (diff) | |
download | ferdium-app-afed692390713ceebd8c6610d1d93a6a4ac89076.tar.gz ferdium-app-afed692390713ceebd8c6610d1d93a6a4ac89076.tar.zst ferdium-app-afed692390713ceebd8c6610d1d93a6a4ac89076.zip |
fix issues for users that have workspace but downgraded to free
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawer.js | 41 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspacesDashboard.js | 62 |
2 files changed, 61 insertions, 42 deletions
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index 3602da792..baf59a1fb 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js | |||
@@ -33,6 +33,10 @@ const messages = defineMessages({ | |||
33 | id: 'workspaceDrawer.premiumCtaButtonLabel', | 33 | id: 'workspaceDrawer.premiumCtaButtonLabel', |
34 | defaultMessage: '!!!Create your first workspace', | 34 | defaultMessage: '!!!Create your first workspace', |
35 | }, | 35 | }, |
36 | reactivatePremiumAccount: { | ||
37 | id: 'workspaceDrawer.reactivatePremiumAccountLabel', | ||
38 | defaultMessage: '!!!Reactivate premium account', | ||
39 | }, | ||
36 | }); | 40 | }); |
37 | 41 | ||
38 | const styles = theme => ({ | 42 | const styles = theme => ({ |
@@ -77,6 +81,7 @@ class WorkspaceDrawer extends Component { | |||
77 | static propTypes = { | 81 | static propTypes = { |
78 | classes: PropTypes.object.isRequired, | 82 | classes: PropTypes.object.isRequired, |
79 | getServicesForWorkspace: PropTypes.func.isRequired, | 83 | getServicesForWorkspace: PropTypes.func.isRequired, |
84 | onUpgradeAccountClick: PropTypes.func.isRequired, | ||
80 | }; | 85 | }; |
81 | 86 | ||
82 | static contextTypes = { | 87 | static contextTypes = { |
@@ -91,6 +96,7 @@ class WorkspaceDrawer extends Component { | |||
91 | const { | 96 | const { |
92 | classes, | 97 | classes, |
93 | getServicesForWorkspace, | 98 | getServicesForWorkspace, |
99 | onUpgradeAccountClick, | ||
94 | } = this.props; | 100 | } = this.props; |
95 | const { intl } = this.context; | 101 | const { intl } = this.context; |
96 | const { | 102 | const { |
@@ -119,19 +125,32 @@ class WorkspaceDrawer extends Component { | |||
119 | /> | 125 | /> |
120 | </span> | 126 | </span> |
121 | </H1> | 127 | </H1> |
122 | {!workspaceStore.userHasWorkspaces ? ( | 128 | {workspaceStore.isPremiumUpgradeRequired ? ( |
123 | <div className={classes.premiumAnnouncement}> | 129 | <div className={classes.premiumAnnouncement}> |
124 | <FormattedHTMLMessage {...messages.workspaceFeatureInfo} /> | 130 | <FormattedHTMLMessage {...messages.workspaceFeatureInfo} /> |
125 | <Button | 131 | {workspaceStore.userHasWorkspaces ? ( |
126 | className={classes.premiumCtaButton} | 132 | <Button |
127 | buttonType="primary" | 133 | className={classes.premiumCtaButton} |
128 | label={intl.formatMessage(messages.premiumCtaButtonLabel)} | 134 | buttonType="primary" |
129 | icon="mdiPlusBox" | 135 | label={intl.formatMessage(messages.reactivatePremiumAccount)} |
130 | onClick={() => { | 136 | icon="mdiStar" |
131 | workspaceActions.openWorkspaceSettings(); | 137 | onClick={() => { |
132 | gaEvent(GA_CATEGORY_WORKSPACES, 'add', 'drawerPremiumCta'); | 138 | onUpgradeAccountClick(); |
133 | }} | 139 | gaEvent('User', 'upgrade', 'workspaceDrawer'); |
134 | /> | 140 | }} |
141 | /> | ||
142 | ) : ( | ||
143 | <Button | ||
144 | className={classes.premiumCtaButton} | ||
145 | buttonType="primary" | ||
146 | label={intl.formatMessage(messages.premiumCtaButtonLabel)} | ||
147 | icon="mdiPlusBox" | ||
148 | onClick={() => { | ||
149 | workspaceActions.openWorkspaceSettings(); | ||
150 | gaEvent(GA_CATEGORY_WORKSPACES, 'add', 'drawerPremiumCta'); | ||
151 | }} | ||
152 | /> | ||
153 | )} | ||
135 | </div> | 154 | </div> |
136 | ) : ( | 155 | ) : ( |
137 | <div className={classes.workspaces}> | 156 | <div className={classes.workspaces}> |
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index a0a34c778..18813e267 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -147,38 +147,38 @@ class WorkspacesDashboard extends Component { | |||
147 | onSubmit={onCreateWorkspaceSubmit} | 147 | onSubmit={onCreateWorkspaceSubmit} |
148 | /> | 148 | /> |
149 | </div> | 149 | </div> |
150 | {getUserWorkspacesRequest.isExecuting ? ( | ||
151 | <Loader /> | ||
152 | ) : ( | ||
153 | <Fragment> | ||
154 | {/* ===== Workspace could not be loaded error ===== */} | ||
155 | {getUserWorkspacesRequest.error ? ( | ||
156 | <Infobox | ||
157 | icon="alert" | ||
158 | type="danger" | ||
159 | ctaLabel={intl.formatMessage(messages.tryReloadWorkspaces)} | ||
160 | ctaLoading={getUserWorkspacesRequest.isExecuting} | ||
161 | ctaOnClick={getUserWorkspacesRequest.retry} | ||
162 | > | ||
163 | {intl.formatMessage(messages.workspacesRequestFailed)} | ||
164 | </Infobox> | ||
165 | ) : ( | ||
166 | <table className="workspace-table"> | ||
167 | {/* ===== Workspaces list ===== */} | ||
168 | <tbody> | ||
169 | {workspaces.map(workspace => ( | ||
170 | <WorkspaceItem | ||
171 | key={workspace.id} | ||
172 | workspace={workspace} | ||
173 | onItemClick={w => onWorkspaceClick(w)} | ||
174 | /> | ||
175 | ))} | ||
176 | </tbody> | ||
177 | </table> | ||
178 | )} | ||
179 | </Fragment> | ||
180 | )} | ||
150 | </PremiumFeatureContainer> | 181 | </PremiumFeatureContainer> |
151 | {getUserWorkspacesRequest.isExecuting ? ( | ||
152 | <Loader /> | ||
153 | ) : ( | ||
154 | <Fragment> | ||
155 | {/* ===== Workspace could not be loaded error ===== */} | ||
156 | {getUserWorkspacesRequest.error ? ( | ||
157 | <Infobox | ||
158 | icon="alert" | ||
159 | type="danger" | ||
160 | ctaLabel={intl.formatMessage(messages.tryReloadWorkspaces)} | ||
161 | ctaLoading={getUserWorkspacesRequest.isExecuting} | ||
162 | ctaOnClick={getUserWorkspacesRequest.retry} | ||
163 | > | ||
164 | {intl.formatMessage(messages.workspacesRequestFailed)} | ||
165 | </Infobox> | ||
166 | ) : ( | ||
167 | <table className="workspace-table"> | ||
168 | {/* ===== Workspaces list ===== */} | ||
169 | <tbody> | ||
170 | {workspaces.map(workspace => ( | ||
171 | <WorkspaceItem | ||
172 | key={workspace.id} | ||
173 | workspace={workspace} | ||
174 | onItemClick={w => onWorkspaceClick(w)} | ||
175 | /> | ||
176 | ))} | ||
177 | </tbody> | ||
178 | </table> | ||
179 | )} | ||
180 | </Fragment> | ||
181 | )} | ||
182 | </div> | 182 | </div> |
183 | </div> | 183 | </div> |
184 | ); | 184 | ); |