blob: 928262a5937dbeb7eac9f6098ed06f83057adb2a (
plain) (
blame)
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
58
59
|
import { 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 SettingsStore from '../../stores/SettingsStore';
import TeamDashboard from '../../components/settings/team/TeamDashboard';
import ErrorBoundary from '../../components/util/ErrorBoundary';
import { DEV_API_FRANZ_WEBSITE } from '../../config';
@inject('stores', 'actions')
@observer
class TeamScreen extends Component {
handleWebsiteLink(route) {
const { actions, stores } = this.props;
const url = `${DEV_API_FRANZ_WEBSITE}/${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`;
actions.app.openExternalUrl({ url });
}
render() {
const { user, settings } = this.props.stores;
const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
const { server } = settings.app;
return (
<ErrorBoundary>
<TeamDashboard
isLoading={isLoadingUserInfo}
userInfoRequestFailed={
user.getUserInfoRequest.wasExecuted &&
user.getUserInfoRequest.isError
}
retryUserInfoRequest={() => this.reloadData()}
openTeamManagement={() => this.handleWebsiteLink('/user/team')}
server={server}
/>
</ErrorBoundary>
);
}
}
TeamScreen.wrappedComponent.propTypes = {
stores: PropTypes.shape({
user: PropTypes.instanceOf(UserStore).isRequired,
app: PropTypes.instanceOf(AppStore).isRequired,
settings: PropTypes.instanceOf(SettingsStore).isRequired,
}).isRequired,
actions: PropTypes.shape({
app: PropTypes.instanceOf(AppStore).isRequired,
user: PropTypes.instanceOf(UserStore).isRequired,
}).isRequired,
};
export default TeamScreen;
|