@@ -3,7 +3,7 @@ import { Disposable, workspace } from 'vscode';
33import type { CreatePullRequestActionContext } from '../../api/gitlens' ;
44import { getAvatarUriFromGravatarEmail } from '../../avatars' ;
55import type { OpenPullRequestOnRemoteCommandArgs } from '../../commands/openPullRequestOnRemote' ;
6- import { GlyphChars } from '../../constants' ;
6+ import { GlyphChars , urls } from '../../constants' ;
77import { Commands } from '../../constants.commands' ;
88import type { ContextKeys } from '../../constants.context' ;
99import type { HomeTelemetryContext } from '../../constants.telemetry' ;
@@ -30,7 +30,7 @@ import { getSettledValue } from '../../system/promise';
3030import { executeActionCommand , executeCommand , registerCommand } from '../../system/vscode/command' ;
3131import { configuration } from '../../system/vscode/configuration' ;
3232import { getContext , onDidChangeContext } from '../../system/vscode/context' ;
33- import { openWorkspace } from '../../system/vscode/utils' ;
33+ import { openUrl , openWorkspace } from '../../system/vscode/utils' ;
3434import type { IpcMessage } from '../protocol' ;
3535import type { WebviewHost , WebviewProvider , WebviewShowingArgs } from '../webviewProvider' ;
3636import 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
0 commit comments