diff options
Diffstat (limited to 'src/containers/settings/TeamScreen.js')
-rw-r--r-- | src/containers/settings/TeamScreen.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js new file mode 100644 index 000000000..30b0895e3 --- /dev/null +++ b/src/containers/settings/TeamScreen.js | |||
@@ -0,0 +1,58 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | ||
4 | |||
5 | import UserStore from '../../stores/UserStore'; | ||
6 | import AppStore from '../../stores/AppStore'; | ||
7 | |||
8 | import TeamDashboard from '../../components/settings/team/TeamDashboard'; | ||
9 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
10 | import { WEBSITE } from '../../environment'; | ||
11 | |||
12 | export default @inject('stores', 'actions') @observer class TeamScreen extends Component { | ||
13 | handleWebsiteLink(route) { | ||
14 | const { actions, stores } = this.props; | ||
15 | |||
16 | const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; | ||
17 | console.log(url); | ||
18 | |||
19 | actions.app.openExternalUrl({ url }); | ||
20 | } | ||
21 | |||
22 | render() { | ||
23 | const { user } = this.props.stores; | ||
24 | |||
25 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; | ||
26 | |||
27 | return ( | ||
28 | <ErrorBoundary> | ||
29 | <TeamDashboard | ||
30 | user={user.data} | ||
31 | isLoading={isLoadingUserInfo} | ||
32 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} | ||
33 | retryUserInfoRequest={() => this.reloadData()} | ||
34 | openTeamManagement={() => this.handleWebsiteLink('/user/team')} | ||
35 | /> | ||
36 | </ErrorBoundary> | ||
37 | ); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | TeamScreen.wrappedComponent.propTypes = { | ||
42 | stores: PropTypes.shape({ | ||
43 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
44 | app: PropTypes.instanceOf(AppStore).isRequired, | ||
45 | }).isRequired, | ||
46 | actions: PropTypes.shape({ | ||
47 | payment: PropTypes.shape({ | ||
48 | createDashboardUrl: PropTypes.func.isRequired, | ||
49 | }).isRequired, | ||
50 | app: PropTypes.shape({ | ||
51 | openExternalUrl: PropTypes.func.isRequired, | ||
52 | }).isRequired, | ||
53 | user: PropTypes.shape({ | ||
54 | update: PropTypes.func.isRequired, | ||
55 | delete: PropTypes.func.isRequired, | ||
56 | }).isRequired, | ||
57 | }).isRequired, | ||
58 | }; | ||