@@ -91,10 +91,18 @@ export class CompetitorScrambleDisplay extends HTMLElement {
9191 }
9292 }
9393
94+ #showingMultiScrambles( ) : boolean {
95+ return this . classList . contains ( "show-multi" ) ;
96+ }
97+
98+ #showingAllSubScrambles( ) : boolean {
99+ return ! this . querySelector ( "multi-blind-grid-display" ) . hidden ;
100+ }
101+
94102 #toggleShowAllSubScrambles( forceShow ?: boolean ) {
95103 if ( typeof forceShow === "undefined" ) {
96104 // biome-ignore lint/style/noParameterAssign: 🤷
97- forceShow = this . querySelector ( "multi-blind-grid-display" ) . hidden ;
105+ forceShow = this . #showingAllSubScrambles ( ) ;
98106 }
99107
100108 this . querySelector ( "twisty-player" ) . hidden = forceShow ;
@@ -146,6 +154,25 @@ export class CompetitorScrambleDisplay extends HTMLElement {
146154 markAsSigned ( ) {
147155 this . classList . add ( "scramble-signed" ) ;
148156 }
157+
158+ // - If showing an individual multi scramble:
159+ // - Advance to the next scramble, or to the "Show All" view.
160+ // - Else: Mark as signed
161+ advanceOrMarkAsSigned ( ) {
162+ console . log ( this . #showingMultiScrambles( ) , this . #showingAllSubScrambles( ) ) ;
163+ if ( this . #showingMultiScrambles( ) && ! this . #showingAllSubScrambles( ) ) {
164+ const showingLastSubScramble =
165+ this . #currentSubScrambleIndex ===
166+ this . #currentSubScrambleStrings. length - 1 ;
167+ if ( showingLastSubScramble ) {
168+ this . #toggleShowAllSubScrambles( true ) ;
169+ } else {
170+ this . #currentSubScrambleDelta( 1 ) ;
171+ }
172+ return ;
173+ }
174+ this . markAsSigned ( ) ;
175+ }
149176}
150177
151178customElements . define ( "competitor-scramble-display" , CompetitorScrambleDisplay ) ;
0 commit comments