Skip to content

Commit

Permalink
finish #124 more tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnymac committed Aug 25, 2016
1 parent cdb4c72 commit 32cb2fa
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions app/screens/Table/components/Pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,18 @@ const Pokemon = React.createClass({

return species.pokemon.map((pokemon) => {
const favorite = pokemon.favorite ? favoriteGlyph : emptyFavoriteGlyph
let pokeiv = `${pokemon.iv}% (${pokemon.attack}/${pokemon.defense}/${pokemon.stamina})`
let powerUpTip = null

const pokeiv = `${pokemon.iv}% (${pokemon.attack}/${pokemon.defense}/${pokemon.stamina})`
const powerUpTip = this.getPowerUpTip(pokemon)
const cpTip = `Max CP: ${pokemon.max_cp}`
const ivTip = (<span>
{`Attack: ${pokemon.attack}`}
<br />
{`Defense: ${pokemon.defense}`}
<br />
{`Stamina: ${pokemon.stamina}`}
</span>)
const isChecked = pokemonState[String(pokemon.id)].check

if (pokemon.cp === pokemon.max_cp) {
powerUpTip = `Max CP ${pokemon.max_cp}`
} else {
powerUpTip = (<span>
{`Stardust Cost = ${pokemon.stardust_cost}`}
<br />
{`Candy Cost = ${pokemon.candy_cost}`}
<br />
{`CP After ≅ ${Math.round(pokemon.next_cp) + pokemon.cp}`}
<br />
{`Max Stardust = ${pokemon.stardust_max_cost}`}
<br />
{`Max Candy = ${pokemon.candy_max_cost}`}
</span>)
}

return (
<tr key={pokemon.id}>
<td>
Expand All @@ -182,11 +173,10 @@ const Pokemon = React.createClass({
id="power_up_tooltip"
message={powerUpTip}
delayShow={100}
wrapperTag="a"
show
>
<a>
P↑
</a>
P↑
</Tooltip>
</td>
<td>
Expand All @@ -201,15 +191,51 @@ const Pokemon = React.createClass({
</a>
</td>
<td>
{pokemon.cp}
<Tooltip
placement="right"
id="cp_tooltip"
message={cpTip}
delayShow={100}
wrapperTag="span"
show
>
{pokemon.cp}
</Tooltip>
</td>
<td>
{pokeiv}
<Tooltip
placement="right"
id="iv_tooltip"
message={ivTip}
delayShow={100}
wrapperTag="span"
show
>
{pokeiv}
</Tooltip>
</td>
</tr>)
})
},

getPowerUpTip(pokemon) {
if (pokemon.cp === pokemon.max_cp) {
return `Max CP ${pokemon.max_cp}`
}

return (<span>
{`Stardust Cost = ${pokemon.stardust_cost}`}
<br />
{`Candy Cost = ${pokemon.candy_cost}`}
<br />
{`CP After ≅ ${Math.round(pokemon.next_cp) + pokemon.cp}`}
<br />
{`Max Stardust = ${pokemon.stardust_max_cost}`}
<br />
{`Max Candy = ${pokemon.candy_max_cost}`}
</span>)
},

handleClickPowerup(pokemon) {
if (ipcRenderer.sendSync('confirmation-dialog', 'power up').success) {
ipcRenderer.send('power-up-pokemon', pokemon.id, pokemon.nickname)
Expand Down

0 comments on commit 32cb2fa

Please sign in to comment.