Show vote results at selection stage

This commit is contained in:
Chris Blanchard 2015-09-05 18:37:43 +01:00
parent 54f3ca0ed7
commit 6525b44714

View file

@ -570,6 +570,8 @@ var Gather = React.createClass({
var voting;
if (this.props.currentGatherer) {
let state = this.props.gather.state;
if (state === 'gathering' || state === 'election') {
voting = (
<div className="row add-top">
<div className="col-md-6">
@ -580,6 +582,9 @@ var Gather = React.createClass({
</div>
</div>
);
} else {
voting = <GatherVotingResults gather={this.props.gather} servers={this.props.servers} maps={this.props.maps} />;
}
}
var gatherTeams;
@ -663,7 +668,7 @@ var Gatherers = React.createClass({
);
} else {
if (gatherer.team !== "lobby") {
action = (<span className="label label-success">{gatherer.team}</span>);
action = (<span className="label label-primary">{gatherer.team}</span>);
}
}
}
@ -720,6 +725,20 @@ var Gatherers = React.createClass({
});
var CompletedGather = React.createClass({
render() {
return (
<div className="panel panel-default">
<div className="panel-heading">
<strong>Previous Gather</strong>
</div>
<GatherTeams gather={this.props.gather} />
<GatherVotingResults gather={this.props.gather} maps={this.props.maps} servers={this.props.servers}/>
</div>
);
}
});
var GatherVotingResults = React.createClass({
countVotes(voteType) {
return this.props.gather.gatherers.reduce((acc, gatherer) => {
if (gatherer[voteType] !== null) acc.push(gatherer[voteType]);
@ -739,11 +758,6 @@ var CompletedGather = React.createClass({
var maps = this.selectedMaps();
var server = this.selectedServer().pop();
return (
<div className="panel panel-default">
<div className="panel-heading">
<strong>Previous Gather</strong>
</div>
<GatherTeams gather={this.props.gather} />
<div className="panel-body">
<dl className="dl-horizontal">
<dt>Maps</dt>
@ -760,7 +774,6 @@ var CompletedGather = React.createClass({
className="btn btn-primary">Click to Join</a></dd>
</dl>
</div>
</div>
);
}
});