diff --git a/js/components/EditableStringList.js b/js/components/EditableStringList.js index 08bf284..2f0e84f 100644 --- a/js/components/EditableStringList.js +++ b/js/components/EditableStringList.js @@ -11,41 +11,42 @@ export default class EditableStringList extends React.Component { constructor(props) { super(props); this.state = { - entries: props.entries + teams: props.teams, + groups: props.groups }; this.add = this.add.bind(this); this.remove = this.remove.bind(this); } add(text) { - if (text === '' || this.state.entries.includes(text)) { + if (text === '' || this.props.teams.includes(text)) { return false; } - this.state.entries.push(text); - this.setState({entries: this.state.entries}); - this.props.onChange(this.state.entries); + this.props.teams.push(text); + this.setState({teams: this.state.teams}); + this.props.onTeamsChange(this.state.teams); return true; } remove(text) { - let tmp = this.state.entries.filter(item => item !== text); - this.setState({entries: tmp}); - this.props.onChange(tmp); + let tmp = this.state.teams.filter(item => item !== text); + this.setState({teams: tmp}); + this.props.onTeamsChange(tmp); } render() { - if ((typeof this.state.entries !== 'undefined') && this.state.entries.length > 0) { + if ((typeof this.state.teams !== 'undefined') && this.state.teams.length > 0) { return (
- {this.state.entries.map((text) => )} + {this.state.teams.map((text) => )}
); } else { return (
- {this.props.placeholder} + {this.props.teamPlaceholder}
); } diff --git a/pages/create.js b/pages/create.js index 2d69b01..5c7f6fc 100644 --- a/pages/create.js +++ b/pages/create.js @@ -109,7 +109,8 @@ class CreateTournamentForm extends React.Component { groupSize: 4, groupAdvance: 1, - teams: [] + teams: [], + groups: [] }; this.handleGroupPhaseEnabledInput = this.handleGroupPhaseEnabledInput.bind(this); this.teamListUpdate = this.teamListUpdate.bind(this); @@ -152,8 +153,17 @@ class CreateTournamentForm extends React.Component {

Teams

- + ); @@ -163,6 +173,10 @@ class CreateTournamentForm extends React.Component { this.setState({teams: list}); } + groupListUpdate(list) { + this.setState({groups: list}); + } + handleGroupSizeInput(input) { let newSize = input.target.value; if(newSize <= this.state.groupAdvance) {