Skip to content

Commit

Permalink
Simplifies walkthrough state
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Jan 27, 2025
1 parent 926b9c5 commit 2f303f2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/webviews/apps/home/components/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class GlOnboarding extends LitElement {
private _openWalkthroughButton!: GlButton;

override render(): unknown {
if (!this._state.showWalkthroughProgress) {
if (this._state.walkthroughProgress == null) {
return undefined;
}

Expand Down Expand Up @@ -71,7 +71,7 @@ export class GlOnboarding extends LitElement {
}

private onDismissWalkthrough() {
this._state.showWalkthroughProgress = false;
this._state.walkthroughProgress = undefined;
this.requestUpdate();
this._ipc.sendCommand(DismissWalkthroughSection);
}
Expand Down
15 changes: 8 additions & 7 deletions src/webviews/home/homeWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
}

private getWalkthroughDismissed() {
return Boolean(this.container.storage.get('home:walkthrough:dismissed'));
return this.container.storage.get('home:walkthrough:dismissed') ?? false;
}

private getPreviewCollapsed() {
Expand Down Expand Up @@ -664,12 +664,13 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
integrationBannerCollapsed: this.getIntegrationBannerCollapsed(),
integrations: integrations,
hasAnyIntegrationConnected: anyConnected,
walkthroughProgress: {
allCount: this.container.walkthrough.walkthroughSize,
doneCount: this.container.walkthrough.doneCount,
progress: this.container.walkthrough.progress,
},
showWalkthroughProgress: !this.getWalkthroughDismissed(),
walkthroughProgress: !this.getWalkthroughDismissed()
? {
allCount: this.container.walkthrough.walkthroughSize,
doneCount: this.container.walkthrough.doneCount,
progress: this.container.walkthrough.progress,
}
: undefined,
previewEnabled: this.getPreviewEnabled(),
newInstall: getContext('gitlens:install:new', false),
};
Expand Down
3 changes: 1 addition & 2 deletions src/webviews/home/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ export interface State extends WebviewState {
integrations: IntegrationState[];
avatar?: string;
organizationsCount?: number;
walkthroughProgress: {
walkthroughProgress?: {
doneCount: number;
allCount: number;
progress: number;
};
showWalkthroughProgress?: boolean;
previewEnabled: boolean;
newInstall: boolean;
}
Expand Down

0 comments on commit 2f303f2

Please sign in to comment.