2015-06-18 10:40:46 -04:00
|
|
|
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
|
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
var TeamStore = require('../stores/team_store.jsx');
|
2015-08-18 09:43:22 -04:00
|
|
|
var ImportTab = require('./team_import_tab.jsx');
|
|
|
|
|
var FeatureTab = require('./team_feature_tab.jsx');
|
2015-08-21 16:36:53 -07:00
|
|
|
var GeneralTab = require('./team_general_tab.jsx');
|
2015-09-02 08:40:25 -04:00
|
|
|
var Utils = require('../utils/utils.jsx');
|
2015-06-18 10:40:46 -04:00
|
|
|
|
2015-09-01 11:39:28 -04:00
|
|
|
export default class TeamSettings extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.onChange = this.onChange.bind(this);
|
|
|
|
|
|
|
|
|
|
this.state = {team: TeamStore.getCurrent()};
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
2015-08-18 09:43:22 -04:00
|
|
|
TeamStore.addChangeListener(this.onChange);
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
componentWillUnmount() {
|
2015-08-18 09:43:22 -04:00
|
|
|
TeamStore.removeChangeListener(this.onChange);
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
onChange() {
|
2015-08-18 09:43:22 -04:00
|
|
|
var team = TeamStore.getCurrent();
|
2015-09-02 08:40:25 -04:00
|
|
|
if (!Utils.areStatesEqual(this.state.team, team)) {
|
2015-08-18 09:43:22 -04:00
|
|
|
this.setState({team: team});
|
2015-06-18 10:40:46 -04:00
|
|
|
}
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
render() {
|
2015-08-18 09:43:22 -04:00
|
|
|
var result;
|
|
|
|
|
switch (this.props.activeTab) {
|
2015-09-01 11:39:28 -04:00
|
|
|
case 'general':
|
|
|
|
|
result = (
|
|
|
|
|
<div>
|
|
|
|
|
<GeneralTab
|
|
|
|
|
team={this.state.team}
|
|
|
|
|
activeSection={this.props.activeSection}
|
|
|
|
|
updateSection={this.props.updateSection}
|
|
|
|
|
teamDisplayName={this.props.teamDisplayName}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'feature':
|
|
|
|
|
result = (
|
|
|
|
|
<div>
|
|
|
|
|
<FeatureTab
|
|
|
|
|
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;
|
2015-07-07 09:16:13 -04:00
|
|
|
}
|
2015-08-18 09:43:22 -04:00
|
|
|
return result;
|
2015-06-18 10:40:46 -04:00
|
|
|
}
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TeamSettings.defaultProps = {
|
|
|
|
|
activeTab: '',
|
|
|
|
|
activeSection: '',
|
|
|
|
|
teamDisplayName: ''
|
|
|
|
|
};
|
|
|
|
|
TeamSettings.propTypes = {
|
|
|
|
|
activeTab: React.PropTypes.string.isRequired,
|
|
|
|
|
activeSection: React.PropTypes.string.isRequired,
|
|
|
|
|
updateSection: React.PropTypes.func.isRequired,
|
|
|
|
|
teamDisplayName: React.PropTypes.string.isRequired
|
|
|
|
|
};
|