Skip to content

Commit 58e8b36

Browse files
committed
Adds header links to home and new install messaging
1 parent 1a0bacc commit 58e8b36

File tree

6 files changed

+153
-28
lines changed

6 files changed

+153
-28
lines changed

package.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8421,6 +8421,42 @@
84218421
"category": "GitLens",
84228422
"icon": "$(refresh)"
84238423
},
8424+
{
8425+
"command": "gitlens.views.home.disablePreview",
8426+
"title": "Revert to Old Home View",
8427+
"category": "GitLens",
8428+
"icon": "$(arrow-left)"
8429+
},
8430+
{
8431+
"command": "gitlens.views.home.previewFeedback",
8432+
"title": "New Home View Feedback",
8433+
"category": "GitLens",
8434+
"icon": "$(feedback)"
8435+
},
8436+
{
8437+
"command": "gitlens.views.home.whatsNew",
8438+
"title": "What's New (Release Notes)",
8439+
"category": "GitLens",
8440+
"icon": "$(megaphone)"
8441+
},
8442+
{
8443+
"command": "gitlens.views.home.help",
8444+
"title": "Help Center",
8445+
"category": "GitLens",
8446+
"icon": "$(question)"
8447+
},
8448+
{
8449+
"command": "gitlens.views.home.issues",
8450+
"title": "GitHub Issues",
8451+
"category": "GitLens",
8452+
"icon": "$(feedback)"
8453+
},
8454+
{
8455+
"command": "gitlens.views.home.discussions",
8456+
"title": "GitHub Discussions",
8457+
"category": "GitLens",
8458+
"icon": "$(comment-discussion)"
8459+
},
84248460
{
84258461
"command": "gitlens.views.launchpad.copy",
84268462
"title": "Copy",
@@ -12120,6 +12156,30 @@
1212012156
"command": "gitlens.views.home.refresh",
1212112157
"when": "false"
1212212158
},
12159+
{
12160+
"command": "gitlens.views.home.disablePreview",
12161+
"when": "false"
12162+
},
12163+
{
12164+
"command": "gitlens.views.home.previewFeedback",
12165+
"when": "false"
12166+
},
12167+
{
12168+
"command": "gitlens.views.home.whatsNew",
12169+
"when": "false"
12170+
},
12171+
{
12172+
"command": "gitlens.views.home.help",
12173+
"when": "false"
12174+
},
12175+
{
12176+
"command": "gitlens.views.home.issues",
12177+
"when": "false"
12178+
},
12179+
{
12180+
"command": "gitlens.views.home.discussions",
12181+
"when": "false"
12182+
},
1212312183
{
1212412184
"command": "gitlens.views.launchpad.copy",
1212512185
"when": "false"
@@ -14151,11 +14211,41 @@
1415114211
"when": "view == gitlens.views.scm.grouped",
1415214212
"group": "navigation@98"
1415314213
},
14214+
{
14215+
"command": "gitlens.views.home.previewFeedback",
14216+
"when": "view == gitlens.views.home",
14217+
"group": "navigation@97"
14218+
},
14219+
{
14220+
"command": "gitlens.views.home.disablePreview",
14221+
"when": "view == gitlens.views.home && config.gitlens.home.preview.enabled == true",
14222+
"group": "navigation@98"
14223+
},
1415414224
{
1415514225
"command": "gitlens.views.home.refresh",
1415614226
"when": "view == gitlens.views.home",
1415714227
"group": "navigation@99"
1415814228
},
14229+
{
14230+
"command": "gitlens.views.home.whatsNew",
14231+
"when": "view == gitlens.views.home",
14232+
"group": "navigation@1"
14233+
},
14234+
{
14235+
"command": "gitlens.views.home.help",
14236+
"when": "view == gitlens.views.home",
14237+
"group": "1_gitlens@97"
14238+
},
14239+
{
14240+
"command": "gitlens.views.home.issues",
14241+
"when": "view == gitlens.views.home",
14242+
"group": "2_gitlens@98"
14243+
},
14244+
{
14245+
"command": "gitlens.views.home.discussions",
14246+
"when": "view == gitlens.views.home",
14247+
"group": "2_gitlens@99"
14248+
},
1415914249
{
1416014250
"command": "gitlens.views.launchpad.refresh",
1416114251
"when": "view == gitlens.views.launchpad",

src/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ export const urls = Object.freeze({
169169
desktop: `https://gitkraken.com/git-client?${utm}`,
170170

171171
releaseNotes: `https://help.gitkraken.com/gitlens/gitlens-release-notes-current/?${utm}`,
172+
helpCenter: `https://help.gitkraken.com/gitlens/gitlens-home/?${utm}`,
173+
githubIssues: `https://github.com/gitkraken/vscode-gitlens/issues/?${utm}`,
174+
githubDiscussions: `https://github.com/gitkraken/vscode-gitlens/discussions/?${utm}`,
172175
});
173176

174177
export type WalkthroughSteps =

src/webviews/apps/home/components/preview-banner.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { consume } from '@lit/context';
22
import { css, html, LitElement, nothing } from 'lit';
33
import { customElement, query, state } from 'lit/decorators.js';
4+
import { when } from 'lit/directives/when.js';
45
import type { State } from '../../../home/protocol';
56
import { CollapseSectionCommand, TogglePreviewEnabledCommand } from '../../../home/protocol';
67
import { focusOutline } from '../../shared/components/styles/lit/a11y.css';
@@ -23,8 +24,7 @@ export class GlPreviewBanner extends LitElement {
2324
static override styles = [
2425
linkBase,
2526
css`
26-
.text-button,
27-
.feedback {
27+
.text-button {
2828
padding: 0.4rem 0.8rem;
2929
}
3030
@@ -48,6 +48,10 @@ export class GlPreviewBanner extends LitElement {
4848
gl-card::part(base) {
4949
margin-block-end: 1.2rem;
5050
}
51+
52+
.feedback {
53+
white-space: nowrap;
54+
}
5155
`,
5256
];
5357

@@ -65,6 +69,10 @@ export class GlPreviewBanner extends LitElement {
6569
@query('button')
6670
private _button!: HTMLButtonElement;
6771

72+
get isNewInstall() {
73+
return this._state.newInstall;
74+
}
75+
6876
override render() {
6977
if (this._state.previewEnabled !== true) {
7078
return html`
@@ -87,19 +95,26 @@ export class GlPreviewBanner extends LitElement {
8795

8896
return html`
8997
<gl-card>
90-
<p><strong>Welcome to the new Home View!</strong></p>
98+
<p><strong>Welcome to the ${this.isNewInstall ? 'GitLens ' : 'new '}Home View!</strong></p>
9199
<p>
92-
We've reimagined GitLens' Home to be a more helpful daily workflow tool. We're continuing to refine
93-
this experience and welcome your
94-
<a href="https://github.com/gitkraken/vscode-gitlens/discussions/3721"
100+
${this.isNewInstall
101+
? html`This is a hub for your current, future, and recent work. `
102+
: html`We've reimagined GitLens' Home to be a more helpful daily workflow tool. `}We're
103+
continuing to refine this experience and welcome your
104+
<a class="feedback" href="https://github.com/gitkraken/vscode-gitlens/discussions/3721"
95105
><code-icon icon="feedback"></code-icon> feedback</a
96106
>.
97107
</p>
98-
<button-container>
99-
<gl-button appearance="secondary" @click=${() => this.togglePreview(true)} full
100-
><code-icon icon="arrow-left"></code-icon> Revert to Old Home View</gl-button
101-
>
102-
</button-container>
108+
${when(
109+
!this.isNewInstall,
110+
() => html`
111+
<button-container>
112+
<gl-button appearance="secondary" @click=${() => this.togglePreview(true)} full
113+
><code-icon icon="arrow-left"></code-icon> Revert to Old Home View</gl-button
114+
>
115+
</button-container>
116+
`,
117+
)}
103118
<gl-button slot="actions" appearance="toolbar" tooltip="Dismiss Welcome" @click=${() => this.onClose()}
104119
><code-icon icon="close"></code-icon
105120
></gl-button>
@@ -111,7 +126,7 @@ export class GlPreviewBanner extends LitElement {
111126
this._ipc.sendCommand(TogglePreviewEnabledCommand);
112127

113128
if (dismiss) {
114-
this.onClose();
129+
this.closed = true;
115130
}
116131
}
117132

src/webviews/apps/home/home.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import '../plus/home/components/active-work';
1919
import '../plus/home/components/launchpad';
2020
import '../plus/home/components/overview';
2121
import './components/feature-nav';
22-
import './components/home-nav';
2322
import './components/integration-banner';
2423
import './components/onboarding';
2524
import './components/preview-banner';
@@ -70,13 +69,7 @@ export class GlHomeApp extends GlApp<State> {
7069
<div class="home scrollable">
7170
<aside class="home__aux">
7271
<gl-promo-banner></gl-promo-banner>
73-
${when(
74-
!this.state.previewEnabled,
75-
() => html`
76-
<gl-preview-banner></gl-preview-banner>
77-
<gl-home-nav></gl-home-nav>
78-
`,
79-
)}
72+
${when(!this.state.previewEnabled, () => html`<gl-preview-banner></gl-preview-banner>`)}
8073
</aside>
8174
<gl-repo-alerts class="home__header"></gl-repo-alerts>
8275
<main class="home__main scrollable" id="main">

src/webviews/home/homeWebview.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Disposable, workspace } from 'vscode';
33
import type { CreatePullRequestActionContext } from '../../api/gitlens';
44
import { getAvatarUriFromGravatarEmail } from '../../avatars';
55
import type { OpenPullRequestOnRemoteCommandArgs } from '../../commands/openPullRequestOnRemote';
6-
import { GlyphChars } from '../../constants';
6+
import { GlyphChars, urls } from '../../constants';
77
import { Commands } from '../../constants.commands';
88
import type { ContextKeys } from '../../constants.context';
99
import type { HomeTelemetryContext } from '../../constants.telemetry';
@@ -30,7 +30,7 @@ import { getSettledValue } from '../../system/promise';
3030
import { executeActionCommand, executeCommand, registerCommand } from '../../system/vscode/command';
3131
import { configuration } from '../../system/vscode/configuration';
3232
import { getContext, onDidChangeContext } from '../../system/vscode/context';
33-
import { openWorkspace } from '../../system/vscode/utils';
33+
import { openUrl, openWorkspace } from '../../system/vscode/utils';
3434
import type { IpcMessage } from '../protocol';
3535
import type { WebviewHost, WebviewProvider, WebviewShowingArgs } from '../webviewProvider';
3636
import type { WebviewShowOptions } from '../webviewsController';
@@ -245,6 +245,16 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
245245
),
246246
registerCommand(`${this.host.id}.publishBranch`, this.push, this),
247247
registerCommand(`${this.host.id}.refresh`, () => this.host.refresh(true), this),
248+
registerCommand(`${this.host.id}.disablePreview`, () => this.onTogglePreviewEnabled(false), this),
249+
registerCommand(
250+
`${this.host.id}.previewFeedback`,
251+
() => openUrl('https://github.com/gitkraken/vscode-gitlens/discussions/3721'),
252+
this,
253+
),
254+
registerCommand(`${this.host.id}.whatsNew`, () => openUrl(urls.releaseNotes), this),
255+
registerCommand(`${this.host.id}.help`, () => openUrl(urls.helpCenter), this),
256+
registerCommand(`${this.host.id}.issues`, () => openUrl(urls.githubIssues), this),
257+
registerCommand(`${this.host.id}.discussions`, () => openUrl(urls.githubDiscussions), this),
248258
registerCommand(
249259
`${this.host.id}.account.resync`,
250260
() => this.container.subscription.validate({ force: true }),
@@ -288,12 +298,9 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
288298
await this.onChooseRepository();
289299
void this.host.respond(ChangeOverviewRepository, e, undefined);
290300
break;
291-
case TogglePreviewEnabledCommand.is(e): {
292-
const isEnabled = !this.getPreviewEnabled();
293-
this.container.telemetry.sendEvent('home/preview/toggled', { enabled: isEnabled, version: 'v16' });
294-
configuration.updateEffective('home.preview.enabled', isEnabled);
301+
case TogglePreviewEnabledCommand.is(e):
302+
this.onTogglePreviewEnabled();
295303
break;
296-
}
297304
}
298305
}
299306

@@ -314,6 +321,21 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
314321
}
315322
}
316323

324+
private onTogglePreviewEnabled(isEnabled?: boolean) {
325+
if (isEnabled === undefined) {
326+
isEnabled = !this.getPreviewEnabled();
327+
}
328+
this.container.telemetry.sendEvent('home/preview/toggled', { enabled: isEnabled, version: 'v16' });
329+
configuration.updateEffective('home.preview.enabled', isEnabled);
330+
331+
if (!isEnabled) {
332+
this.onCollapseSection({
333+
section: 'newHomePreview',
334+
collapsed: true,
335+
});
336+
}
337+
}
338+
317339
private onCollapseSection(params: CollapseSectionParams) {
318340
const collapsed = this.container.storage.get('home:sections:collapsed');
319341
if (collapsed == null) {
@@ -395,6 +417,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
395417
},
396418
showWalkthroughProgress: !this.getWalkthroughDismissed(),
397419
previewEnabled: this.getPreviewEnabled(),
420+
newInstall: getContext('gitlens:newInstall', false),
398421
};
399422
}
400423

src/webviews/home/protocol.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export interface State extends WebviewState {
2424
progress: number;
2525
};
2626
showWalkthroughProgress?: boolean;
27-
previewEnabled?: boolean;
27+
previewEnabled: boolean;
28+
newInstall: boolean;
2829
}
2930

3031
export type OverviewRecentThreshold = 'OneDay' | 'OneWeek' | 'OneMonth';

0 commit comments

Comments
 (0)