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