CSS changes for buttons, fixed numbers in stats

This commit is contained in:
SuperChamp234 2022-01-15 09:23:35 +05:30
parent e4d3c78a9f
commit 82780ba589
3 changed files with 14 additions and 4 deletions

View file

@ -34,6 +34,7 @@ class App extends React.Component<any, any> {
stats: {
hp: 0,
lvl: 0,
gold: 0,
},
lastCron: "",
},

View file

@ -4,9 +4,12 @@ export default function Index(props: any) {
return(
<div className="stats">
{/* <div id="profile-name">{props.user_data.profile.name}</div> */}
<div className = "substats" id="hp">HP: {(props.user_data.stats.hp).toPrecision(3)}</div>
<div className = "substats" id="hp">HP: {numberWithCommas((props.user_data.stats.hp).toFixed(0))}</div>
<div className = "substats" id="lvl">LEVEL: {props.user_data.stats.lvl}</div>
<div className = "substats" id="gold">GOLD: {(props.user_data.stats.gp).toPrecision(3)}</div>
<div className = "substats" id="gold">GOLD: {numberWithCommas(props.user_data.stats.gp.toFixed(2))}</div>
</div>
);
}
function numberWithCommas(x: any) {
return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}