@@ -22,6 +22,19 @@ import getGenericText from '@/util/getGenericText';
2222
2323type LoadingState = 'loading' | 'ready' | 'error' | 'noAutomatic' ;
2424
25+ function allianceDisplay ( match : PlayoffMatchDisplay , alliance : 'red' | 'blue' ) : string {
26+ if ( alliance === 'red' ) {
27+ if ( match . result ?. redAlliance ) return `Alliance ${ match . result . redAlliance } ` ;
28+ return getGenericText ( match . match ?. participants . red ) ;
29+ }
30+ if ( alliance === 'blue' ) {
31+ if ( match . result ?. blueAlliance ) return `Alliance ${ match . result . blueAlliance } ` ;
32+ return getGenericText ( match . match ?. participants . blue ) ;
33+ }
34+
35+ return '' ;
36+ }
37+
2538function PlayoffRow ( {
2639 event,
2740 showLine,
@@ -255,8 +268,8 @@ function PlayoffRow({
255268 < span className = { styles . nextMatchScroll } >
256269 { nextMatch ?. match && showLine !== null && (
257270 < AllianceFader
258- red = { getGenericText ( nextMatch ?. match ?. participants ?. red ) }
259- blue = { getGenericText ( nextMatch ?. match ?. participants ?. blue ) }
271+ red = { allianceDisplay ( nextMatch , ' red' ) }
272+ blue = { allianceDisplay ( nextMatch , ' blue' ) }
260273 showLine = { showLine }
261274 />
262275 ) }
@@ -276,8 +289,8 @@ function PlayoffRow({
276289 </ span >
277290 { x ?. match && showLine !== null && (
278291 < AllianceFader
279- red = { getGenericText ( x ?. match ?. participants ?. red ) }
280- blue = { getGenericText ( x ?. match ?. participants ?. blue ) }
292+ red = { allianceDisplay ( x , ' red' ) }
293+ blue = { allianceDisplay ( x , ' blue' ) }
281294 showLine = { showLine }
282295 />
283296 ) }
@@ -294,8 +307,8 @@ function PlayoffRow({
294307 < span >
295308 { queueingMatches [ 0 ] ?. match && showLine !== null && (
296309 < AllianceFader
297- red = { getGenericText ( queueingMatches [ 0 ] ?. match ?. participants ?. red ) }
298- blue = { getGenericText ( queueingMatches [ 0 ] ?. match ?. participants ?. blue ) }
310+ red = { allianceDisplay ( queueingMatches [ 0 ] , ' red' ) }
311+ blue = { allianceDisplay ( queueingMatches [ 0 ] , ' blue' ) }
299312 showLine = { showLine }
300313 />
301314 ) }
0 commit comments