Skip to content

Commit

Permalink
Improves home, welcome, getting started experience
Browse files Browse the repository at this point in the history
Adds links footer to home view when welcome is hidden
Polishes welcome/settings page headers
Removes links from welcome page
Removes old welcome view
  • Loading branch information
eamodio committed Feb 18, 2022
1 parent aeeb011 commit a540814
Show file tree
Hide file tree
Showing 26 changed files with 376 additions and 281 deletions.
75 changes: 25 additions & 50 deletions package.json
Expand Up @@ -71,6 +71,7 @@
"onCommand:gitlens.premium.startPreview",
"onCommand:gitlens.premium.purchase",
"onCommand:gitlens.premium.reset",
"onCommand:gitlens.getStarted",
"onCommand:gitlens.showSettingsPage",
"onCommand:gitlens.showSettingsPage#views",
"onCommand:gitlens.showSettingsPage#branches-view",
Expand All @@ -89,15 +90,14 @@
"onCommand:gitlens.showCommitsView",
"onCommand:gitlens.showContributorsView",
"onCommand:gitlens.showFileHistoryView",
"onCommand:gitlens.showHomeView",
"onCommand:gitlens.showLineHistoryView",
"onCommand:gitlens.showRemotesView",
"onCommand:gitlens.showRepositoriesView",
"onCommand:gitlens.showSearchAndCompareView",
"onCommand:gitlens.showStashesView",
"onCommand:gitlens.showTagsView",
"onCommand:gitlens.showWorktreesView",
"onCommand:gitlens.showWelcomeView",
"onCommand:gitlens.closeWelcomeView",
"onCommand:gitlens.compareWith",
"onCommand:gitlens.compareHeadWith",
"onCommand:gitlens.compareWorkingWith",
Expand Down Expand Up @@ -3624,6 +3624,11 @@
"title": "Reset...",
"category": "GitLens Premium"
},
{
"command": "gitlens.getStarted",
"title": "Get Started",
"category": "GitLens"
},
{
"command": "gitlens.showSettingsPage",
"title": "Open Settings",
Expand Down Expand Up @@ -3727,6 +3732,11 @@
"title": "Show File History View",
"category": "GitLens"
},
{
"command": "gitlens.showHomeView",
"title": "Show Home View",
"category": "GitLens"
},
{
"command": "gitlens.showLineHistoryView",
"title": "Show Line History View",
Expand Down Expand Up @@ -3762,17 +3772,6 @@
"title": "Show Worktrees View",
"category": "GitLens"
},
{
"command": "gitlens.showWelcomeView",
"title": "Show Welcome View",
"category": "GitLens"
},
{
"command": "gitlens.closeWelcomeView",
"title": "Close",
"category": "GitLens",
"icon": "$(close)"
},
{
"command": "gitlens.compareWith",
"title": "Compare References...",
Expand Down Expand Up @@ -5977,6 +5976,10 @@
"command": "gitlens.showFileHistoryView",
"when": "gitlens:enabled"
},
{
"command": "gitlens.showHomeView",
"when": "gitlens:enabled"
},
{
"command": "gitlens.showLineHistoryView",
"when": "gitlens:enabled && !gitlens:hasVirtualFolders"
Expand All @@ -6003,15 +6006,7 @@
},
{
"command": "gitlens.showWorktreesView",
"when": "gitlens:enabled"
},
{
"command": "gitlens.showWelcomeView",
"when": "gitlens:enabled"
},
{
"command": "gitlens.closeWelcomeView",
"when": "false"
"when": "gitlens:enabled && !gitlens:hasVirtualFolders"
},
{
"command": "gitlens.compareWith",
Expand Down Expand Up @@ -7685,14 +7680,19 @@
],
"extension/context": [
{
"command": "gitlens.showWelcomePage",
"command": "gitlens.getStarted",
"when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed",
"group": "9_gitlens@1"
},
{
"command": "gitlens.showSettingsPage",
"command": "gitlens.showWelcomePage",
"when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed",
"group": "9_gitlens@2"
},
{
"command": "gitlens.showSettingsPage",
"when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed",
"group": "9_gitlens@3"
}
],
"git.commit": [
Expand Down Expand Up @@ -7789,11 +7789,6 @@
}
],
"view/title": [
{
"command": "gitlens.closeWelcomeView",
"when": "view == gitlens.views.welcome",
"group": "navigation@1"
},
{
"command": "gitlens.views.switchToAnotherBranch",
"when": "!gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && view =~ /^gitlens\\.views\\.branches/",
Expand Down Expand Up @@ -10529,18 +10524,6 @@
]
},
"viewsWelcome": [
{
"view": "gitlens.views.welcome",
"contents": "GitLens 11 is powerful, feature rich, and highly customizable to meet your needs. You can use the GitLens Welcome experience to get setup quickly.\n\n[Welcome (Quick Setup)](command:gitlens.showWelcomePage \"Opens the GitLens Welcome (Quick Setup)\")\n\nFor more options, run [GitLens: Open Settings](command:gitlens.showSettingsPage \"Opens the GitLens Interactive Settings\") from the Command Palette to open the interactive GitLens settings editor."
},
{
"view": "gitlens.views.welcome",
"contents": "[GitLens views](command:gitlens.showSettingsPage%23views) are shown on the Source Control side bar, by default. Run [GitLens: Set Views Layout](command:gitlens.setViewsLayout \"Changes the GitLens Views Layout\") from the Command Palette to switch to an alternate side bar layout, or drag & drop them."
},
{
"view": "gitlens.views.welcome",
"contents": "[Close](command:gitlens.closeWelcomeView \"Closes the Welcome view\")"
},
{
"view": "gitlens.views.searchAndCompare",
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [file](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22file%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [changes](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22change%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
Expand Down Expand Up @@ -10597,15 +10580,7 @@
"type": "webview",
"id": "gitlens.views.home",
"name": "Home",
"-when": "!gitlens:disabled && gitlens:views:home:visible != false",
"contextualTitle": "GitLens",
"icon": "images/gitlens-activitybar.svg",
"visibility": "visible"
},
{
"id": "gitlens.views.welcome",
"name": "Welcome",
"when": "gitlens:views:welcome:visible != false",
"-when": "!gitlens:disabled",
"contextualTitle": "GitLens",
"icon": "images/gitlens-activitybar.svg",
"visibility": "visible"
Expand Down
2 changes: 1 addition & 1 deletion src/commands.ts
@@ -1,7 +1,6 @@
export * from './commands/addAuthors';
export * from './commands/browseRepoAtRevision';
export * from './commands/closeUnchangedFiles';
export * from './commands/closeView';
export * from './commands/compareWith';
export * from './commands/copyCurrentBranch';
export * from './commands/copyMessageToClipboard';
Expand All @@ -17,6 +16,7 @@ export * from './commands/diffWithRevision';
export * from './commands/diffWithRevisionFrom';
export * from './commands/diffWithWorking';
export * from './commands/externalDiff';
export * from './commands/getStarted';
export * from './commands/gitCommands';
export * from './commands/inviteToLiveShare';
export * from './commands/logging';
Expand Down
26 changes: 0 additions & 26 deletions src/commands/closeView.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/getStarted.ts
@@ -0,0 +1,22 @@
import { Commands, CoreCommands } from '../constants';
import type { Container } from '../container';
import { command, executeCoreCommand } from '../system/command';
import { Command } from './base';

@command()
export class GetStartedCommand extends Command {
constructor(private readonly container: Container) {
super(Commands.GetStarted);
}

execute(step?: string) {
const id = this.container.context.extension.id;
// If the step param is the same as the extension id, then this was run from the extensions view gear menu
if (step === id) {
step = undefined;
}

// Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined
void executeCoreCommand(CoreCommands.OpenWalkthrough, `${id}#${step ?? 'gitlens.welcome'}`, true);
}
}
10 changes: 1 addition & 9 deletions src/commands/showView.ts
@@ -1,7 +1,5 @@
import { Commands, ContextKeys } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { SyncedStorageKeys } from '../storage';
import { command, executeCommand } from '../system/command';
import { Command, CommandContext } from './base';

Expand All @@ -20,7 +18,6 @@ export class ShowViewCommand extends Command {
Commands.ShowStashesView,
Commands.ShowTagsView,
Commands.ShowWorktreesView,
Commands.ShowWelcomeView,
Commands.ShowHomeView,
]);
}
Expand Down Expand Up @@ -53,11 +50,6 @@ export class ShowViewCommand extends Command {
return this.container.tagsView.show();
case Commands.ShowWorktreesView:
return this.container.worktreesView.show();
case Commands.ShowWelcomeView:
await setContext(ContextKeys.ViewsWelcomeVisible, true);
void this.container.storage.store(SyncedStorageKeys.WelcomeViewVisible, true);
void (await executeCommand('gitlens.views.welcome.focus'));
break;
case Commands.ShowHomeView:
void (await executeCommand('gitlens.views.home.focus'));
break;
Expand Down
4 changes: 2 additions & 2 deletions src/constants.ts
Expand Up @@ -98,6 +98,7 @@ export const enum Commands {
ExternalDiff = 'gitlens.externalDiff',
ExternalDiffAll = 'gitlens.externalDiffAll',
FetchRepositories = 'gitlens.fetchRepositories',
GetStarted = 'gitlens.getStarted',
InviteToLiveShare = 'gitlens.inviteToLiveShare',
OpenBlamePriorToChange = 'gitlens.openBlamePriorToChange',
OpenBranchesOnRemote = 'gitlens.openBranchesOnRemote',
Expand Down Expand Up @@ -182,7 +183,6 @@ export const enum Commands {
ShowTagsView = 'gitlens.showTagsView',
ShowWorktreesView = 'gitlens.showWorktreesView',
ShowWelcomePage = 'gitlens.showWelcomePage',
ShowWelcomeView = 'gitlens.showWelcomeView',
StashApply = 'gitlens.stashApply',
StashSave = 'gitlens.stashSave',
StashSaveFiles = 'gitlens.stashSaveFiles',
Expand Down Expand Up @@ -238,7 +238,6 @@ export const enum ContextKeys {
ViewsLineHistoryEditorFollowing = 'gitlens:views:lineHistory:editorFollowing',
ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh',
ViewsSearchAndCompareKeepResults = 'gitlens:views:searchAndCompare:keepResults',
ViewsWelcomeVisible = 'gitlens:views:welcome:visible',
Vsls = 'gitlens:vsls',

Premium = 'gitlens:premium',
Expand All @@ -262,6 +261,7 @@ export const enum CoreCommands {
Open = 'vscode.open',
OpenFolder = 'vscode.openFolder',
OpenInTerminal = 'openInTerminal',
OpenWalkthrough = 'workbench.action.openWalkthrough',
OpenWith = 'vscode.openWith',
NextEditor = 'workbench.action.nextEditor',
PreviewHtml = 'vscode.previewHtml',
Expand Down
28 changes: 12 additions & 16 deletions src/extension.ts
Expand Up @@ -85,18 +85,12 @@ export async function activate(context: ExtensionContext): Promise<GitLensApi |
let exitMessage;
if (Logger.enabled(LogLevel.Debug)) {
exitMessage = `syncedVersion=${syncedVersion}, localVersion=${localVersion}, previousVersion=${previousVersion}, welcome=${context.globalState.get<boolean>(
SyncedStorageKeys.WelcomeViewVisible,
SyncedStorageKeys.HomeViewWelcomeVisible,
)}`;
}

if (previousVersion == null) {
void context.globalState.update(SyncedStorageKeys.WelcomeViewVisible, true);
void setContext(ContextKeys.ViewsWelcomeVisible, true);
} else {
void setContext(
ContextKeys.ViewsWelcomeVisible,
context.globalState.get<boolean>(SyncedStorageKeys.WelcomeViewVisible) ?? false,
);
void context.globalState.update(SyncedStorageKeys.HomeViewWelcomeVisible, true);
}

Configuration.configure(context);
Expand Down Expand Up @@ -165,7 +159,7 @@ function setKeysForSync(context: ExtensionContext, ...keys: (SyncedStorageKeys |
return context.globalState?.setKeysForSync([
...keys,
SyncedStorageKeys.Version,
SyncedStorageKeys.WelcomeViewVisible,
SyncedStorageKeys.HomeViewWelcomeVisible,
]);
}

Expand Down Expand Up @@ -204,6 +198,9 @@ function registerBuiltInActionRunners(container: Container): void {
async function showWelcomeOrWhatsNew(container: Container, version: string, previousVersion: string | undefined) {
if (previousVersion == null) {
Logger.log(`GitLens first-time install; window.focused=${window.state.focused}`);

void executeCommand(Commands.ShowHomeView);

if (container.config.showWelcomeOnInstall === false) return;

if (window.state.focused) {
Expand Down Expand Up @@ -237,16 +234,15 @@ async function showWelcomeOrWhatsNew(container: Container, version: string, prev

const [major, minor] = version.split('.').map(v => parseInt(v, 10));
const [prevMajor, prevMinor] = previousVersion.split('.').map(v => parseInt(v, 10));
if (
(major === prevMajor && minor === prevMinor) ||
// Don't notify on downgrades
major < prevMajor ||
(major === prevMajor && minor < prevMinor)
) {

// Don't notify on downgrades
if (major === prevMajor || major < prevMajor || (major === prevMajor && minor < prevMinor)) {
return;
}

if (major !== prevMajor && container.config.showWhatsNewAfterUpgrades) {
void executeCommand(Commands.ShowHomeView);

if (container.config.showWhatsNewAfterUpgrades) {
if (window.state.focused) {
await container.storage.delete(StorageKeys.PendingWhatsNewOnFocus);
await Messages.showWhatsNewMessage(version);
Expand Down
2 changes: 1 addition & 1 deletion src/storage.ts
Expand Up @@ -70,7 +70,7 @@ export const enum StorageKeys {

export const enum SyncedStorageKeys {
Version = 'gitlens:synced:version',
WelcomeViewVisible = 'gitlens:views:welcome:visible',
HomeViewWelcomeVisible = 'gitlens:views:welcome:visible',

Deprecated_DisallowConnectionPrefix = 'gitlens:disallow:connection:',
}
Expand Down

0 comments on commit a540814

Please sign in to comment.