From 34f7451c4ad50fe64cc1c06dbd204c5b6446bca5 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 6 Aug 2015 18:57:57 -0400 Subject: Added indicators for when a channel with unread posts is offscreen --- web/react/components/sidebar.jsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'web/react/components') diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index abbcd306d..d6c22230e 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -134,14 +134,14 @@ module.exports = React.createClass({ this.updateTitle(); this.updateUnreadIndicators(); - $('.nav-pills__container').on('scroll', null, this.onScroll); + $('.nav-pills__container').on('scroll', this.onScroll); }, componentDidUpdate: function() { this.updateTitle(); this.updateUnreadIndicators(); }, componentWillUnmount: function() { - $('.nav-pills__container').off('scroll', null, this.onScroll); + $('.nav-pills__container').off('scroll', this.onScroll); ChannelStore.removeChangeListener(this.onChange); UserStore.removeChangeListener(this.onChange); @@ -251,7 +251,9 @@ module.exports = React.createClass({ var firstUnreadElement = $(this.refs[this.firstUnreadChannel].getDOMNode()); if (firstUnreadElement.position().top + firstUnreadElement.height() < 0) { - console.log("off top"); + $(this.refs.topUnreadIndicator.getDOMNode()).css('display', 'initial'); + } else { + $(this.refs.topUnreadIndicator.getDOMNode()).css('display', 'none'); } } @@ -259,7 +261,10 @@ module.exports = React.createClass({ var lastUnreadElement = $(this.refs[this.lastUnreadChannel].getDOMNode()); if (lastUnreadElement.position().top > container.height()) { - console.log("off bottom"); + $(this.refs.bottomUnreadIndicator.getDOMNode()).css('bottom', '0'); + $(this.refs.bottomUnreadIndicator.getDOMNode()).css('display', 'initial'); + } else { + $(this.refs.bottomUnreadIndicator.getDOMNode()).css('display', 'none'); } } }, @@ -387,6 +392,9 @@ module.exports = React.createClass({ +
Unread post(s) above
+
Unread post(s) below
+
  • Channels+

  • -- cgit v1.2.3-1-g7c22