Skip to content

Commit

Permalink
Add tooltip to notification statusbar item
Browse files Browse the repository at this point in the history
- adds a tooltip to the `notification` statusbar item.
- displays `Hide Notifications` when the notification center is expanded.
- displays `No Notifications` when the notification center is collapsed and no notifications are present.
- displays `{count} Notifications` when the notification center is collapsed and notifications are present.

Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Dec 18, 2019
1 parent 4c4a1f2 commit 938bc48
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/messages/src/browser/notifications-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,20 @@ export class NotificationsContribution implements FrontendApplicationContributio
text: this.getStatusBarItemText(count),
alignment: StatusBarAlignment.RIGHT,
priority: -900,
command: NotificationsCommands.TOGGLE.id
command: NotificationsCommands.TOGGLE.id,
tooltip: this.getStatusBarItemTooltip(count)
});
}
protected getStatusBarItemText(count: number): string {
return `$(bell) ${count ? ` ${count}` : '' }`;
return `$(bell) ${count ? ` ${count}` : ''}`;
}
protected getStatusBarItemTooltip(count: number): string {
if (this.manager.centerVisible) {
return 'Hide Notifications';
}
return count === 0
? 'No Notifications'
: count === 1 ? '1 Notification' : `${count} Notifications`;
}

registerCommands(commands: CommandRegistry): void {
Expand Down

0 comments on commit 938bc48

Please sign in to comment.