Preact: Fix PP display on buttons for moves with no max PP (#2420)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run

This commit is contained in:
pyuk-bot 2025-05-14 15:42:48 -05:00 committed by GitHub
parent c7a9d18585
commit fcbd70e9a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -153,15 +153,16 @@ class BattleDiv extends preact.Component<{ room: BattleRoom }> {
}
function MoveButton(props: {
cmd: string, type: Dex.TypeName, tooltip: string, moveData: { pp: number, maxpp: number, disabled?: boolean },
cmd: string, type: Dex.TypeName, tooltip: string, moveData: { pp?: number, maxpp?: number, disabled?: boolean },
children: string,
}) {
const pp = props.moveData.maxpp ? `${props.moveData.pp!}/${props.moveData.maxpp}` : '&ndash;';
return <button
data-cmd={props.cmd} data-tooltip={props.tooltip}
class={`movebutton type-${props.type} has-tooltip${props.moveData.disabled ? ' disabled' : ''}`}
>
{props.children}<br />
<small class="type">{props.type}</small> <small class="pp">{props.moveData.pp}/{props.moveData.maxpp}</small>&nbsp;
<small class="type">{props.type}</small> <small class="pp">{pp}</small>&nbsp;
</button>;
}
function PokemonButton(props: {