Skip to content

Commit eb79337

Browse files
nzaytseveamodio
authored andcommitted
Fixes Clicking anywhere on "Get started" should expand the section #3386 (GLVSC-602)
1 parent 1f83086 commit eb79337

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

src/webviews/apps/home/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ <h1 class="alert__title">Untrusted workspace</h1>
166166
50% off GitLens Pro (plus entire the GitKraken DevEx platform) all for only $4/month
167167
</a>
168168
</div>
169-
<div id="section-walkthrough" class="alert">
169+
<div id="section-walkthrough" data-section-expand="walkthrough" class="alert">
170170
<h1 class="alert__title">Get Started with GitLens</h1>
171171
<div class="alert__description">
172172
<p>Explore all of the powerful features in GitLens</p>

src/webviews/apps/home/home.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ ul {
305305
opacity: 1;
306306
}
307307
}
308+
&.is-collapsed {
309+
cursor: pointer;
310+
&:hover {
311+
background-color: var(--color-alert-neutralHoverBackground);
312+
}
313+
}
308314

309315
&.is-collapsed &__description,
310316
&.is-collapsed &__close gl-tooltip:first-child,

src/webviews/apps/home/home.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class HomeApp extends App<State> {
4444
DOM.on('[data-section-toggle]', 'click', (e, target: HTMLElement) =>
4545
this.onSectionToggleClicked(e, target),
4646
),
47+
DOM.on('[data-section-expand]', 'click', (e, target: HTMLElement) =>
48+
this.onSectionExpandClicked(e, target),
49+
),
4750
);
4851

4952
return disposables;
@@ -100,17 +103,22 @@ export class HomeApp extends App<State> {
100103
}
101104
}
102105

103-
private onSectionToggleClicked(_e: MouseEvent, _target: HTMLElement) {
104-
// const section = target.dataset.sectionToggle;
105-
// if (section === 'walkthrough') {
106-
this.state.walkthroughCollapsed = !this.state.walkthroughCollapsed;
107-
this.setState(this.state);
108-
this.updateCollapsedSections(this.state.walkthroughCollapsed);
109-
this.sendCommand(CollapseSectionCommand, {
110-
section: 'walkthrough',
111-
collapsed: this.state.walkthroughCollapsed,
112-
});
113-
// }
106+
private onSectionToggleClicked(e: MouseEvent, target: HTMLElement) {
107+
e.stopImmediatePropagation();
108+
const section = target.dataset.sectionToggle;
109+
if (section !== 'walkthrough') {
110+
return;
111+
}
112+
113+
this.updateCollapsedSections(!this.state.walkthroughCollapsed);
114+
}
115+
116+
private onSectionExpandClicked(e: MouseEvent, target: HTMLElement) {
117+
const section = target.dataset.sectionExpand;
118+
if (section !== 'walkthrough') {
119+
return;
120+
}
121+
this.updateCollapsedSections(false);
114122
}
115123

116124
private updateNoRepo() {
@@ -165,7 +173,13 @@ export class HomeApp extends App<State> {
165173
}
166174

167175
private updateCollapsedSections(toggle = this.state.walkthroughCollapsed) {
176+
this.state.walkthroughCollapsed = toggle;
177+
this.setState({ walkthroughCollapsed: toggle });
168178
document.getElementById('section-walkthrough')!.classList.toggle('is-collapsed', toggle);
179+
this.sendCommand(CollapseSectionCommand, {
180+
section: 'walkthrough',
181+
collapsed: toggle,
182+
});
169183
}
170184

171185
private updateState() {

0 commit comments

Comments
 (0)