Skip to content

Commit 6d8d1dc

Browse files
committed
Simplifies walkthrough state
1 parent 974a6a5 commit 6d8d1dc

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/webviews/apps/home/components/onboarding.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class GlOnboarding extends LitElement {
3131
private _openWalkthroughButton!: GlButton;
3232

3333
override render(): unknown {
34-
if (!this._state.showWalkthroughProgress) {
34+
if (this._state.walkthroughProgress == null) {
3535
return undefined;
3636
}
3737

@@ -71,7 +71,7 @@ export class GlOnboarding extends LitElement {
7171
}
7272

7373
private onDismissWalkthrough() {
74-
this._state.showWalkthroughProgress = false;
74+
this._state.walkthroughProgress = undefined;
7575
this.requestUpdate();
7676
this._ipc.sendCommand(DismissWalkthroughSection);
7777
}

src/webviews/home/homeWebview.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
606606
}
607607

608608
private getWalkthroughDismissed() {
609-
return Boolean(this.container.storage.get('home:walkthrough:dismissed'));
609+
return this.container.storage.get('home:walkthrough:dismissed') ?? false;
610610
}
611611

612612
private getPreviewCollapsed() {
@@ -663,12 +663,13 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
663663
integrationBannerCollapsed: this.getIntegrationBannerCollapsed(),
664664
integrations: integrations,
665665
hasAnyIntegrationConnected: anyConnected,
666-
walkthroughProgress: {
667-
allCount: this.container.walkthrough.walkthroughSize,
668-
doneCount: this.container.walkthrough.doneCount,
669-
progress: this.container.walkthrough.progress,
670-
},
671-
showWalkthroughProgress: !this.getWalkthroughDismissed(),
666+
walkthroughProgress: !this.getWalkthroughDismissed()
667+
? {
668+
allCount: this.container.walkthrough.walkthroughSize,
669+
doneCount: this.container.walkthrough.doneCount,
670+
progress: this.container.walkthrough.progress,
671+
}
672+
: undefined,
672673
previewEnabled: this.getPreviewEnabled(),
673674
newInstall: getContext('gitlens:install:new', false),
674675
};

src/webviews/home/protocol.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ export interface State extends WebviewState {
2828
integrations: IntegrationState[];
2929
avatar?: string;
3030
organizationsCount?: number;
31-
walkthroughProgress: {
31+
walkthroughProgress?: {
3232
doneCount: number;
3333
allCount: number;
3434
progress: number;
3535
};
36-
showWalkthroughProgress?: boolean;
3736
previewEnabled: boolean;
3837
newInstall: boolean;
3938
}

0 commit comments

Comments
 (0)