Github user benkeen commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/544#discussion_r41170394
  
    --- Diff: app/addons/fauxton/components.react.jsx ---
    @@ -334,13 +354,246 @@ function (app, FauxtonAPI, React, ZeroClipboard) {
       });
     
     
    +  var NotificationCenterButton = React.createClass({
    +    getInitialState: function () {
    +      return {
    +        visible: true
    +      };
    +    },
    +
    +    hide: function () {
    +      this.setState({ visible: false });
    +    },
    +
    +    show: function () {
    +      this.setState({ visible: true });
    +    },
    +
    +    render: function () {
    +      var classes = 'fonticon fonticon-bell' + ((!this.state.visible) ? ' 
hide' : '');
    +      return (
    +        <div className={classes} 
onClick={Actions.showNotificationCenter}></div>
    +      );
    +    }
    +  });
    +
    +  var NotificationCenterPanel = React.createClass({
    +
    +    getInitialState: function () {
    +      return this.getStoreState();
    +    },
    +
    +    getStoreState: function () {
    +      return {
    +        isVisible: notificationStore.isNotificationCenterVisible(),
    +        filter: notificationStore.getNotificationFilter(),
    +        notifications: notificationStore.getNotifications()
    +      };
    +    },
    +
    +    componentDidMount: function () {
    +      notificationStore.on('change', this.onChange, this);
    +    },
    +
    +    componentWillUnmount: function () {
    +      notificationStore.off('change', this.onChange);
    +    },
    +
    +    onChange: function () {
    +      if (this.isMounted()) {
    +        this.setState(this.getStoreState());
    +      }
    +    },
    +
    +    getNotifications: function () {
    +      if (!this.state.notifications.length) {
    +        return (
    +          <li className="no-notifications">No notifications.</li>
    +        );
    +      }
    +
    +      return _.map(this.state.notifications, function (notification, i) {
    +        return (
    +          <NotificationRow
    +            isVisible={this.state.isVisible}
    +            item={notification}
    +            filter={this.state.filter}
    +            key={notification.notificationId}
    +          />
    +        );
    +      }, this);
    +    },
    +
    +    selectFilter: function (e) {
    +      var filter = $(e.target).closest('li').data('filter');
    --- End diff --
    
    I think it's okay in this case, no? I need to do a little hunting in the 
DOM to locate the parent list item based on whatever element triggered the 
event, so jQuery seemed the simplest. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to