aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-04 16:16:13 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-04 16:16:13 +0200
commitafed692390713ceebd8c6610d1d93a6a4ac89076 (patch)
tree58a7422f0a3c9a079a6274756975a1820d8011a7 /src
parentshow workspaces intro in drawer when user has none yet (diff)
downloadferdium-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')
-rw-r--r--src/containers/layout/AppLayoutContainer.js1
-rw-r--r--src/features/workspaces/components/WorkspaceDrawer.js41
-rw-r--r--src/features/workspaces/components/WorkspacesDashboard.js62
-rw-r--r--src/i18n/locales/defaultMessages.json13
-rw-r--r--src/i18n/locales/en-US.json3
-rw-r--r--src/i18n/messages/src/features/workspaces/components/WorkspaceDrawer.json13
6 files changed, 90 insertions, 43 deletions
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index 4329c3097..52d4e0c27 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -90,6 +90,7 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
90 getServicesForWorkspace={workspace => ( 90 getServicesForWorkspace={workspace => (
91 workspace ? workspace.services.map(id => services.one(id).name) : services.all.map(s => s.name) 91 workspace ? workspace.services.map(id => services.one(id).name) : services.all.map(s => s.name)
92 )} 92 )}
93 onUpgradeAccountClick={() => openSettings({ path: 'user' })}
93 /> 94 />
94 ); 95 );
95 96
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
38const styles = theme => ({ 42const 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 );
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json
index 500053377..ec519bad5 100644
--- a/src/i18n/locales/defaultMessages.json
+++ b/src/i18n/locales/defaultMessages.json
@@ -3386,6 +3386,19 @@
3386 "column": 25, 3386 "column": 25,
3387 "line": 32 3387 "line": 32
3388 } 3388 }
3389 },
3390 {
3391 "defaultMessage": "!!!Reactivate your premium account!",
3392 "end": {
3393 "column": 3,
3394 "line": 39
3395 },
3396 "file": "src/features/workspaces/components/WorkspaceDrawer.js",
3397 "id": "workspaceDrawer.reactivatePremiumAccountLabel",
3398 "start": {
3399 "column": 28,
3400 "line": 36
3401 }
3389 } 3402 }
3390 ], 3403 ],
3391 "path": "src/features/workspaces/components/WorkspaceDrawer.json" 3404 "path": "src/features/workspaces/components/WorkspaceDrawer.json"
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 9770ff0d5..ed5d5e345 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -311,6 +311,7 @@
311 "workspaceDrawer.headline": "Workspaces", 311 "workspaceDrawer.headline": "Workspaces",
312 "workspaceDrawer.item.noServicesAddedYet": "No services added yet", 312 "workspaceDrawer.item.noServicesAddedYet": "No services added yet",
313 "workspaceDrawer.premiumCtaButtonLabel": "Create your first workspace", 313 "workspaceDrawer.premiumCtaButtonLabel": "Create your first workspace",
314 "workspaceDrawer.reactivatePremiumAccountLabel": "Reactivate premium account",
314 "workspaceDrawer.workspaceFeatureInfo": "<p>Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.</p><p>You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.</p>", 315 "workspaceDrawer.workspaceFeatureInfo": "<p>Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.</p><p>You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.</p>",
315 "workspaces.switchingIndicator.switchingTo": "Switching to" 316 "workspaces.switchingIndicator.switchingTo": "Switching to"
316} \ No newline at end of file 317}
diff --git a/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawer.json b/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawer.json
index acd304253..37bae262a 100644
--- a/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawer.json
+++ b/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawer.json
@@ -63,5 +63,18 @@
63 "line": 35, 63 "line": 35,
64 "column": 3 64 "column": 3
65 } 65 }
66 },
67 {
68 "id": "workspaceDrawer.reactivatePremiumAccountLabel",
69 "defaultMessage": "!!!Reactivate premium account",
70 "file": "src/features/workspaces/components/WorkspaceDrawer.js",
71 "start": {
72 "line": 36,
73 "column": 28
74 },
75 "end": {
76 "line": 39,
77 "column": 3
78 }
66 } 79 }
67] \ No newline at end of file 80] \ No newline at end of file