Skip to content

Commit

Permalink
IV: Add info icon to the right of the RP value
Browse files Browse the repository at this point in the history
  • Loading branch information
nitoyon authored Jan 26, 2025
2 parents 25b192e + 0f70cd7 commit 08fbcc5
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 39 deletions.
8 changes: 6 additions & 2 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@
"strength2": "Strength",
"rating": "Rating",

"helps per 5 hours": "Helps per 5 hours",
"go to strength tab to show the current condition values": "Please go to the [$t(strength2)] tab to display the strength, ingredients and skill count corresponding to the current conditions.",
"strength, ingredients, skill count": "Strength, ingredients and skill count",
"the amount under the following condition": "We are showing the amount under the following conditions.",
"use strength tab if you want to change these condition": "If you want to change these conditions, please use the [$t(strength2)] tab.", "helps per 5 hours": "Helps per 5 hours",
"berry rate": "Berry rate",
"berry strength": "Berry strength (determined by the type of berry and the Pokémon level)",
"berry count": "The amount of Berries per help",
Expand All @@ -206,7 +209,7 @@
"rp formula": "This site is using RP formula elucidated by Goobliss, Harold, Jeancory in the Mathcode server on Discord. For more details about the formula, please read <link/> on Pokémon Sleep Info Wiki.",
"rp formula doc url": "https://pks.raenonx.cc/en/docs/view/help/rp-model",
"rp formula doc title": "RP Model Breakdown",
"rp estimate": "RP beyond level {{level}} is estimated value.",
"estimated beyond level": "The value beyond level {{level}} is estimated.",
"estimated value": "Estimated",
"ratio is not fixed": "The ingredient% and skill% for this Pokémon are not yet confirmed, so provisional values are displayed.",

Expand Down Expand Up @@ -248,6 +251,7 @@
"area bonus": "Area bonus",
"favorite berry": "Favorite berry",
"helping bonus": "Helping bonus",
"helping bonus other pokemon": "Other Pokémon with helping bonus",
"good camp ticket": "Good camp ticket",
"good camp ticket (short)": "Ticket",
"energy": "Energy",
Expand Down
7 changes: 6 additions & 1 deletion src/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
"strength2": "エナジー",
"rating": "個体評価",

"go to strength tab to show the current condition values": "現在の条件でのエナジー、食材数、スキル回数を表示するには、[$t(strength2)] タブに移動してください。",
"strength, ingredients, skill count": "エナジー、食材数、スキル回数",
"the amount under the following condition": "次の条件のときの量を表示しています。",
"use strength tab if you want to change these condition": "これらの条件を変えたい場合は、[$t(strength2)] タブを利用してください。",
"helps per 5 hours": "5時間のおてつだい回数",
"berry rate": "きのみ確率",
"berry strength": "きのみエナジー (きのみの種類とポケモンのレベルで決まる値)",
Expand All @@ -197,7 +201,7 @@
"rp formula": "SP 計算式は Mathcode の Goobliss, Harold, Jeancory が解明したものを利用しています。計算式についての詳細は、ポケスリ攻略の <link/> をご覧ください。",
"rp formula doc url": "https://pks.raenonx.cc/ja/docs/view/help/rp-model",
"rp formula doc title": "SP計算モデルの解説",
"rp estimate": "レベル {{level}} 以降の SP は推測値です",
"estimated beyond level": "レベル {{level}} 以降の値は推測値です",
"estimated value": "推測値",
"ratio is not fixed": "このポケモンの食材確率・スキル確率は未確定であるため、暫定の値を表示しています。",

Expand Down Expand Up @@ -239,6 +243,7 @@
"area bonus": "フィールドボーナス",
"favorite berry": "好みきのみ",
"helping bonus": "おてつだいボーナス",
"helping bonus other pokemon": "他ポケモンのおてつだいボーナス",
"good camp ticket": "いいキャンプチケット",
"good camp ticket (short)": "キャンチケ",
"energy": "げんき",
Expand Down
7 changes: 6 additions & 1 deletion src/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
"strength2": "에너지",
"rating": "개체값 평가",

"go to strength tab to show the current condition values": "현재 조건에 해당하는 에너지, 재료 수, 스킬 횟수를 표시하려면 [$t(strength2)] 탭으로 이동하세요.",
"strength, ingredients, skill count": "에너지, 재료 수, 스킬 횟수",
"the amount under the following condition": "다음 조건에서의 양을 표시하고 있습니다.",
"use strength tab if you want to change these condition": "이 조건을 변경하려면 [$t(strength2)] 탭을 사용하세요.",
"helps per 5 hours": "5시간 동안의 도우미 횟수",
"berry rate": "열매 확률",
"berry strength": "열매 에너지 (열매 종류와 포켓몬의 레벨로 결정되는 값)",
Expand All @@ -192,7 +196,7 @@
"rp formula": "SP 계산식은 Mathcode의 Goobliss, Harold, Jeancory가 연구한 것을 사용합니다. 계산식에 대한 자세한 내용은 포슬립 위키의 문서 <link/>을 참조하세요.",
"rp formula doc url": "https://pks.raenonx.cc/en/docs/view/help/rp-model",
"rp formula doc title": "RP Model Breakdown",
"rp estimate": "레벨 {{level}} 이후의 SP는 추정치입니다.",
"estimated beyond level": "레벨 {{level}} 이후의 값은 추정값입니다.",
"estimated value": "추정치",
"ratio is not fixed": "이 포켓몬의 재료 확률과 스킬 확률은 아직 확정되지 않았기 때문에 임시 값을 표시하고 있습니다.",

Expand Down Expand Up @@ -234,6 +238,7 @@
"area bonus": "필드 보너스",
"favorite berry": "선호하는 열매",
"helping bonus": "도우미 보너스",
"helping bonus other pokemon": "다른 포켓몬의 도우미 보너스",
"good camp ticket": "좋은 캠프 티켓",
"good camp ticket (short)": "티켓",
"energy": "기력",
Expand Down
7 changes: 6 additions & 1 deletion src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
"strength2": "能量",
"rating": "个体评价",

"go to strength tab to show the current condition values": "要显示与当前条件对应的能量、食材数、技能次数,请前往[$t(strength2)] 标签。",
"strength, ingredients, skill count": "能量、食材数、技能次数",
"the amount under the following condition": "显示在以下条件下的数量。",
"use strength tab if you want to change these condition": "如果您想更改这些条件,请使用[$t(strength2)] 标签。",
"helps per 5 hours": "5小时的帮助次数",
"berry rate": "树果几率",
"berry strength": "树果能量 (由树果种类和宝可梦的等级决定)",
Expand All @@ -197,7 +201,7 @@
"rp formula": "SP 的计算式使用的是 Mathcode 的 Goobliss, Harold, Jeancory 研究成果。关于计算式的详情、请浏览ポケスリ攻略的 <link/> 。",
"rp formula doc url": "https://pks.raenonx.cc/en/docs/view/help/rp-model",
"rp formula doc title": "SP计算模型的解说",
"rp estimate": " {{level}} 级之后的SP为推测值",
"estimated beyond level": "级别 {{level}} 以后的值是估算值",
"estimated value": "推测值",
"ratio is not fixed": "该宝可梦的食材几率和技能几率尚未确定,因此显示的是临时值。",

Expand Down Expand Up @@ -239,6 +243,7 @@
"area bonus": "营地奖励",
"favorite berry": "喜欢的树果",
"helping bonus": "帮手奖励",
"helping bonus other pokemon": "其他宝可梦的帮手奖励",
"good camp ticket": "好露营券",
"good camp ticket (short)": "露营券",
"energy": "活力",
Expand Down
7 changes: 6 additions & 1 deletion src/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
"strength2": "能量",
"rating": "個体評價",

"go to strength tab to show the current condition values": "要顯示與當前條件對應的能量、食材數、技能次數,請前往[$t(strength2)] 標籤。",
"strength, ingredients, skill count": "能量、食材數、技能次數",
"the amount under the following condition": "顯示在以下條件下的數量。",
"use strength tab if you want to change these condition": "如果您想更改這些條件,請使用[$t(strength2)] 標籤。",
"helps per 5 hours": "5小時的幫助次數",
"berry rate": "樹果機率",
"berry strength": "樹果能量 (由樹果類型和寶可夢等級決定)",
Expand All @@ -197,7 +201,7 @@
"rp formula": "SP 計算公式使用的是 Mathcode 的 Goobliss、Harold 和 Jeancory 的研究成果。關於計算公式的詳情,請瀏覽ポケスリ攻略的 <link/> 。",
"rp formula doc url": "https://pks.raenonx.cc/en/docs/view/help/rp-model",
"rp formula doc title": "SP計算模型的解説",
"rp estimate": " {{level}} 級以後的SP為推測值",
"estimated beyond level": "級別 {{level}} 以後的值是估算值。",
"estimated value": "推測値",
"ratio is not fixed": "該寶可夢的食材機率和技能確率尚未確定,因此顯示的是臨時值。",

Expand Down Expand Up @@ -239,6 +243,7 @@
"area bonus": "營地獎勵",
"favorite berry": "喜歡的樹果",
"helping bonus": "幫手獎勵",
"helping bonus other pokemon": "其他寶可夢的幫手獎勵",
"good camp ticket": "好露營券",
"good camp ticket (short)": "露營券",
"energy": "活力",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/IvCalc/BoxItemDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const BoxItemDialogContent = React.memo(({originalBoxItem, isEdit, onChange, onC

return <>
<article>
<RpLabel rp={rp} isEstimated={boxItem.iv.level > 60}/>
<RpLabel rp={rp} iv={boxItem.iv}/>
<div className="icon"><PokemonIcon idForm={boxItem.iv.idForm} size={80}/></div>
<div className="nickname">
<TextField variant="standard" size="small" value={displayNickName}
Expand Down
17 changes: 15 additions & 2 deletions src/ui/IvCalc/InfoButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { IconButton } from '@mui/material';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
import { styled } from '@mui/system';

const StyledIconButton = styled(IconButton)({
Expand All @@ -11,14 +12,26 @@ const StyledIconButton = styled(IconButton)({
width: '20px',
height: '20px',
color: '#bbb',
'&.error': {
color: '#ed6c02',
animation: 'redglow 0.5s ease-out infinite normal',
},
},
},
'@keyframes redglow': {
'0%': {transform: 'scale(1)'},
'100%': {transform: 'scale(1.1)'},
},
});

const InfoButton = React.memo(({onClick}: {onClick: () => void}) => {
const InfoButton = React.memo(({isError, onClick}: {
isError?: boolean,
onClick: () => void,
}) => {
return (
<StyledIconButton onClick={onClick}>
<InfoOutlinedIcon/>
{!isError && <InfoOutlinedIcon/>}
{isError && <WarningRoundedIcon className="error"/>}
</StyledIconButton>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/IvCalc/IvCalcApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const ResearchCalcApp = React.memo(() => {
<StyledTab label={t('strength2')}/>
<StyledTab label={t('rating')}/>
</StyledTabs>
{state.tabIndex === 0 && <RpView pokemonIv={state.pokemonIv} width={width}/>}
{state.tabIndex === 0 && <RpView state={state} width={width}/>}
{state.tabIndex === 1 && <StrengthView state={state} dispatch={dispatch}/>}
{state.tabIndex === 2 && <RatingView pokemonIv={state.pokemonIv} width={width}/>}
{state.pokemonIv.pokemon.ratioNotFixed && <div style={{
Expand Down
28 changes: 24 additions & 4 deletions src/ui/IvCalc/RpLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
import React from 'react';
import PokemonIv from '../../util/PokemonIv';
import InfoButton from './InfoButton';
import { rpEstimateThreshold } from '../../util/PokemonRp';
import { useTranslation } from 'react-i18next';

const RpLabel = React.memo(({rp, isEstimated}: {rp: number, isEstimated: boolean}) => {
const RpLabel = React.memo(({rp, iv, showIcon, isError, onClick}: {
rp: number,
iv: PokemonIv,
showIcon?: boolean,
isError?: boolean,
onClick?: () => void,
}) => {
const { t } = useTranslation();
const isEstimated = iv.level > rpEstimateThreshold;

return (<div>
const clickHandler = React.useCallback(() => {
if (onClick !== undefined) {
onClick();
}
}, [onClick]);

return (<div style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'start',
}}>
<span style={{
color: '#fd775d',
fontWeight: 'bold',
paddingRight: '.4rem',
fontSize: '.8rem',
verticalAlign: '15%',
display: 'inline-block',
transform: 'scale(1, 0.9)',
}}>{t('rp')}</span>
Expand All @@ -27,9 +47,9 @@ const RpLabel = React.memo(({rp, isEstimated}: {rp: number, isEstimated: boolean
fontSize: '0.7rem',
borderRadius: '0.5rem',
marginLeft: '.5rem',
verticalAlign: '20%',
padding: '0 0.3rem',
}}>{t('estimated value')}</span>}
{showIcon && <InfoButton onClick={clickHandler} isError={isError}/>}
</div>);
});

Expand Down
Loading

0 comments on commit 08fbcc5

Please sign in to comment.