Browse Source

Adds deep links from Home into walkthroughs

main
Eric Amodio 2 years ago
parent
commit
4a546b5ab5
4 changed files with 82 additions and 31 deletions
  1. +10
    -15
      src/commands/getStarted.ts
  2. +12
    -0
      src/system/utils.ts
  3. +55
    -15
      src/webviews/apps/premium/home/home.html
  4. +5
    -1
      src/webviews/premium/home/homeWebviewView.ts

+ 10
- 15
src/commands/getStarted.ts View File

@ -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');
}
}

+ 12
- 0
src/system/utils.ts View File

@ -120,6 +120,18 @@ export async function openEditor(
}
}
export async function openWalkthrough(extensionId: string, walkthroughId: string, stepId?: string): Promise<void> {
// 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',

+ 55
- 15
src/webviews/apps/premium/home/home.html View File

@ -142,9 +142,17 @@
<section>
<h3>Try GitLens Premium Features</h3>
<p>
Premium features like <a href="">Git Worktrees</a> and <a href="">Visual File History</a> 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
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>
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.
</p>
<p>
You can try these premium features for free, without an account, for 3 days. All non-premium features
@ -166,8 +174,14 @@
<section>
<h3>Trying Premium Features</h3>
<p>
You are currently trying premium GitLens features, like <a href="">Git Worktrees</a> and
<a href="">Visual File History</a>, for <span data-bind="previewDays">3 more days</span>.
You are currently trying premium GitLens features, like
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>, for <span data-bind="previewDays">3 more days</span>.
</p>
<p>
After that time, a free account will be required to continue using these premium features for public
@ -187,9 +201,15 @@
<section>
<h3>Continue using Premium Features</h3>
<p>
Premium GitLens features like <a href="">Git Worktrees</a> and <a href="">Visual File History</a>, a
commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with an
account.
Premium GitLens features like
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>, a commit graph (coming soon), and GitHub Enterprise integration (coming soon) are only available with
an account.
</p>
<p>Create a free account to continue trialing premium features for all code for an additional 7 days.</p>
<vscode-button data-action="command:gitlens.learnAboutPremium">Learn about premium features</vscode-button>
@ -206,10 +226,16 @@
<section>
<h3>Premium Feature Trial</h3>
<p>
You are currently trialing premium GitLens features like <a href="">Git Worktrees</a> and
<a href="">Visual File History</a> for both public and private repos. In
<span data-bind="trialDays">7 days</span>, accessing these premium features for private repos will
require a paid account.
You are currently trialing premium GitLens features like
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>
for both public and private repos. In <span data-bind="trialDays">7 days</span>, accessing these premium
features for private repos will require a paid account.
</p>
<vscode-button data-action="command:gitlens.learnAboutPremium">Learn about premium features</vscode-button>
<vscode-button data-action="command:gitlens.premium.purchase">Purchase a plan</vscode-button>
@ -237,8 +263,15 @@
<h3>GitLens Free+</h3>
<p>
With your free account, you have access to GitLens Free+, which unlocks premium features like
<a href="">Git Worktrees</a> and <a href="">Visual File History</a> for public repos. More premium
features like a commit graph and GitHub Enterprise integration are coming soon.
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>
for public repos. More premium features like a commit graph and GitHub Enterprise integration are coming
soon.
</p>
<p>Access to premium features for private repos requires a paid plan.</p>
<vscode-button data-action="command:gitlens.learnAboutPremium">Learn about premium features</vscode-button>
@ -252,7 +285,14 @@
<p>
Thank you for purchasing <span data-bind="plan">GitLens Pro</span>! With a
<span data-bind="plan">GitLens Pro</span> account, you can access premium features like
<a href="">Git Worktrees</a> and <a href="">Visual File History</a> for all of your code.
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.worktrees%22"
>Git Worktrees</a
>
and
<a href="command:gitlens.home.openWalkthrough?%22gitlens.premium%7Cgitlens.premium.visualFileHistory%22"
>Visual File History</a
>
for all of your code.
</p>
<p>Additional premium featues like a commit graph and GitHub Enterprise integration are coming soon.</p>
<vscode-button data-action="command:gitlens.learnAboutPremium">Learn about premium features</vscode-button>

+ 5
- 1
src/webviews/premium/home/homeWebviewView.ts View File

@ -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);
}),
];
}

Loading…
Cancel
Save