Made the badge always exist, but if no unread mesasges available then has a different class

pull/21833/head
wmwragg 2016-07-20 12:47:32 +01:00
parent 514bc2cd51
commit 33edb1dea9
1 changed files with 17 additions and 7 deletions

View File

@ -95,14 +95,24 @@ module.exports = React.createClass({
name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon
var badge; var badge;
var badgeContent; var badgeContent;
if (this.props.highlight || notificationCount > 0) { var badgeClasses;
if (this.state.badgeHover) { if (this.state.badgeHover) {
badgeContent = "\u00B7 \u00B7 \u00B7"; badgeContent = "\u00B7 \u00B7 \u00B7";
} else { } else if (this.props.highlight || notificationCount > 0) {
badgeContent = notificationCount ? notificationCount : '!'; badgeContent = notificationCount ? notificationCount : '!';
} else {
badgeContent = '\u200B';
} }
badge = <div className="mx_RoomTile_badge" onMouseEnter={this.badgeOnMouseEnter} onMouseLeave={this.badgeOnMouseLeave}>{ badgeContent }</div>;
if (this.props.highlight || notificationCount > 0) {
badgeClasses = "mx_RoomTile_badge"
} else {
badgeClasses = "mx_RoomTile_badge mx_RoomTile_badge_no_unread";
} }
badge = <div className={ badgeClasses } onMouseEnter={this.badgeOnMouseEnter} onMouseLeave={this.badgeOnMouseLeave}>{ badgeContent }</div>;
/* /*
if (this.props.highlight) { if (this.props.highlight) {
badge = <div className="mx_RoomTile_badge">!</div>; badge = <div className="mx_RoomTile_badge">!</div>;