diff --git a/src/commands/getStarted.ts b/src/commands/getStarted.ts index cf4af6e..2a07c78 100644 --- a/src/commands/getStarted.ts +++ b/src/commands/getStarted.ts @@ -1,6 +1,7 @@ -import { Commands, CoreCommands } from '../constants'; +import { Commands } from '../constants'; import type { Container } from '../container'; -import { command, executeCoreCommand } from '../system/command'; +import { command } from '../system/command'; +import { openWalkthrough } from '../system/utils'; import { Command } from './base'; @command() @@ -9,15 +10,14 @@ export class GetStartedCommand extends Command { 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; + execute(walkthroughId?: string) { + const extensionId = this.container.context.extension.id; + // If the walkthroughId param is the same as the extension id, then this was run from the extensions view gear menu + if (walkthroughId === extensionId) { + walkthroughId = undefined; } - // Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined - void executeCoreCommand(CoreCommands.OpenWalkthrough, `${id}#${step ?? 'gitlens.welcome'}`, true); + void openWalkthrough(extensionId, walkthroughId ?? 'gitlens.welcome'); } } @@ -28,11 +28,6 @@ export class LearnAboutPremiumCommand extends Command { } execute() { - // Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined - void executeCoreCommand( - CoreCommands.OpenWalkthrough, - `${this.container.context.extension.id}#gitlens.premium`, - true, - ); + void openWalkthrough(this.container.context.extension.id, 'gitlens.premium'); } } diff --git a/src/system/utils.ts b/src/system/utils.ts index 57502f1..b364239 100644 --- a/src/system/utils.ts +++ b/src/system/utils.ts @@ -120,6 +120,18 @@ export async function openEditor( } } +export async function openWalkthrough(extensionId: string, walkthroughId: string, stepId?: string): Promise { + // Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined + void (await executeCoreCommand( + CoreCommands.OpenWalkthrough, + { + category: `${extensionId}#${walkthroughId}`, + step: stepId ? `${extensionId}#${walkthroughId}#${stepId}` : undefined, + }, + true, + )); +} + export const enum OpenWorkspaceLocation { CurrentWindow = 'currentWindow', NewWindow = 'newWindow', diff --git a/src/webviews/apps/premium/home/home.html b/src/webviews/apps/premium/home/home.html index 001b90b..d085a6f 100644 --- a/src/webviews/apps/premium/home/home.html +++ b/src/webviews/apps/premium/home/home.html @@ -142,9 +142,17 @@

Try GitLens Premium Features

- Premium features like Git Worktrees and Visual File History are available - with a free account, with many more features coming soon, including a commit graph and GitHub Enterprise - integration. Access to premium features for private repos is available with a paid account. + Premium features like + Git Worktrees + and + Visual File History + are available with a free account, with many more features coming soon, including a commit graph and + GitHub Enterprise integration. Access to premium features for private repos is available with a paid + account.

You can try these premium features for free, without an account, for 3 days. All non-premium features @@ -166,8 +174,14 @@

Trying Premium Features

- You are currently trying premium GitLens features, like Git Worktrees and - Visual File History, for 3 more days. + You are currently trying premium GitLens features, like + Git Worktrees + and + Visual File History, for 3 more days.

After that time, a free account will be required to continue using these premium features for public @@ -187,9 +201,15 @@

Continue using Premium Features

- Premium GitLens features like Git Worktrees and Visual File History, a - commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with an - account. + Premium GitLens features like + Git Worktrees + and + Visual File History, a commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with + an account.

Create a free account to continue trialing premium features for all code for an additional 7 days.

Learn about premium features @@ -206,10 +226,16 @@

Premium Feature Trial

- You are currently trialing premium GitLens features like Git Worktrees and - Visual File History for both public and private repos. In - 7 days, accessing these premium features for private repos will - require a paid account. + You are currently trialing premium GitLens features like + Git Worktrees + and + Visual File History + for both public and private repos. In 7 days, accessing these premium + features for private repos will require a paid account.

Learn about premium features Purchase a plan @@ -237,8 +263,15 @@

GitLens Free+

With your free account, you have access to GitLens Free+, which unlocks premium features like - Git Worktrees and Visual File History for public repos. More premium - features like a commit graph and GitHub Enterprise integration are coming soon. + Git Worktrees + and + Visual File History + for public repos. More premium features like a commit graph and GitHub Enterprise integration are coming + soon.

Access to premium features for private repos requires a paid plan.

Learn about premium features @@ -252,7 +285,14 @@

Thank you for purchasing GitLens Pro! With a GitLens Pro account, you can access premium features like - Git Worktrees and Visual File History for all of your code. + Git Worktrees + and + Visual File History + for all of your code.

Additional premium featues like a commit graph and GitHub Enterprise integration are coming soon.

Learn about premium features diff --git a/src/webviews/premium/home/homeWebviewView.ts b/src/webviews/premium/home/homeWebviewView.ts index ea7c213..6183d74 100644 --- a/src/webviews/premium/home/homeWebviewView.ts +++ b/src/webviews/premium/home/homeWebviewView.ts @@ -3,6 +3,7 @@ import type { Container } from '../../../container'; import type { SubscriptionChangeEvent } from '../../../premium/subscription/subscriptionService'; import { SyncedStorageKeys } from '../../../storage'; import type { Subscription } from '../../../subscription'; +import { openWalkthrough } from '../../../system/utils'; import { WebviewViewBase } from '../../webviewViewBase'; import { DidChangeSubscriptionNotificationType, State } from './protocol'; @@ -44,13 +45,16 @@ export class HomeWebviewView extends WebviewViewBase { protected override registerCommands(): Disposable[] { return [ commands.registerCommand('gitlens.home.toggleWelcome', async () => { - // TODO@eamodio implement hiding the welcome section and show a help/links section const welcomeVisible = this.container.storage.get(SyncedStorageKeys.HomeViewWelcomeVisible, true); await this.container.storage.store(SyncedStorageKeys.HomeViewWelcomeVisible, !welcomeVisible); const subscription = await this.container.subscription.getSubscription(); void this.notifyDidChangeData(subscription); }), + commands.registerCommand('gitlens.home.openWalkthrough', (idOrIdPlusStepId: string) => { + const [walkthroughId, stepId] = idOrIdPlusStepId.split('|'); + void openWalkthrough(this.container.context.extension.id, walkthroughId, stepId); + }), ]; }