diff --git a/stylesheets/_session_theme_dark_left_pane.scss b/stylesheets/_session_theme_dark_left_pane.scss index ee6236fc5..aeb4d78ee 100644 --- a/stylesheets/_session_theme_dark_left_pane.scss +++ b/stylesheets/_session_theme_dark_left_pane.scss @@ -264,3 +264,16 @@ $session-compose-margin: 20px; } } } + +.contact-notification-count-bubble { + background: $session-color-danger; + line-height: 30px; + width: 30px; + height: 30px; + font-size: 14px; + margin-left: auto; + text-align: center; + border-radius: 50%; + color: $session-color-white; + font-weight: bold; +} diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx index 0794df87b..e110fc500 100644 --- a/ts/components/LeftPane.tsx +++ b/ts/components/LeftPane.tsx @@ -114,11 +114,13 @@ export class LeftPane extends React.Component { ); } + // this static function is set here to be used by all subsections (message, contacts,...) to render their headers static renderHeader( labels: Array, onTabSelected?: any, buttonLabel?: string, - buttonClicked?: any + buttonClicked?: any, + notificationCount?: number ): JSX.Element { return ( { labels={labels} buttonLabel={buttonLabel} buttonClicked={buttonClicked} + notificationCount={notificationCount} /> ); } diff --git a/ts/components/session/LeftPaneSectionHeader.tsx b/ts/components/session/LeftPaneSectionHeader.tsx index 88577ceeb..7c709cd1f 100644 --- a/ts/components/session/LeftPaneSectionHeader.tsx +++ b/ts/components/session/LeftPaneSectionHeader.tsx @@ -58,7 +58,12 @@ export class LeftPaneSectionHeader extends React.Component { private renderTabs() { const { selectedTab } = this.state; - const { labels, buttonLabel, buttonClicked } = this.props; + const { + labels, + buttonLabel, + buttonClicked, + notificationCount, + } = this.props; const children = []; //loop to create children @@ -82,6 +87,17 @@ export class LeftPaneSectionHeader extends React.Component { key={window.i18n('compose')} /> ); + } else if (notificationCount && notificationCount > 0) { + const shortenedNotificationCount = + notificationCount > 9 ? 9 : notificationCount; + children.push( +
+ {shortenedNotificationCount} +
+ ); } //Create the parent and add the children