30 lines
827 B
JavaScript
30 lines
827 B
JavaScript
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {connect} from 'react-redux';
|
|
|
|
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
|
|
|
|
import {getTheme} from 'app/selectors/preferences';
|
|
import Config from 'assets/config.json';
|
|
|
|
import Root from './root';
|
|
|
|
function mapStateToProps(state, ownProps) {
|
|
const users = state.entities.users;
|
|
const {currentUserId} = users;
|
|
|
|
let locale = Config.DefaultLocale;
|
|
if (currentUserId && users.profiles[currentUserId]) {
|
|
locale = users.profiles[currentUserId].locale;
|
|
}
|
|
|
|
return {
|
|
...ownProps,
|
|
theme: getTheme(state),
|
|
currentChannelId: getCurrentChannelId(state),
|
|
locale
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps)(Root);
|