move filtering of offline zones to state update

This commit is contained in:
Matt Claypotch 2015-04-02 15:09:07 -07:00
Родитель f2c7bbd526
Коммит 007289fef7
2 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -40,17 +40,18 @@ var App = React.createClass({
data = data.sort(function (a, b) {
return a.name > b.name ? 1: -1;
});
var zones = data.filter(function (z) {
return z.aData.iStatus === 'online';
});
self.setState({
mode: self.state.mode,
zones: data
zones: zones
});
});
},
render: function () {
var zone = this.state.zones[this.state.selected];
var zones = this.state.zones.filter(function (z) {
return z.aData.iStatus === 'online';
});
var zones = this.state.zones;
var zone = zones[this.state.selected];
return (
<div className="app" data-mode={this.state.mode}>
<Overview zones={zones} selectZone={this.selectZone} />
@ -163,7 +164,6 @@ var ZoneOverview = React.createClass({
var QueueItem = React.createClass({
upVote: function (pick, e) {
console.log(this.props);
e.preventDefault();
this.props.upvote(pick);
},

Просмотреть файл

@ -40,17 +40,18 @@ var App = React.createClass({displayName: "App",
data = data.sort(function (a, b) {
return a.name > b.name ? 1: -1;
});
var zones = data.filter(function (z) {
return z.aData.iStatus === 'online';
});
self.setState({
mode: self.state.mode,
zones: data
zones: zones
});
});
},
render: function () {
var zone = this.state.zones[this.state.selected];
var zones = this.state.zones.filter(function (z) {
return z.aData.iStatus === 'online';
});
var zones = this.state.zones;
var zone = zones[this.state.selected];
return (
React.createElement("div", {className: "app", "data-mode": this.state.mode},
React.createElement(Overview, {zones: zones, selectZone: this.selectZone}),
@ -163,7 +164,6 @@ var ZoneOverview = React.createClass({displayName: "ZoneOverview",
var QueueItem = React.createClass({displayName: "QueueItem",
upVote: function (pick, e) {
console.log(this.props);
e.preventDefault();
this.props.upvote(pick);
},