blob: 7108ce7717ae3c25ec85391dbcb05905157a6fe4 (
plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import TeamStore from 'stores/team_store.jsx';
import ImportTab from './team_import_tab.jsx';
import GeneralTab from './team_general_tab.jsx';
import * as Utils from 'utils/utils.jsx';
import PropTypes from 'prop-types';
import React from 'react';
export default class TeamSettings extends React.Component {
constructor(props) {
super(props);
this.onChange = this.onChange.bind(this);
this.state = {team: TeamStore.getCurrent()};
}
componentDidMount() {
TeamStore.addChangeListener(this.onChange);
}
componentWillUnmount() {
TeamStore.removeChangeListener(this.onChange);
}
onChange() {
var team = TeamStore.getCurrent();
if (!Utils.areObjectsEqual(this.state.team, team)) {
this.setState({team});
}
}
render() {
if (!this.state.team) {
return null;
}
var result;
switch (this.props.activeTab) {
case 'general':
result = (
<div>
<GeneralTab
team={this.state.team}
activeSection={this.props.activeSection}
updateSection={this.props.updateSection}
/>
</div>
);
break;
case 'import':
result = (
<div>
<ImportTab
team={this.state.team}
activeSection={this.props.activeSection}
updateSection={this.props.updateSection}
/>
</div>
);
break;
default:
result = (
<div/>
);
break;
}
return result;
}
}
TeamSettings.defaultProps = {
activeTab: '',
activeSection: ''
};
TeamSettings.propTypes = {
activeTab: PropTypes.string.isRequired,
activeSection: PropTypes.string.isRequired,
updateSection: PropTypes.func.isRequired
};
|