diff --git a/lib/gather/controller.js b/lib/gather/controller.js index 935dab3..d5842ab 100644 --- a/lib/gather/controller.js +++ b/lib/gather/controller.js @@ -23,8 +23,7 @@ var Map = require("./map"); var Server = require("./server"); var Gather = require("./gather"); var gather; -var previousGathers = []; - +var previousGather; module.exports = function (namespace) { var refreshGather = function () { @@ -33,17 +32,14 @@ module.exports = function (namespace) { gather: gather.toJson(), currentGatherer: gather.getGatherer(socket._user), maps: Map.list, - servers: Server.list + servers: Server.list, + previousGather: previousGather }); }); - - namespace.emit("gather:history", { - gatherHistory: previousGathers.slice(0,5).map((gather) => {return gather.toJson()}) - }); }; var newGather = function () { - if (gather) previousGathers.push(gather); + if (gather) previousGather = gather; gather = Gather({ onEvent: function () { refreshGather(); diff --git a/lib/react/gather.jsx b/lib/react/gather.jsx index be540be..471fff3 100644 --- a/lib/react/gather.jsx +++ b/lib/react/gather.jsx @@ -484,7 +484,13 @@ var Gather = React.createClass({ if (this.props.gather.state === 'selection') { gatherTeams = } + + var previousGather; + if (this.props.previousGather) { + previousGather = (); + } return ( +
Current Gather @@ -495,7 +501,9 @@ var Gather = React.createClass({ {gatherTeams} {voting} -
+
+ {previousGather} +
); } }); @@ -613,7 +621,7 @@ var CompletedGather = React.createClass({ return (
- Gather Details + Previous Gather
diff --git a/public/js/app.js b/public/js/app.js index ba45b1b..72f8f41 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -616,28 +616,38 @@ var Gather = React.createClass({ if (this.props.gather.state === 'selection') { gatherTeams = React.createElement(GatherTeams, { gather: this.props.gather }); } + + var previousGather; + if (this.props.previousGather) { + previousGather = React.createElement(CompletedGather, _extends({}, this.props, { gather: this.props.previousGather })); + } return React.createElement( "div", - { className: "panel panel-default" }, + null, React.createElement( "div", - { className: "panel-heading" }, + { className: "panel panel-default" }, React.createElement( - "strong", - null, - "Current Gather" + "div", + { className: "panel-heading" }, + React.createElement( + "strong", + null, + "Current Gather" + ), + React.createElement( + "span", + { className: "badge add-left" }, + this.props.gather.gatherers.length + ) ), - React.createElement( - "span", - { className: "badge add-left" }, - this.props.gather.gatherers.length - ) + React.createElement(GatherProgress, this.props), + React.createElement(Gatherers, this.props), + gatherTeams, + voting, + React.createElement(GatherActions, this.props) ), - React.createElement(GatherProgress, this.props), - React.createElement(Gatherers, this.props), - gatherTeams, - voting, - React.createElement(GatherActions, this.props) + previousGather ); } }); @@ -815,7 +825,7 @@ var CompletedGather = React.createClass({ React.createElement( "strong", null, - "Gather Details" + "Previous Gather" ) ), React.createElement(GatherTeams, { gather: this.props.gather }),