Merge pull request #216 from Razzeee/align-unread-tabbar

Bold unread tabitem if there are unread messages
This commit is contained in:
Yuya Ochiai
2016-07-28 23:02:00 +09:00
committed by GitHub
2 changed files with 27 additions and 33 deletions

View File

@@ -7,6 +7,7 @@ The "UNDER DEVELOPMENT" section of the Mattermost Desktop changelog appears in t
Release date: TBD Release date: TBD
### Improvements ### Improvements
- Changed display of unread messages on the team tabbar, they are now shown as bold text
#### Windows #### Windows
- Update Mattermost icon for desktop notifications in Windows 10. - Update Mattermost icon for desktop notifications in Windows 10.

View File

@@ -219,30 +219,16 @@ var TabBar = React.createClass({
var tabs = this.props.teams.map(function(team, index) { var tabs = this.props.teams.map(function(team, index) {
var unreadCount = 0; var unreadCount = 0;
var badgeStyle = { var badgeStyle = {
unread: { background: '#FF1744',
background: '#383838', float: 'right',
float: 'right', color: 'white',
color: 'white', minWidth: '19px',
textAlign: 'center', fontSize: '12px',
marginTop: '5px', textAlign: 'center',
width: '10px', lineHeight: '20px',
height: '10px', height: '19px',
marginLeft: '5px', marginLeft: '5px',
borderRadius: '50%', borderRadius: '50%',
},
mention: {
background: '#f1342c',
float: 'right',
color: 'white',
minWidth: '19px',
fontSize: '12px',
textAlign: 'center',
lineHeight: '20px',
height: '19px',
marginLeft: '5px',
borderRadius: '50%',
}
}; };
if (thisObj.props.unreadCounts[index] > 0) { if (thisObj.props.unreadCounts[index] > 0) {
@@ -262,18 +248,25 @@ var TabBar = React.createClass({
var badge; var badge;
if (mentionCount != 0) { if (mentionCount != 0) {
badge = (<div style={ badgeStyle.mention }> badge = (<div style={ badgeStyle }>
{ mentionCount } { mentionCount }
</div>); </div>);
} else if (unreadCount > 0) {
badge = (<div style={ badgeStyle.unread }></div>);
} }
var id = 'teamTabItem' + index; if (unreadCount == 0) {
return (<NavItem className="teamTabItem" key={ id } id={ id } eventKey={ index }> var id = 'teamTabItem' + index;
{ team.name } return (<NavItem className="teamTabItem" key={ id } id={ id } eventKey={ index }>
{ ' ' } { team.name }
{ badge } { ' ' }
</NavItem>); { badge }
</NavItem>);
} else {
var id = 'teamTabItem' + index;
return (<NavItem className="teamTabItem" key={ id } id={ id } eventKey={ index }>
<b>{ team.name }</b>
{ ' ' }
{ badge }
</NavItem>);
}
}); });
return ( return (
<Nav id={ this.props.id } bsStyle="tabs" activeKey={ this.props.activeKey } onSelect={ this.props.onSelect }> <Nav id={ this.props.id } bsStyle="tabs" activeKey={ this.props.activeKey } onSelect={ this.props.onSelect }>