Create rational bounds for the group size and number of advancing teams
This commit is contained in:
parent
b0949f28d5
commit
f0aa1af2a1
|
|
@ -105,10 +105,17 @@ class CreateTournamentForm extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
groupPhaseEnabled: false,
|
groupPhaseEnabled: false,
|
||||||
|
|
||||||
|
groupSize: 4,
|
||||||
|
groupAdvance: 1,
|
||||||
|
|
||||||
teams: []
|
teams: []
|
||||||
};
|
};
|
||||||
this.handleGroupPhaseEnabledInput = this.handleGroupPhaseEnabledInput.bind(this);
|
this.handleGroupPhaseEnabledInput = this.handleGroupPhaseEnabledInput.bind(this);
|
||||||
this.teamListUpdate = this.teamListUpdate.bind(this);
|
this.teamListUpdate = this.teamListUpdate.bind(this);
|
||||||
|
|
||||||
|
this.handleGroupSizeInput = this.handleGroupSizeInput.bind(this);
|
||||||
|
this.handleGroupAdvanceInput = this.handleGroupAdvanceInput.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
@ -133,12 +140,14 @@ class CreateTournamentForm extends React.Component {
|
||||||
<GroupphaseFader pose={this.state.groupPhaseEnabled? 'visible' : 'hidden'} className="groupphasefader">
|
<GroupphaseFader pose={this.state.groupPhaseEnabled? 'visible' : 'hidden'} className="groupphasefader">
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Label for="teams-per-group">Anzahl Teams pro Gruppe</Label>
|
<Label for="teams-per-group">Anzahl Teams pro Gruppe</Label>
|
||||||
<Input type="number" name="teams-per-group" size="255"/>
|
<Input type="number" name="teams-per-group" min="3"
|
||||||
|
value={this.state.groupSize} onChange={this.handleGroupSizeInput}/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Label for="teams-group-to-playoff">Wie viele Teams sollen nach der Gruppenphase
|
<Label for="teams-group-to-playoff">Wie viele Teams sollen nach der Gruppenphase
|
||||||
weiterkommen?</Label>
|
weiterkommen?</Label>
|
||||||
<Input type="number" name="teams-group-to-playoff" size="255"/>
|
<Input type="number" name="teams-group-to-playoff" min="1" max={this.state.groupSize - 1}
|
||||||
|
value={this.state.groupAdvance} onChange={this.handleGroupAdvanceInput}/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</GroupphaseFader>
|
</GroupphaseFader>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
@ -154,6 +163,22 @@ class CreateTournamentForm extends React.Component {
|
||||||
this.setState({teams: list});
|
this.setState({teams: list});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleGroupSizeInput(input) {
|
||||||
|
let newSize = input.target.value;
|
||||||
|
if(newSize <= this.state.groupAdvance) {
|
||||||
|
this.setState({
|
||||||
|
groupSize: newSize,
|
||||||
|
groupAdvance: newSize - 1
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({ groupSize: newSize });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleGroupAdvanceInput(input) {
|
||||||
|
this.setState({ groupAdvance: input.target.value });
|
||||||
|
}
|
||||||
|
|
||||||
handleGroupPhaseEnabledInput(input) {
|
handleGroupPhaseEnabledInput(input) {
|
||||||
this.setState({ groupPhaseEnabled: input.target.checked });
|
this.setState({ groupPhaseEnabled: input.target.checked });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue