@@ -44,6 +44,9 @@ export class HomeApp extends App<State> {
44
44
DOM . on ( '[data-section-toggle]' , 'click' , ( e , target : HTMLElement ) =>
45
45
this . onSectionToggleClicked ( e , target ) ,
46
46
) ,
47
+ DOM . on ( '[data-section-expand]' , 'click' , ( e , target : HTMLElement ) =>
48
+ this . onSectionExpandClicked ( e , target ) ,
49
+ ) ,
47
50
) ;
48
51
49
52
return disposables ;
@@ -100,17 +103,22 @@ export class HomeApp extends App<State> {
100
103
}
101
104
}
102
105
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 ) ;
114
122
}
115
123
116
124
private updateNoRepo ( ) {
@@ -165,7 +173,13 @@ export class HomeApp extends App<State> {
165
173
}
166
174
167
175
private updateCollapsedSections ( toggle = this . state . walkthroughCollapsed ) {
176
+ this . state . walkthroughCollapsed = toggle ;
177
+ this . setState ( { walkthroughCollapsed : toggle } ) ;
168
178
document . getElementById ( 'section-walkthrough' ) ! . classList . toggle ( 'is-collapsed' , toggle ) ;
179
+ this . sendCommand ( CollapseSectionCommand , {
180
+ section : 'walkthrough' ,
181
+ collapsed : toggle ,
182
+ } ) ;
169
183
}
170
184
171
185
private updateState ( ) {
0 commit comments