Skip to content

Commit a788f5b

Browse files
committed
Simplifies walkthrough state
1 parent 25dbeac commit a788f5b

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
@@ -608,7 +608,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
608608
}
609609

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

614614
private getPreviewCollapsed() {
@@ -665,12 +665,13 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
665665
integrationBannerCollapsed: this.getIntegrationBannerCollapsed(),
666666
integrations: integrations,
667667
hasAnyIntegrationConnected: anyConnected,
668-
walkthroughProgress: {
669-
allCount: this.container.walkthrough.walkthroughSize,
670-
doneCount: this.container.walkthrough.doneCount,
671-
progress: this.container.walkthrough.progress,
672-
},
673-
showWalkthroughProgress: !this.getWalkthroughDismissed(),
668+
walkthroughProgress: !this.getWalkthroughDismissed()
669+
? {
670+
allCount: this.container.walkthrough.walkthroughSize,
671+
doneCount: this.container.walkthrough.doneCount,
672+
progress: this.container.walkthrough.progress,
673+
}
674+
: undefined,
674675
previewEnabled: this.getPreviewEnabled(),
675676
newInstall: getContext('gitlens:install:new', false),
676677
};

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)