From 24d0223fee38c36ec19d9c662579dba7d787f8b4 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 5 Sep 2019 09:49:25 +0200 Subject: polishing --- .../workspaces/components/WorkspacesDashboard.js | 167 +++++++++++---------- .../workspaces/containers/WorkspacesScreen.js | 13 +- 2 files changed, 98 insertions(+), 82 deletions(-) (limited to 'src/features/workspaces') 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'; import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; import { defineMessages, intlShape } from 'react-intl'; import injectSheet from 'react-jss'; -import { Infobox } from '@meetfranz/ui'; +import { Infobox, Badge } from '@meetfranz/ui'; import Loader from '../../../components/ui/Loader'; import WorkspaceItem from './WorkspaceItem'; @@ -11,9 +11,9 @@ import CreateWorkspaceForm from './CreateWorkspaceForm'; import Request from '../../../stores/lib/Request'; import Appear from '../../../components/ui/effects/Appear'; import { workspaceStore } from '../index'; -import PremiumFeatureContainer from '../../../components/ui/PremiumFeatureContainer'; import UIStore from '../../../stores/UIStore'; -import ActivateTrialButton from '../../../components/ui/ActivateTrialButton'; +import globalMessages from '../../../i18n/globalMessages'; +import UpgradeButton from '../../../components/ui/UpgradeButton'; const messages = defineMessages({ headline: { @@ -64,23 +64,24 @@ const styles = theme => ({ height: 'auto', }, premiumAnnouncement: { - padding: 20, - // backgroundColor: '#3498db', - marginLeft: -20, - marginBottom: 40, - paddingBottom: 40, height: 'auto', + }, + premiumAnnouncementContainer: { display: 'flex', - borderBottom: [1, 'solid', theme.inputBackground], + }, + announcementHeadline: { + marginBottom: 0, }, teaserImage: { - width: 200, - height: '100%', - float: 'left', - margin: [-8, 0, 0, -20], + width: 250, + margin: [-8, 0, 0, 20], + alignSelf: 'center', }, upgradeCTA: { - marginTop: 20, + margin: [40, 'auto'], + }, + proRequired: { + margin: [10, 0, 40], }, }); @@ -95,6 +96,8 @@ class WorkspacesDashboard extends Component { onCreateWorkspaceSubmit: PropTypes.func.isRequired, onWorkspaceClick: PropTypes.func.isRequired, workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, + isPersonalUser: PropTypes.bool.isRequired, + onUpgradeAccount: PropTypes.func.isRequired, }; static contextTypes = { @@ -152,76 +155,80 @@ class WorkspacesDashboard extends Component { {workspaceStore.isPremiumUpgradeRequired && (
- -
-

{intl.formatMessage(messages.workspaceFeatureHeadline)}

-

{intl.formatMessage(messages.workspaceFeatureInfo)}

- + +

{intl.formatMessage(messages.workspaceFeatureHeadline)}

+ {intl.formatMessage(globalMessages.proRequired)} +
+
+

{intl.formatMessage(messages.workspaceFeatureInfo)}

+ +
+
)} - workspaceStore.isPremiumUpgradeRequired} - gaEventInfo={{ category: 'User', event: 'upgrade', label: 'workspaces' }} - > - {/* ===== Create workspace form ===== */} -
- -
- {getUserWorkspacesRequest.isExecuting ? ( - - ) : ( - - {/* ===== Workspace could not be loaded error ===== */} - {getUserWorkspacesRequest.error ? ( - - {intl.formatMessage(messages.workspacesRequestFailed)} - - ) : ( - - {workspaces.length === 0 ? ( -
- {/* ===== Workspaces empty state ===== */} -

- - - - {intl.formatMessage(messages.noServicesAdded)} -

-
- ) : ( - - {/* ===== Workspaces list ===== */} - - {workspaces.map(workspace => ( - onWorkspaceClick(w)} - /> - ))} - -
- )} -
- )} -
- )} -
+ {!workspaceStore.isPremiumUpgradeRequired && ( + <> + {/* ===== Create workspace form ===== */} +
+ +
+ {getUserWorkspacesRequest.isExecuting ? ( + + ) : ( + + {/* ===== Workspace could not be loaded error ===== */} + {getUserWorkspacesRequest.error ? ( + + {intl.formatMessage(messages.workspacesRequestFailed)} + + ) : ( + + {workspaces.length === 0 ? ( +
+ {/* ===== Workspaces empty state ===== */} +

+ + + + {intl.formatMessage(messages.noServicesAdded)} +

+
+ ) : ( + + {/* ===== Workspaces list ===== */} + + {workspaces.map(workspace => ( + onWorkspaceClick(w)} + /> + ))} + +
+ )} +
+ )} +
+ )} + + )}
); diff --git a/src/features/workspaces/containers/WorkspacesScreen.js b/src/features/workspaces/containers/WorkspacesScreen.js index 2ab565fa1..5fbb0c31d 100644 --- a/src/features/workspaces/containers/WorkspacesScreen.js +++ b/src/features/workspaces/containers/WorkspacesScreen.js @@ -10,29 +10,38 @@ import { getUserWorkspacesRequest, updateWorkspaceRequest, } from '../api'; +import UserStore from '../../../stores/UserStore'; -@inject('actions') @observer +@inject('stores', 'actions') @observer class WorkspacesScreen extends Component { static propTypes = { + stores: PropTypes.shape({ + user: PropTypes.instanceOf(UserStore), + }).isRequired, actions: PropTypes.shape({ workspace: PropTypes.shape({ edit: PropTypes.func.isRequired, }), + ui: PropTypes.shape({ + openSettings: PropTypes.func.isRequired, + }), }).isRequired, }; render() { - const { actions } = this.props; + const { stores, actions } = this.props; return ( actions.workspaces.create(data)} onWorkspaceClick={w => actions.workspaces.edit({ workspace: w })} + onUpgradeAccount={() => actions.ui.openSettings({ path: 'user' })} /> ); -- cgit v1.2.3-54-g00ecf