fix bye week issue not showing favorites
This commit is contained in:
parent
6115b557c5
commit
72981d5e8a
1 changed files with 7 additions and 9 deletions
|
|
@ -145,24 +145,22 @@ class FavoritesManager {
|
||||||
const picker = document.getElementById('games-picker');
|
const picker = document.getElementById('games-picker');
|
||||||
if (!picker) return;
|
if (!picker) return;
|
||||||
|
|
||||||
if (this.allTeams.size === 0) {
|
|
||||||
picker.innerHTML = '<p style="color: var(--text-muted); font-size: 13px; text-align: center; padding: 16px;">No teams available</p>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
picker.innerHTML = '';
|
picker.innerHTML = '';
|
||||||
|
|
||||||
|
// Use all teams from TEAM_NAMES instead of only teams with games this week
|
||||||
|
const allTeamAbbrevs = Object.keys(TEAM_NAMES);
|
||||||
|
|
||||||
// Sort teams alphabetically by common name
|
// Sort teams alphabetically by common name
|
||||||
const sortedTeams = Array.from(this.allTeams).sort((a, b) => {
|
const sortedTeams = allTeamAbbrevs.sort((a, b) => {
|
||||||
const nameA = this.getTeamName(a);
|
const nameA = TEAM_NAMES[a];
|
||||||
const nameB = this.getTeamName(b);
|
const nameB = TEAM_NAMES[b];
|
||||||
return nameA.localeCompare(nameB);
|
return nameA.localeCompare(nameB);
|
||||||
});
|
});
|
||||||
|
|
||||||
sortedTeams.forEach(team => {
|
sortedTeams.forEach(team => {
|
||||||
const isSelected = this.favorites.includes(team);
|
const isSelected = this.favorites.includes(team);
|
||||||
const isDisabled = !isSelected && this.favorites.length >= MAX_FAVORITES;
|
const isDisabled = !isSelected && this.favorites.length >= MAX_FAVORITES;
|
||||||
const teamName = this.getTeamName(team);
|
const teamName = TEAM_NAMES[team];
|
||||||
|
|
||||||
const item = document.createElement('div');
|
const item = document.createElement('div');
|
||||||
item.className = 'game-picker-item';
|
item.className = 'game-picker-item';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue