diff options
author | 2019-09-05 09:49:25 +0200 | |
---|---|---|
committer | 2019-09-05 09:49:25 +0200 | |
commit | 24d0223fee38c36ec19d9c662579dba7d787f8b4 (patch) | |
tree | 17a50e725cef1266506fc9ac6352c15a120cba78 /src/features/workspaces/components/WorkspacesDashboard.js | |
parent | don't warn on react/destructuring-assignment (diff) | |
download | ferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.tar.gz ferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.tar.zst ferdium-app-24d0223fee38c36ec19d9c662579dba7d787f8b4.zip |
polishing
Diffstat (limited to 'src/features/workspaces/components/WorkspacesDashboard.js')
-rw-r--r-- | src/features/workspaces/components/WorkspacesDashboard.js | 167 |
1 files changed, 87 insertions, 80 deletions
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index 059a681de..fc636dd95 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; | |||
3 | import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; | 3 | import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, intlShape } from 'react-intl'; |
5 | import injectSheet from 'react-jss'; | 5 | import injectSheet from 'react-jss'; |
6 | import { Infobox } from '@meetfranz/ui'; | 6 | import { Infobox, Badge } from '@meetfranz/ui'; |
7 | 7 | ||
8 | import Loader from '../../../components/ui/Loader'; | 8 | import Loader from '../../../components/ui/Loader'; |
9 | import WorkspaceItem from './WorkspaceItem'; | 9 | import WorkspaceItem from './WorkspaceItem'; |
@@ -11,9 +11,9 @@ import CreateWorkspaceForm from './CreateWorkspaceForm'; | |||
11 | import Request from '../../../stores/lib/Request'; | 11 | import Request from '../../../stores/lib/Request'; |
12 | import Appear from '../../../components/ui/effects/Appear'; | 12 | import Appear from '../../../components/ui/effects/Appear'; |
13 | import { workspaceStore } from '../index'; | 13 | import { workspaceStore } from '../index'; |
14 | import PremiumFeatureContainer from '../../../components/ui/PremiumFeatureContainer'; | ||
15 | import UIStore from '../../../stores/UIStore'; | 14 | import UIStore from '../../../stores/UIStore'; |
16 | import ActivateTrialButton from '../../../components/ui/ActivateTrialButton'; | 15 | import globalMessages from '../../../i18n/globalMessages'; |
16 | import UpgradeButton from '../../../components/ui/UpgradeButton'; | ||
17 | 17 | ||
18 | const messages = defineMessages({ | 18 | const messages = defineMessages({ |
19 | headline: { | 19 | headline: { |
@@ -64,23 +64,24 @@ const styles = theme => ({ | |||
64 | height: 'auto', | 64 | height: 'auto', |
65 | }, | 65 | }, |
66 | premiumAnnouncement: { | 66 | premiumAnnouncement: { |
67 | padding: 20, | ||
68 | // backgroundColor: '#3498db', | ||
69 | marginLeft: -20, | ||
70 | marginBottom: 40, | ||
71 | paddingBottom: 40, | ||
72 | height: 'auto', | 67 | height: 'auto', |
68 | }, | ||
69 | premiumAnnouncementContainer: { | ||
73 | display: 'flex', | 70 | display: 'flex', |
74 | borderBottom: [1, 'solid', theme.inputBackground], | 71 | }, |
72 | announcementHeadline: { | ||
73 | marginBottom: 0, | ||
75 | }, | 74 | }, |
76 | teaserImage: { | 75 | teaserImage: { |
77 | width: 200, | 76 | width: 250, |
78 | height: '100%', | 77 | margin: [-8, 0, 0, 20], |
79 | float: 'left', | 78 | alignSelf: 'center', |
80 | margin: [-8, 0, 0, -20], | ||
81 | }, | 79 | }, |
82 | upgradeCTA: { | 80 | upgradeCTA: { |
83 | marginTop: 20, | 81 | margin: [40, 'auto'], |
82 | }, | ||
83 | proRequired: { | ||
84 | margin: [10, 0, 40], | ||
84 | }, | 85 | }, |
85 | }); | 86 | }); |
86 | 87 | ||
@@ -95,6 +96,8 @@ class WorkspacesDashboard extends Component { | |||
95 | onCreateWorkspaceSubmit: PropTypes.func.isRequired, | 96 | onCreateWorkspaceSubmit: PropTypes.func.isRequired, |
96 | onWorkspaceClick: PropTypes.func.isRequired, | 97 | onWorkspaceClick: PropTypes.func.isRequired, |
97 | workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, | 98 | workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, |
99 | isPersonalUser: PropTypes.bool.isRequired, | ||
100 | onUpgradeAccount: PropTypes.func.isRequired, | ||
98 | }; | 101 | }; |
99 | 102 | ||
100 | static contextTypes = { | 103 | static contextTypes = { |
@@ -152,76 +155,80 @@ class WorkspacesDashboard extends Component { | |||
152 | 155 | ||
153 | {workspaceStore.isPremiumUpgradeRequired && ( | 156 | {workspaceStore.isPremiumUpgradeRequired && ( |
154 | <div className={classes.premiumAnnouncement}> | 157 | <div className={classes.premiumAnnouncement}> |
155 | <img src={`./assets/images/workspaces/teaser_${this.props.stores.ui.isDarkThemeActive ? 'dark' : 'light'}.png`} className={classes.teaserImage} alt="" /> | 158 | |
156 | <div> | 159 | <h1 className={classes.announcementHeadline}>{intl.formatMessage(messages.workspaceFeatureHeadline)}</h1> |
157 | <h2>{intl.formatMessage(messages.workspaceFeatureHeadline)}</h2> | 160 | <Badge className={classes.proRequired}>{intl.formatMessage(globalMessages.proRequired)}</Badge> |
158 | <p>{intl.formatMessage(messages.workspaceFeatureInfo)}</p> | 161 | <div className={classes.premiumAnnouncementContainer}> |
159 | <ActivateTrialButton | 162 | <div className={classes.premiumAnnouncementContent}> |
160 | className={classes.upgradeCTA} | 163 | <p>{intl.formatMessage(messages.workspaceFeatureInfo)}</p> |
161 | gaEventInfo={{ category: 'Workspaces', event: 'upgrade' }} | 164 | <UpgradeButton |
162 | short | 165 | className={classes.upgradeCTA} |
163 | /> | 166 | gaEventInfo={{ category: 'Workspaces', event: 'upgrade' }} |
167 | short | ||
168 | requiresPro | ||
169 | /> | ||
170 | </div> | ||
171 | <img src={`https://cdn.franzinfra.com/announcements/assets/workspaces_${this.props.stores.ui.isDarkThemeActive ? 'dark' : 'light'}.png`} className={classes.teaserImage} alt="" /> | ||
164 | </div> | 172 | </div> |
165 | </div> | 173 | </div> |
166 | )} | 174 | )} |
167 | 175 | ||
168 | <PremiumFeatureContainer | 176 | {!workspaceStore.isPremiumUpgradeRequired && ( |
169 | condition={() => workspaceStore.isPremiumUpgradeRequired} | 177 | <> |
170 | gaEventInfo={{ category: 'User', event: 'upgrade', label: 'workspaces' }} | 178 | {/* ===== Create workspace form ===== */} |
171 | > | 179 | <div className={classes.createForm}> |
172 | {/* ===== Create workspace form ===== */} | 180 | <CreateWorkspaceForm |
173 | <div className={classes.createForm}> | 181 | isSubmitting={createWorkspaceRequest.isExecuting} |
174 | <CreateWorkspaceForm | 182 | onSubmit={onCreateWorkspaceSubmit} |
175 | isSubmitting={createWorkspaceRequest.isExecuting} | 183 | /> |
176 | onSubmit={onCreateWorkspaceSubmit} | 184 | </div> |
177 | /> | 185 | {getUserWorkspacesRequest.isExecuting ? ( |
178 | </div> | 186 | <Loader /> |
179 | {getUserWorkspacesRequest.isExecuting ? ( | 187 | ) : ( |
180 | <Loader /> | 188 | <Fragment> |
181 | ) : ( | 189 | {/* ===== Workspace could not be loaded error ===== */} |
182 | <Fragment> | 190 | {getUserWorkspacesRequest.error ? ( |
183 | {/* ===== Workspace could not be loaded error ===== */} | 191 | <Infobox |
184 | {getUserWorkspacesRequest.error ? ( | 192 | icon="alert" |
185 | <Infobox | 193 | type="danger" |
186 | icon="alert" | 194 | ctaLabel={intl.formatMessage(messages.tryReloadWorkspaces)} |
187 | type="danger" | 195 | ctaLoading={getUserWorkspacesRequest.isExecuting} |
188 | ctaLabel={intl.formatMessage(messages.tryReloadWorkspaces)} | 196 | ctaOnClick={getUserWorkspacesRequest.retry} |
189 | ctaLoading={getUserWorkspacesRequest.isExecuting} | 197 | > |
190 | ctaOnClick={getUserWorkspacesRequest.retry} | 198 | {intl.formatMessage(messages.workspacesRequestFailed)} |
191 | > | 199 | </Infobox> |
192 | {intl.formatMessage(messages.workspacesRequestFailed)} | 200 | ) : ( |
193 | </Infobox> | 201 | <Fragment> |
194 | ) : ( | 202 | {workspaces.length === 0 ? ( |
195 | <Fragment> | 203 | <div className="align-middle settings__empty-state"> |
196 | {workspaces.length === 0 ? ( | 204 | {/* ===== Workspaces empty state ===== */} |
197 | <div className="align-middle settings__empty-state"> | 205 | <p className="settings__empty-text"> |
198 | {/* ===== Workspaces empty state ===== */} | 206 | <span className="emoji"> |
199 | <p className="settings__empty-text"> | 207 | <img src="./assets/images/emoji/sad.png" alt="" /> |
200 | <span className="emoji"> | 208 | </span> |
201 | <img src="./assets/images/emoji/sad.png" alt="" /> | 209 | {intl.formatMessage(messages.noServicesAdded)} |
202 | </span> | 210 | </p> |
203 | {intl.formatMessage(messages.noServicesAdded)} | 211 | </div> |
204 | </p> | 212 | ) : ( |
205 | </div> | 213 | <table className={classes.table}> |
206 | ) : ( | 214 | {/* ===== Workspaces list ===== */} |
207 | <table className={classes.table}> | 215 | <tbody> |
208 | {/* ===== Workspaces list ===== */} | 216 | {workspaces.map(workspace => ( |
209 | <tbody> | 217 | <WorkspaceItem |
210 | {workspaces.map(workspace => ( | 218 | key={workspace.id} |
211 | <WorkspaceItem | 219 | workspace={workspace} |
212 | key={workspace.id} | 220 | onItemClick={w => onWorkspaceClick(w)} |
213 | workspace={workspace} | 221 | /> |
214 | onItemClick={w => onWorkspaceClick(w)} | 222 | ))} |
215 | /> | 223 | </tbody> |
216 | ))} | 224 | </table> |
217 | </tbody> | 225 | )} |
218 | </table> | 226 | </Fragment> |
219 | )} | 227 | )} |
220 | </Fragment> | 228 | </Fragment> |
221 | )} | 229 | )} |
222 | </Fragment> | 230 | </> |
223 | )} | 231 | )} |
224 | </PremiumFeatureContainer> | ||
225 | </div> | 232 | </div> |
226 | </div> | 233 | </div> |
227 | ); | 234 | ); |