forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (31 loc) · 1.22 KB
/
index.js
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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getTeams} from 'mattermost-redux/actions/teams';
import {getProfilesInTeam} from 'mattermost-redux/actions/users';
import {getTeamsList} from 'mattermost-redux/selectors/entities/teams';
import BrowserStore from 'stores/browser_store.jsx';
import {getCurrentLocale} from 'selectors/i18n';
import TeamAnalytics from './team_analytics.jsx';
const LAST_ANALYTICS_TEAM = 'last_analytics_team';
function mapStateToProps(state) {
const teams = getTeamsList(state);
const teamId = BrowserStore.getGlobalItem(LAST_ANALYTICS_TEAM, null);
const initialTeam = state.entities.teams.teams[teamId] || (teams.length > 0 ? teams[0] : null);
return {
initialTeam,
locale: getCurrentLocale(state),
teams,
stats: state.entities.admin.teamAnalytics,
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getTeams,
getProfilesInTeam,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(TeamAnalytics);