Skip to content

Commit

Permalink
Update icon logic
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanW3 authored and Cepheid-UK committed Aug 12, 2022
1 parent 8283655 commit f8c48f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
12 changes: 3 additions & 9 deletions src/components/ladder/CountryRankingsGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -392,26 +392,20 @@ export default class CountryRankingsGrid extends Vue {
const playersInfo = ranking.playersInfo;
if (!playersInfo) return this.$t("races.RANDOM");
const playerInfo = playersInfo[playerIndex];
if (
CountryRankingsGrid.hasSelectedIcon(playerInfo) &&
playerInfo.selectedRace <= ERaceEnum.UNDEAD
) {
if (CountryRankingsGrid.hasSelectedIcon(playerInfo)) {
return this.$t(`races.${ERaceEnum[playerInfo.selectedRace]}`);
} else {
return this.$t(`races.${ERaceEnum[playerInfo.calculatedRace]}`);
}
}
private static hasSelectedIcon(playerInfo: PlayerInfo) {
if (
return (
playerInfo.selectedRace !== undefined &&
playerInfo.selectedRace != null &&
playerInfo.pictureId !== undefined &&
playerInfo.pictureId != null
) {
return playerInfo.selectedRace !== EAvatarCategory.TOTAL;
}
return false;
);
}
raceIcon(race: ERaceEnum) {
Expand Down
12 changes: 3 additions & 9 deletions src/components/ladder/RankingsGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,26 +364,20 @@ export default class RankingsGrid extends Vue {
const playersInfo = ranking.playersInfo;
if (!playersInfo) return "Random";
const playerInfo = playersInfo[playerIndex];
if (
RankingsGrid.hasSelectedIcon(playerInfo) &&
playerInfo.selectedRace <= ERaceEnum.UNDEAD
) {
if (RankingsGrid.hasSelectedIcon(playerInfo)) {
return this.$t(`races.${ERaceEnum[playerInfo.selectedRace]}`);
} else {
return this.$t(`races.${ERaceEnum[playerInfo.calculatedRace]}`);
}
}
private static hasSelectedIcon(playerInfo: PlayerInfo) {
if (
return (
playerInfo.selectedRace !== undefined &&
playerInfo.selectedRace != null &&
playerInfo.pictureId !== undefined &&
playerInfo.pictureId != null
) {
return playerInfo.selectedRace !== EAvatarCategory.TOTAL;
}
return false;
);
}
raceIcon(race: ERaceEnum) {
Expand Down

0 comments on commit f8c48f2

Please sign in to comment.