@@ -208,7 +208,7 @@ export class BracketsViewer {
208
208
const data : number | string = item [ prop ] ;
209
209
210
210
if ( prop === 'id' ) {
211
- const participant = this . participants . find ( team => team . id === data ) ;
211
+ const participant = this . participants . find ( participant => participant . id === data ) ;
212
212
213
213
if ( participant !== undefined ) {
214
214
const cell = dom . createCell ( participant . name ) ;
@@ -269,108 +269,106 @@ export class BracketsViewer {
269
269
inLowerBracket = inLowerBracket || false ;
270
270
271
271
const match = dom . createMatchContainer ( ) ;
272
- const teams = dom . createTeamsContainer ( ) ;
272
+ const opponents = dom . createOpponentsContainer ( ) ;
273
273
274
274
const team1 = this . createTeam ( results . opponent1 , hint , inLowerBracket ) ;
275
275
const team2 = this . createTeam ( results . opponent2 , hint , inLowerBracket ) ;
276
276
277
277
if ( label )
278
- teams . append ( dom . createMatchLabel ( label , lang . getMatchStatus ( results . status ) ) ) ;
278
+ opponents . append ( dom . createMatchLabel ( label , lang . getMatchStatus ( results . status ) ) ) ;
279
279
280
- teams . append ( team1 , team2 ) ;
281
- match . append ( teams ) ;
280
+ opponents . append ( team1 , team2 ) ;
281
+ match . append ( opponents ) ;
282
282
283
283
if ( ! connection )
284
284
return match ;
285
285
286
- dom . setupConnection ( teams , match , connection ) ;
286
+ dom . setupConnection ( opponents , match , connection ) ;
287
287
288
288
return match ;
289
289
}
290
290
291
- // TODO: get rid of the word "team"
292
-
293
291
/**
294
- * Creates a team for a match.
292
+ * Creates a participant for a match.
295
293
*
296
- * @param team Information about the team .
294
+ * @param participant Information about the participant .
297
295
* @param hint Hint of the match.
298
296
* @param inLowerBracket Whether the match is in lower bracket.
299
297
*/
300
- private createTeam ( team : ParticipantResult | null , hint : MatchHint , inLowerBracket : boolean ) : HTMLElement {
301
- const teamContainer = dom . createTeamContainer ( ) ;
298
+ private createTeam ( participant : ParticipantResult | null , hint : MatchHint , inLowerBracket : boolean ) : HTMLElement {
299
+ const participantContainer = dom . createParticipantContainer ( ) ;
302
300
const nameContainer = dom . createNameContainer ( ) ;
303
301
const resultContainer = dom . createResultContainer ( ) ;
304
302
305
- if ( team === null )
303
+ if ( participant === null )
306
304
nameContainer . innerText = 'BYE' ;
307
305
else
308
- this . renderParticipant ( teamContainer , nameContainer , resultContainer , team , hint , inLowerBracket ) ;
306
+ this . renderParticipant ( participantContainer , nameContainer , resultContainer , participant , hint , inLowerBracket ) ;
309
307
310
- teamContainer . append ( nameContainer , resultContainer ) ;
308
+ participantContainer . append ( nameContainer , resultContainer ) ;
311
309
312
- if ( team && team . id !== null )
313
- this . setupMouseHover ( team . id , teamContainer ) ;
310
+ if ( participant && participant . id !== null )
311
+ this . setupMouseHover ( participant . id , participantContainer ) ;
314
312
315
- return teamContainer ;
313
+ return participantContainer ;
316
314
}
317
315
318
316
/**
319
317
* Renders a participant.
320
318
*
321
- * @param teamContainer The team container.
319
+ * @param participantContainer The participant container.
322
320
* @param nameContainer The name container.
323
321
* @param resultContainer The result container.
324
- * @param team The participant result.
322
+ * @param participant The participant result.
325
323
* @param hint Hint for the participant.
326
324
* @param inLowerBracket Whether the match is in lower bracket.
327
325
*/
328
- private renderParticipant ( teamContainer : HTMLElement , nameContainer : HTMLElement , resultContainer : HTMLElement , team : ParticipantResult , hint : MatchHint , inLowerBracket : boolean ) : void {
329
- const participant = this . participants . find ( item => item . id === team . id ) ;
326
+ private renderParticipant ( participantContainer : HTMLElement , nameContainer : HTMLElement , resultContainer : HTMLElement , participant : ParticipantResult , hint : MatchHint , inLowerBracket : boolean ) : void {
327
+ const found = this . participants . find ( item => item . id === participant . id ) ;
330
328
331
- if ( participant ) {
332
- nameContainer . innerText = participant . name ;
333
- this . renderTeamOrigin ( nameContainer , team , inLowerBracket ) ;
329
+ if ( found ) {
330
+ nameContainer . innerText = found . name ;
331
+ this . renderTeamOrigin ( nameContainer , participant , inLowerBracket ) ;
334
332
} else
335
- this . renderHint ( nameContainer , team , hint , inLowerBracket ) ;
333
+ this . renderHint ( nameContainer , participant , hint , inLowerBracket ) ;
336
334
337
- resultContainer . innerText = `${ team . score || '-' } ` ;
335
+ resultContainer . innerText = `${ participant . score || '-' } ` ;
338
336
339
- dom . setupWin ( teamContainer , resultContainer , team ) ;
340
- dom . setupLoss ( teamContainer , resultContainer , team ) ;
337
+ dom . setupWin ( participantContainer , resultContainer , participant ) ;
338
+ dom . setupLoss ( participantContainer , resultContainer , participant ) ;
341
339
}
342
340
343
341
/**
344
342
* Renders a hint for a participant.
345
343
*
346
344
* @param nameContainer The name container.
347
- * @param team The participant result.
345
+ * @param participant The participant result.
348
346
* @param hint Hint for the participant.
349
347
* @param inLowerBracket Whether the match is in lower bracket.
350
348
*/
351
- private renderHint ( nameContainer : HTMLElement , team : ParticipantResult , hint : MatchHint , inLowerBracket : boolean ) : void {
352
- if ( hint === undefined || team . position === undefined ) return ;
349
+ private renderHint ( nameContainer : HTMLElement , participant : ParticipantResult , hint : MatchHint , inLowerBracket : boolean ) : void {
350
+ if ( hint === undefined || participant . position === undefined ) return ;
353
351
if ( ! this . config . showSlotsOrigin ) return ;
354
352
if ( ! this . config . showLowerBracketSlotsOrigin && inLowerBracket ) return ;
355
353
356
- dom . setupHint ( nameContainer , hint ( team . position ) ) ;
354
+ dom . setupHint ( nameContainer , hint ( participant . position ) ) ;
357
355
}
358
356
359
357
/**
360
358
* Renders a participant's origin.
361
359
*
362
360
* @param nameContainer The name container.
363
- * @param team The participant result.
361
+ * @param participant The participant result.
364
362
* @param inLowerBracket Whether the match is in lower bracket.
365
363
*/
366
- private renderTeamOrigin ( nameContainer : HTMLElement , team : ParticipantResult , inLowerBracket : boolean ) : void {
367
- if ( team . position === undefined ) return ;
364
+ private renderTeamOrigin ( nameContainer : HTMLElement , participant : ParticipantResult , inLowerBracket : boolean ) : void {
365
+ if ( participant . position === undefined ) return ;
368
366
if ( this . config . participantOriginPlacement === 'none' ) return ;
369
367
if ( ! this . config . showSlotsOrigin ) return ;
370
368
if ( ! this . config . showLowerBracketSlotsOrigin && inLowerBracket ) return ;
371
369
372
370
// 'P' for position (where the participant comes from) and '#' for actual seeding.
373
- const origin = inLowerBracket ? `P${ team . position } ` : `#${ team . position } ` ;
371
+ const origin = inLowerBracket ? `P${ participant . position } ` : `#${ participant . position } ` ;
374
372
375
373
dom . addTeamOrigin ( nameContainer , origin , this . config . participantOriginPlacement ) ;
376
374
}
0 commit comments