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 17, 2019
1 parent 4c4a1f2 commit cb6ee83
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/messages/src/browser/notifications-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,19 @@ 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}` : '' }`;
}
protected getStatusBarItemTooltip(count: number): string {
if (this.manager.centerVisible) {
return 'Hide Notifications';
}
return `${count ? `${count} Notifications` : 'No Notifications'}`;
}

registerCommands(commands: CommandRegistry): void {
commands.registerCommand(NotificationsCommands.TOGGLE, {
Expand Down

0 comments on commit cb6ee83

Please sign in to comment.