diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-09-14 16:56:20 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-09-16 16:51:16 -0400 |
commit | 8d0c69aec62a0b48db353f40769d3c4baded8e87 (patch) | |
tree | 79c9f83348d3e22b9b38c16b6f847da9c3c151b5 /web/react/components | |
parent | e644b53b72d346539f5c58cc0cb0a07c4054cbcb (diff) | |
download | chat-8d0c69aec62a0b48db353f40769d3c4baded8e87.tar.gz chat-8d0c69aec62a0b48db353f40769d3c4baded8e87.tar.bz2 chat-8d0c69aec62a0b48db353f40769d3c4baded8e87.zip |
Properly hide unread channel indicators when there are no unread channels
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/sidebar.jsx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index 697fc09c9..370250e4a 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -274,26 +274,32 @@ export default class Sidebar extends React.Component { this.updateUnreadIndicators(); } updateUnreadIndicators() { - var container = $(React.findDOMNode(this.refs.container)); + const container = $(React.findDOMNode(this.refs.container)); + const topUnreadIndicator = $(React.findDOMNode(this.refs.topUnreadIndicator)); + const bottomUnreadIndicator = $(React.findDOMNode(this.refs.bottomUnreadIndicator)); if (this.firstUnreadChannel) { var firstUnreadElement = $(React.findDOMNode(this.refs[this.firstUnreadChannel])); if (firstUnreadElement.position().top + firstUnreadElement.height() < 0) { - $(React.findDOMNode(this.refs.topUnreadIndicator)).css('display', 'initial'); + topUnreadIndicator.css('display', 'initial'); } else { - $(React.findDOMNode(this.refs.topUnreadIndicator)).css('display', 'none'); + topUnreadIndicator.css('display', 'none'); } + } else { + topUnreadIndicator.css('display', 'none'); } if (this.lastUnreadChannel) { var lastUnreadElement = $(React.findDOMNode(this.refs[this.lastUnreadChannel])); if (lastUnreadElement.position().top > container.height()) { - $(React.findDOMNode(this.refs.bottomUnreadIndicator)).css('display', 'initial'); + bottomUnreadIndicator.css('display', 'initial'); } else { - $(React.findDOMNode(this.refs.bottomUnreadIndicator)).css('display', 'none'); + bottomUnreadIndicator.css('display', 'none'); } + } else { + bottomUnreadIndicator.css('display', 'none'); } } createChannelElement(channel, index) { |