@@ -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