mirror of
https://github.com/LucasKalil-Programador/world-2026-hub.git
synced 2026-07-04 17:41:28 -03:00
fix(hero): resolve knockout matchup teams (R32+ showed "A definir")
The home hero read match.homeTeam/awayTeam directly; knockout matches (ids 73-104) carry only bracketRef and resolve teams at runtime, so once the next match became an R32 game the hero showed "A definir vs A definir". Resolve via resolveBracketTeams(match) like schedule cards and the modal; heroTeamHTML now takes a {team,label} slot.
This commit is contained in:
parent
0a2010691f
commit
7b404e678f
1 changed files with 11 additions and 8 deletions
|
|
@ -8,7 +8,7 @@ import { initSchedule } from './schedule.js';
|
||||||
import { initGroups } from './groups.js';
|
import { initGroups } from './groups.js';
|
||||||
import { initStadiums } from './stadiums.js';
|
import { initStadiums } from './stadiums.js';
|
||||||
import { initModal } from './modal.js';
|
import { initModal } from './modal.js';
|
||||||
import { initBracket, invalidateBracket } from './bracket.js';
|
import { initBracket, invalidateBracket, resolveBracketTeams } from './bracket.js';
|
||||||
import { initStats } from './stats.js';
|
import { initStats } from './stats.js';
|
||||||
|
|
||||||
// ---------------------------------------------------------------- data
|
// ---------------------------------------------------------------- data
|
||||||
|
|
@ -298,13 +298,15 @@ function heroSignature(featured, now) {
|
||||||
.join('|');
|
.join('|');
|
||||||
}
|
}
|
||||||
|
|
||||||
function heroTeamHTML(teamId) {
|
// Accepts a resolved slot ({ team, label }) from resolveBracketTeams, so the hero
|
||||||
const team = data.teamById.get(teamId);
|
// works for knockout matches (which carry bracketRef, not teams) the same way the
|
||||||
if (!team) return `<div class="hero-team"><span class="hero-team-name">${t('app.tbd')}</span></div>`;
|
// schedule cards and modal do — falls back to the slot's label when unresolved.
|
||||||
|
function heroTeamHTML(slot) {
|
||||||
|
if (!slot.team) return `<div class="hero-team"><span class="hero-team-name">${slot.label}</span></div>`;
|
||||||
return `
|
return `
|
||||||
<div class="hero-team">
|
<div class="hero-team">
|
||||||
<img class="flag flag-lg" src="${flagSrc(team)}" alt="" width="64" height="43">
|
<img class="flag flag-lg" src="${flagSrc(slot.team)}" alt="" width="64" height="43">
|
||||||
<span class="hero-team-name">${team.name}</span>
|
<span class="hero-team-name">${slot.team.name}</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,11 +333,12 @@ function heroMatchupHTML(match, now, multi) {
|
||||||
? `${match.stadium}, ${match.city}`
|
? `${match.stadium}, ${match.city}`
|
||||||
: `${formatMatchTime(match, stadium)} · ${match.stadium}, ${match.city}`;
|
: `${formatMatchTime(match, stadium)} · ${match.stadium}, ${match.city}`;
|
||||||
|
|
||||||
|
const slots = resolveBracketTeams(match);
|
||||||
return `
|
return `
|
||||||
<div class="hero-matchup">
|
<div class="hero-matchup">
|
||||||
${heroTeamHTML(match.homeTeam)}
|
${heroTeamHTML(slots.home)}
|
||||||
${center}
|
${center}
|
||||||
${heroTeamHTML(match.awayTeam)}
|
${heroTeamHTML(slots.away)}
|
||||||
</div>
|
</div>
|
||||||
<p class="hero-meta">${meta}</p>`;
|
<p class="hero-meta">${meta}</p>`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue