diff --git a/package.json b/package.json index e1185b82cc..6427d40e6d 100644 --- a/package.json +++ b/package.json @@ -1688,6 +1688,16 @@ "view": "github:activePullRequest:welcome", "when": "!github:stateValidated", "contents": "%welcome.github.activePullRequest.contents%" + }, + { + "view": "notifications:github", + "when": "!github:notificationCount", + "contents": "%welcome.github.notificationsLoading.contents%" + }, + { + "view": "notifications:github", + "when": "ReposManagerStateContext == RepositoriesLoaded && github:notificationCount == 0", + "contents": "%welcome.github.notifications.contents%" } ], "keybindings": [ diff --git a/package.nls.json b/package.nls.json index def1e462d8..64087bb925 100644 --- a/package.nls.json +++ b/package.nls.json @@ -353,6 +353,8 @@ "Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links" ] }, + "welcome.github.notificationsLoading.contents": "Loading...", + "welcome.github.notifications.contents": "No notifications, your inbox is empty $(rocket)", "welcome.issues.github.uninitialized.contents": "Loading...", "welcome.issues.github.noFolder.contents": "You have not yet opened a folder.", "welcome.issues.github.noRepo.contents": "No git repositories found", diff --git a/src/common/executeCommands.ts b/src/common/executeCommands.ts index 99bbbafae2..c815f4811a 100644 --- a/src/common/executeCommands.ts +++ b/src/common/executeCommands.ts @@ -19,6 +19,7 @@ export namespace contexts { export const PULL_REQUEST_DESCRIPTION_VISIBLE = 'github:pullRequestDescriptionVisible'; // Boolean indicating if the pull request description is visible export const ACTIVE_COMMENT_HAS_SUGGESTION = 'github:activeCommentHasSuggestion'; // Boolean indicating if the active comment has a suggestion export const CREATING = 'pr:creating'; + export const NOTIFICATION_COUNT = 'github:notificationCount'; // Number of notifications in the notifications view } export namespace commands { diff --git a/src/notifications/notificationsProvider.ts b/src/notifications/notificationsProvider.ts index 2a8457b538..fc6f6b8419 100644 --- a/src/notifications/notificationsProvider.ts +++ b/src/notifications/notificationsProvider.ts @@ -5,6 +5,7 @@ import * as vscode from 'vscode'; import { AuthProvider } from '../common/authentication'; +import { commands, contexts } from '../common/executeCommands'; import { Disposable } from '../common/lifecycle'; import { EXPERIMENTAL_NOTIFICATIONS_PAGE_SIZE, PR_SETTINGS_NAMESPACE } from '../common/settingKeys'; import { OctokitCommon } from '../github/common'; @@ -101,6 +102,7 @@ export class NotificationsProvider extends Disposable { .map((notification: OctokitCommon.Notification) => parseNotification(notification)) .filter(notification => !!notification) as Notification[]; + commands.setContext(contexts.NOTIFICATION_COUNT, notifications.length); return { notifications, hasNextPage: headers.link?.includes(`rel="next"`) === true }; }