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
1 changed files with 44 additions and 31 deletions

View File

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