From 32cb2fa2e9307dc91a82e35bafd75d3a348367dc Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Thu, 25 Aug 2016 00:08:51 -0400 Subject: [PATCH] finish #124 more tooltips --- app/screens/Table/components/Pokemon.js | 74 +++++++++++++++++-------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/app/screens/Table/components/Pokemon.js b/app/screens/Table/components/Pokemon.js index aeb4f7f..31d4fe6 100644 --- a/app/screens/Table/components/Pokemon.js +++ b/app/screens/Table/components/Pokemon.js @@ -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 = ( + {`Attack: ${pokemon.attack}`} +
+ {`Defense: ${pokemon.defense}`} +
+ {`Stamina: ${pokemon.stamina}`} +
) const isChecked = pokemonState[String(pokemon.id)].check - if (pokemon.cp === pokemon.max_cp) { - powerUpTip = `Max CP ${pokemon.max_cp}` - } else { - powerUpTip = ( - {`Stardust Cost = ${pokemon.stardust_cost}`} -
- {`Candy Cost = ${pokemon.candy_cost}`} -
- {`CP After ā‰… ${Math.round(pokemon.next_cp) + pokemon.cp}`} -
- {`Max Stardust = ${pokemon.stardust_max_cost}`} -
- {`Max Candy = ${pokemon.candy_max_cost}`} -
) - } - return ( @@ -182,11 +173,10 @@ const Pokemon = React.createClass({ id="power_up_tooltip" message={powerUpTip} delayShow={100} + wrapperTag="a" show > - - Pā†‘ - + Pā†‘ @@ -201,15 +191,51 @@ const Pokemon = React.createClass({ - {pokemon.cp} + + {pokemon.cp} + - {pokeiv} + + {pokeiv} + ) }) }, + getPowerUpTip(pokemon) { + if (pokemon.cp === pokemon.max_cp) { + return `Max CP ${pokemon.max_cp}` + } + + return ( + {`Stardust Cost = ${pokemon.stardust_cost}`} +
+ {`Candy Cost = ${pokemon.candy_cost}`} +
+ {`CP After ā‰… ${Math.round(pokemon.next_cp) + pokemon.cp}`} +
+ {`Max Stardust = ${pokemon.stardust_max_cost}`} +
+ {`Max Candy = ${pokemon.candy_max_cost}`} +
) + }, + handleClickPowerup(pokemon) { if (ipcRenderer.sendSync('confirmation-dialog', 'power up').success) { ipcRenderer.send('power-up-pokemon', pokemon.id, pokemon.nickname)