aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/js/components')
-rw-r--r--src/web/js/components/Menu.react.js21
-rw-r--r--src/web/js/components/MiddlePanel.react.js19
2 files changed, 14 insertions, 26 deletions
diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js
index 3e5f4156..09250706 100644
--- a/src/web/js/components/Menu.react.js
+++ b/src/web/js/components/Menu.react.js
@@ -121,34 +121,27 @@ var MenuFilter = React.createClass({
var error_button = null;
if (this.state.feed_in_error) {
error_button = (<Button active={this.state.filter == "error"}
- onMouseDown={MenuActions.setFilterError}
+ onMouseDown={() => this.setFilter("error")}
bsSize="small" bsStyle="warning">Error</Button>
);
}
return (<Row className="show-grid">
<ButtonGroup>
<Button active={this.state.filter == "all"}
- onMouseDown={MenuActions.setFilterAll}
+ onMouseDown={() => this.setFilter("all")}
bsSize="small">All</Button>
<Button active={this.state.filter == "unread"}
- onMouseDown={MenuActions.setFilterUnread}
+ onMouseDown={() => this.setFilter("unread")}
bsSize="small">Unread</Button>
{error_button}
</ButtonGroup>
</Row>
);
},
- componentDidMount: function() {
- MenuStore.addChangeListener(this._onChange);
- },
- componentWillUnmount: function() {
- MenuStore.removeChangeListener(this._onChange);
- },
- _onChange: function() {
- var datas = MenuStore.getAll();
- this.setState({filter: datas.filter,
- feed_in_error: datas.feed_in_error});
- },
+ setFilter: function(filter) {
+ this.setState({filter: filter});
+ MenuActions.setFilter(filter);
+ }
});
var Menu = React.createClass({
diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js
index 741af5e9..e0ea8110 100644
--- a/src/web/js/components/MiddlePanel.react.js
+++ b/src/web/js/components/MiddlePanel.react.js
@@ -64,27 +64,22 @@ var MiddlePanelFilter = React.createClass({
return (<Row className="show-grid">
<ButtonGroup>
<Button active={this.state.filter == "all"}
- onMouseDown={MiddlePanelActions.setFilterAll}
+ onMouseDown={() => this.setFilter("all")}
bsSize="small">All</Button>
<Button active={this.state.filter == "unread"}
- onMouseDown={MiddlePanelActions.setFilterUnread}
+ onMouseDown={() => this.setFilter("unread")}
bsSize="small">Unread</Button>
<Button active={this.state.filter == "liked"}
- onMouseDown={MiddlePanelActions.setFilterLiked}
+ onMouseDown={() => this.setFilter("liked")}
bsSize="small">Liked</Button>
</ButtonGroup>
</Row>
);
},
- componentDidMount: function() {
- MiddlePanelStore.addChangeListener(this._onChange);
- },
- componentWillUnmount: function() {
- MiddlePanelStore.removeChangeListener(this._onChange);
- },
- _onChange: function() {
- this.setState({filter: MiddlePanelStore._datas.filter});
- },
+ setFilter: function(filter) {
+ this.setState({filter: filter});
+ MiddlePanelActions.setFilter(filter);
+ }
});
var MiddlePanel = React.createClass({
bgstack15