@@ -587,7 +587,10 @@ function write_gamestart() {
587587
588588 const default_col = "white" ;
589589
590- const teams_cur = get_teams ( md . games [ md . meta . game . index ] ?? null ) ;
590+ console . log ( md . games ) ;
591+ console . log ( md . meta ) ;
592+ const teams_cur = get_teams ( md . games [ md . meta . game . index ] ) ;
593+ console . log ( teams_cur ) ;
591594 const left_col_cur = teams_cur [ 0 ] ?. color ?? default_col ;
592595 const right_col_cur = teams_cur [ 1 ] ?. color ?? default_col ;
593596
@@ -596,9 +599,9 @@ function write_gamestart() {
596599 const t2_keeper = teams_cur [ 1 ] ?. players . find ( p => p . role === "keeper" ) ?. name ?? "[???]" ;
597600 const t2_field = teams_cur [ 1 ] ?. players . find ( p => p . role === "field" ) ?. name ?? "[???]" ;
598601
599- const teams_next = get_teams ( md . games [ md . meta . game . index + 1 ] ?? null ) ;
600- const left_col_next = teams_next [ 0 ] ?. color ?? default_col ;
601- const right_col_next = teams_next [ 1 ] ?. color ?? default_col ;
602+ const teams_next = md . meta . game . index + 1 < md . games . length ? get_teams ( md . games [ md . meta . game . index + 1 ] ) : null ;
603+ const left_col_next = teams_next ?. [ 0 ] ?. color ?? default_col ;
604+ const right_col_next = teams_next ?. [ 1 ] ?. color ?? default_col ;
602605
603606 const t1_name_el = document . createElement ( "div" ) ;
604607 t1_name_el . classList . add ( "bordered" ) ;
@@ -642,7 +645,7 @@ function write_gamestart() {
642645 gamestart_t2 . appendChild ( t2_keeper_el ) ;
643646 gamestart_t2 . appendChild ( t2_field_el ) ;
644647
645- if ( teams_next [ 0 ] == null && teams_next [ 1 ] == null ) gamestart_next . style . display = "none" ;
648+ if ( teams_next ?. [ 0 ] == null && teams_next ?. [ 1 ] == null ) gamestart_next . style . display = "none" ;
646649 else {
647650 gamestart_next . style . display = "block" ;
648651 gamestart_next_t1 . innerHTML = teams_next [ 0 ] ?. name . toString ( ) ?? "[???]" ;
0 commit comments