Skip to content

Commit

Permalink
Show raid details even if image is missing. (#2417)
Browse files Browse the repository at this point in the history
* show raid details with missing pokemonWithImages

* change to single block with variable

* Fix raidImage scope.
  • Loading branch information
BrownSlaughter authored and sebastienvercammen committed Jan 16, 2018
1 parent e3176d9 commit 2feff94
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const excludedRaritiesList = [
['common', 'uncommon', 'rare', 'very rare', 'ultra rare']
]


/*
text place holders:
<pkm> - pokemon name
Expand Down Expand Up @@ -710,44 +709,38 @@ function gymLabel(gym, includeMembers = true) {
if ((isUpcomingRaid || isRaidStarted) && isRaidFilterOn && isGymSatisfiesRaidMinMaxFilter(raid)) {
const raidColor = ['252,112,176', '255,158,22', '184,165,221']
const levelStr = '★'.repeat(raid['level'])
let raidImage = ''

if (isRaidStarted) {
// Set default image.
// set Pokémon-specific image if we have one.
if (raid.pokemon_id !== null && pokemonWithImages.indexOf(raid.pokemon_id) !== -1) {
raidImage = `<img class='gym sprite' src='static/icons/${raid.pokemon_id}.png'>`
} else {
raidImage = `<img class='gym sprite' src='static/images/raid/${gymTypes[gym.team_id]}_${raid.level}_unknown.png'>`
}
image = `
<img class='gym sprite' src='static/images/raid/${gymTypes[gym.team_id]}_${raid.level}_unknown.png'>
<div class='raid container'>
<div class='raid container content-left'>
<div>
${raidImage}
</div>
</div>
<div class='raid container content-right'>
<div>
<div class='raid pokemon'>
${raid['pokemon_name']} <a href='http://pokemon.gameinfo.io/en/pokemon/${raid['pokemon_id']}' target='_blank' title='View in Pokédex'>#${raid['pokemon_id']}</a> | CP: ${raid['cp']}
</div>
${raidStr}
</div>
</div>
</div>
<div class='raid'>
<span style='color:rgb(${raidColor[Math.floor((raid.level - 1) / 2)]})'>
${levelStr}
</span>
<span class='raid countdown label-countdown' disappears-at='${raid.end}'></span> left (${moment(raid.end).format('HH:mm')})
</div>
`
// Use Pokémon-specific image if we have one.
if (raid.pokemon_id !== null && pokemonWithImages.indexOf(raid.pokemon_id) !== -1) {
image = `
<div class='raid container'>
<div class='raid container content-left'>
<div>
<img class='gym sprite' src='static/icons/${raid.pokemon_id}.png'>
</div>
</div>
<div class='raid container content-right'>
<div>
<div class='raid pokemon'>
${raid['pokemon_name']} <a href='http://pokemon.gameinfo.io/en/pokemon/${raid['pokemon_id']}' target='_blank' title='View in Pokédex'>#${raid['pokemon_id']}</a> | CP: ${raid['cp']}
</div>
${raidStr}
</div>
</div>
</div>
<div class='raid'>
<span style='color:rgb(${raidColor[Math.floor((raid.level - 1) / 2)]})'>
${levelStr}
</span>
<span class='raid countdown label-countdown' disappears-at='${raid.end}'></span> left (${moment(raid.end).format('HH:mm')})
</div>
`
}
} else {
image = `<img class='gym sprite' src='static/images/gym/${gymTypes[gym.team_id]}_${getGymLevel(gym)}_${raid.level}.png'>`
}
Expand Down

0 comments on commit 2feff94

Please sign in to comment.