Skip to content

Commit 2d58554

Browse files
committed
Fixes #4050 stops click-thru & double tooltip
Fixes source on open walkthrough command
1 parent 18f93f1 commit 2d58554

File tree

11 files changed

+74
-88
lines changed

11 files changed

+74
-88
lines changed

src/commands/quickCommand.steps.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,10 +2695,9 @@ export async function* ensureAccessStep<
26952695
detail: 'Click to learn more about Launchpad',
26962696
iconPath: new ThemeIcon('rocket'),
26972697
onDidSelect: () =>
2698-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
2698+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
26992699
step: 'accelerate-pr-reviews',
2700-
source: 'launchpad',
2701-
detail: 'info',
2700+
source: { source: 'launchpad', detail: 'info' },
27022701
}),
27032702
}),
27042703
createQuickPickSeparator(),

src/commands/walkthroughs.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { WalkthroughSteps } from '../constants';
22
import { urls } from '../constants';
3+
import type { GlCommands } from '../constants.commands';
34
import { GlCommand } from '../constants.commands';
45
import type { Source, Sources } from '../constants.telemetry';
56
import type { Container } from '../container';
@@ -16,18 +17,20 @@ export class GetStartedCommand extends GlCommandBase {
1617
execute(extensionIdOrsource?: Sources): void {
1718
// If the extensionIdOrsource is the same as the current extension, then it came from the extension content menu in the extension view, so don't pass the source
1819
const source = extensionIdOrsource !== this.container.context.extension.id ? undefined : extensionIdOrsource;
19-
openWalkthrough(this.container, source ? { source: source } : undefined);
20+
openWalkthrough(this.container, source ? { source: { source: source } } : undefined);
2021
}
2122
}
2223

23-
export interface OpenWalkthroughCommandArgs extends Source {
24+
export interface OpenWalkthroughCommandArgs {
2425
step?: WalkthroughSteps | undefined;
26+
source?: Source;
27+
detail?: string | undefined;
2528
}
2629

2730
@command()
2831
export class OpenWalkthroughCommand extends GlCommandBase {
2932
constructor(private readonly container: Container) {
30-
super(GlCommand.OpenWalkthrough);
33+
super('gitlens.openWalkthrough');
3134
}
3235

3336
execute(args?: OpenWalkthroughCommandArgs): void {
@@ -37,11 +40,7 @@ export class OpenWalkthroughCommand extends GlCommandBase {
3740

3841
function openWalkthrough(container: Container, args?: OpenWalkthroughCommandArgs) {
3942
if (container.telemetry.enabled) {
40-
container.telemetry.sendEvent(
41-
'walkthrough',
42-
{ step: args?.step },
43-
args?.source ? { source: args.source, detail: args?.detail } : undefined,
44-
);
43+
container.telemetry.sendEvent('walkthrough', { step: args?.step }, args?.source);
4544
}
4645

4746
void openWalkthroughCore(container.context.extension.id, 'welcome', args?.step, false);
@@ -55,13 +54,13 @@ export class WalkthroughOpenWalkthroughCommand extends GlCommandBase {
5554
}
5655

5756
execute(): void {
58-
const command = GlCommand.OpenWalkthrough;
57+
const command: GlCommands = 'gitlens.openWalkthrough';
5958
this.container.telemetry.sendEvent('walkthrough/action', {
6059
type: 'command',
6160
name: 'open/walkthrough',
6261
command: command,
6362
});
64-
executeCommand(command);
63+
executeCommand<OpenWalkthroughCommandArgs>(command, { source: { source: 'walkthrough' } });
6564
}
6665
}
6766

@@ -79,7 +78,7 @@ export class WalkthroughPlusUpgradeCommand extends GlCommandBase {
7978
name: 'plus/upgrade',
8079
command: command,
8180
});
82-
executeCommand(command, { source: 'walkthrough' });
81+
executeCommand<Source>(command, { source: 'walkthrough' });
8382
}
8483
}
8584

@@ -115,7 +114,7 @@ export class WalkthroughPlusSignUpCommand extends GlCommandBase {
115114
name: 'plus/sign-up',
116115
command: command,
117116
});
118-
executeCommand(command);
117+
executeCommand<Source>(command, { source: 'walkthrough' });
119118
}
120119
}
121120

@@ -132,7 +131,7 @@ export class WalkthroughPlusReactivateCommand extends GlCommandBase {
132131
name: 'plus/reactivate',
133132
command: command,
134133
});
135-
executeCommand(command);
134+
executeCommand<Source>(command, { source: 'walkthrough' });
136135
}
137136
}
138137

src/constants.commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export const enum GlCommand {
108108
OpenRevisionFile = 'gitlens.openRevisionFile',
109109
OpenRevisionFileInDiffLeft = 'gitlens.openRevisionFileInDiffLeft',
110110
OpenRevisionFileInDiffRight = 'gitlens.openRevisionFileInDiffRight',
111-
OpenWalkthrough = 'gitlens.openWalkthrough',
112111
OpenWorkingFile = 'gitlens.openWorkingFile',
113112
OpenWorkingFileInDiffLeft = 'gitlens.openWorkingFileInDiffLeft',
114113
OpenWorkingFileInDiffRight = 'gitlens.openWorkingFileInDiffRight',

src/plus/gk/subscriptionService.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -436,30 +436,30 @@ export class SubscriptionService implements Disposable {
436436
switch (subscription.state) {
437437
case SubscriptionState.VerificationRequired:
438438
case SubscriptionState.Community:
439-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
440-
...source,
439+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
441440
step: 'get-started-community',
441+
source: source,
442442
});
443443
break;
444444
case SubscriptionState.ProTrial:
445445
case SubscriptionState.ProPreview:
446-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
447-
...source,
446+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
448447
step: 'welcome-in-trial',
448+
source: source,
449449
});
450450
break;
451451
case SubscriptionState.ProTrialReactivationEligible:
452452
case SubscriptionState.ProTrialExpired:
453453
case SubscriptionState.ProPreviewExpired:
454-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
455-
...source,
454+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
456455
step: 'welcome-in-trial-expired',
456+
source: source,
457457
});
458458
break;
459459
case SubscriptionState.Paid:
460-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
461-
...source,
460+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
462461
step: 'welcome-paid',
462+
source: source,
463463
});
464464
break;
465465
}

src/plus/launchpad/launchpad.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
import { ensureAccessStep } from '../../commands/quickCommand.steps';
3737
import type { OpenWalkthroughCommandArgs } from '../../commands/walkthroughs';
3838
import { proBadge, urls } from '../../constants';
39-
import { GlCommand } from '../../constants.commands';
4039
import type { IntegrationId } from '../../constants.integrations';
4140
import { HostingIntegrationId, SelfHostedIntegrationId } from '../../constants.integrations';
4241
import type { LaunchpadTelemetryContext, Source, Sources, TelemetryEvents } from '../../constants.telemetry';
@@ -1181,10 +1180,9 @@ export class LaunchpadCommand extends QuickCommand<State> {
11811180
detail: 'Click to learn more about Launchpad',
11821181
iconPath: new ThemeIcon('rocket'),
11831182
onDidSelect: () =>
1184-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
1183+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
11851184
step: 'accelerate-pr-reviews',
1186-
source: 'launchpad',
1187-
detail: 'info',
1185+
source: { source: 'launchpad', detail: 'info' },
11881186
}),
11891187
}),
11901188
createQuickPickSeparator(),
@@ -1257,10 +1255,9 @@ export class LaunchpadCommand extends QuickCommand<State> {
12571255
detail: 'Click to learn more about Launchpad',
12581256
iconPath: new ThemeIcon('rocket'),
12591257
onDidSelect: () =>
1260-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
1258+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
12611259
step: 'accelerate-pr-reviews',
1262-
source: 'launchpad',
1263-
detail: 'info',
1260+
source: { source: 'launchpad', detail: 'info' },
12641261
}),
12651262
}),
12661263
createQuickPickSeparator(),

src/plus/launchpad/launchpadIndicator.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,9 @@ export class LaunchpadIndicator implements Disposable {
540540
this.storeFirstInteractionIfNeeded();
541541
switch (action) {
542542
case 'info': {
543-
void executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
543+
void executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
544544
step: 'accelerate-pr-reviews',
545-
source: 'launchpad-indicator',
546-
detail: 'info',
545+
source: { source: 'launchpad-indicator', detail: 'info' },
547546
});
548547
break;
549548
}

src/views/draftsView.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ export class DraftsView extends ViewBase<'drafts', DraftsViewNode, DraftsViewCon
120120
registerViewCommand(
121121
this.getQualifiedCommand('info'),
122122
() =>
123-
executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
123+
executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
124124
step: 'streamline-collaboration',
125-
source: 'cloud-patches',
126-
detail: 'info',
125+
source: { source: 'cloud-patches', detail: 'info' },
127126
}),
128127
this,
129128
),

src/views/launchpadView.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,9 @@ export class LaunchpadView extends ViewBase<'launchpad', LaunchpadViewNode, Laun
267267
registerViewCommand(
268268
this.getQualifiedCommand('info'),
269269
() =>
270-
executeCommand<OpenWalkthroughCommandArgs>(GlCommand.OpenWalkthrough, {
270+
executeCommand<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
271271
step: 'accelerate-pr-reviews',
272-
source: 'launchpad-view',
273-
detail: 'info',
272+
source: { source: 'launchpad-view', detail: 'info' },
274273
}),
275274
this,
276275
),

src/webviews/apps/home/components/feature-nav.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { consume } from '@lit/context';
22
import { css, html } from 'lit';
33
import { customElement, property, state } from 'lit/decorators.js';
44
import { when } from 'lit/directives/when.js';
5+
import type { OpenWalkthroughCommandArgs } from '../../../../commands/walkthroughs';
56
import type { Source } from '../../../../constants.telemetry';
7+
import { createCommandLink } from '../../../../system/commands';
68
import type { State } from '../../../home/protocol';
79
import { GlElement } from '../../shared/components/element';
810
import { linkBase } from '../../shared/components/styles/lit/base.css';
@@ -184,7 +186,10 @@ export class GlFeatureNav extends GlElement {
184186
<div class="nav-list__item">
185187
<a
186188
class="nav-list__link${this.blockRepoFeatures ? ' is-disabled' : ''}"
187-
href="command:gitlens.openWalkthrough?%7B%22step%22%3A%22code-collab%22,%22source%22%3A%22home%22%7D"
189+
href="${createCommandLink<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
190+
step: 'streamline-collaboration',
191+
source: { source: 'home' },
192+
})}"
188193
data-requires="repo"
189194
data-org-requires="drafts"
190195
aria-label="Open Code Suggest walkthrough"
Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { consume } from '@lit/context';
2-
import { html, LitElement, nothing } from 'lit';
3-
import { customElement, property, query, state } from 'lit/decorators.js';
2+
import { html, LitElement } from 'lit';
3+
import { customElement, state } from 'lit/decorators.js';
4+
import type { OpenWalkthroughCommandArgs } from '../../../../commands/walkthroughs';
45
import { createCommandLink } from '../../../../system/commands';
56
import type { State } from '../../../home/protocol';
67
import { DismissWalkthroughSection } from '../../../home/protocol';
7-
import type { GlButton } from '../../shared/components/button';
88
import { ipcContext } from '../../shared/contexts/ipc';
99
import type { HostIpc } from '../../shared/ipc';
1010
import { stateContext } from '../context';
1111
import { homeBaseStyles, walkthroughProgressStyles } from '../home.css';
12+
import '../../shared/components/button';
1213
import '../../shared/components/code-icon';
1314
import '../../shared/components/overlays/tooltip';
1415

@@ -24,55 +25,42 @@ export class GlOnboarding extends LitElement {
2425
@state()
2526
private _ipc!: HostIpc;
2627

27-
@property({ type: Boolean })
28-
private slim = false;
29-
30-
@query('#open-walkthrough')
31-
private _openWalkthroughButton!: GlButton;
32-
3328
override render(): unknown {
34-
if (this._state.walkthroughProgress == null) {
35-
return undefined;
36-
}
29+
if (this._state.walkthroughProgress == null) return undefined;
3730

38-
return html`
31+
return html`<gl-button
32+
@click=${this.onDismissWalkthrough}
33+
class="walkthrough-progress__button"
34+
appearance="toolbar"
35+
tooltip="Dismiss"
36+
aria-label="Dismiss"
37+
><code-icon icon="x"></code-icon
38+
></gl-button>
3939
<gl-tooltip placement="bottom" content="Open Walkthrough">
40-
<a href=${createCommandLink('gitlens.openWalkthrough', {})}>
41-
<section class="walkthrough-progress">
42-
${!this.slim
43-
? html`
44-
<header class="walkthrough-progress__title">
45-
<span
46-
>GitLens Walkthrough
47-
(${this._state.walkthroughProgress.doneCount}/${this._state
48-
.walkthroughProgress.allCount})</span
49-
>
50-
<nav>
51-
<gl-button
52-
@click=${this.onDismissWalkthrough.bind(this)}
53-
class="walkthrough-progress__button"
54-
appearance="toolbar"
55-
tooltip="Dismiss"
56-
aria-label="Dismiss"
57-
><code-icon icon="x"></code-icon
58-
></gl-button>
59-
</nav>
60-
</header>
61-
`
62-
: nothing}
63-
<progress
64-
class="walkthrough-progress__bar"
65-
value=${this._state.walkthroughProgress.progress}
66-
></progress>
67-
</section>
40+
<a
41+
class="walkthrough-progress"
42+
href=${createCommandLink<OpenWalkthroughCommandArgs>('gitlens.openWalkthrough', {
43+
source: { source: 'home', detail: 'onboarding' },
44+
})}
45+
>
46+
<header class="walkthrough-progress__title">
47+
<span
48+
>GitLens Walkthrough
49+
(${this._state.walkthroughProgress.doneCount}/${this._state.walkthroughProgress
50+
.allCount})</span
51+
>
52+
</header>
53+
<progress
54+
class="walkthrough-progress__bar"
55+
value=${this._state.walkthroughProgress.progress}
56+
></progress>
6857
</a>
69-
</gl-tooltip>
70-
`;
58+
</gl-tooltip>`;
7159
}
7260

73-
private onDismissWalkthrough() {
61+
private onDismissWalkthrough = () => {
7462
this._state.walkthroughProgress = undefined;
75-
this.requestUpdate();
7663
this._ipc.sendCommand(DismissWalkthroughSection);
77-
}
64+
this.requestUpdate();
65+
};
7866
}

0 commit comments

Comments
 (0)