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