Client Fixes Oct 1 (#9126)

* fix exp notifications for armoire

* open the profile modal only if data is available
This commit is contained in:
Matteo Pagliazzi
2017-10-02 23:01:27 +02:00
committed by GitHub
parent 4e97355110
commit 47ebee9ae8
4 changed files with 38 additions and 17 deletions

View File

@@ -30,4 +30,23 @@ export function getDropClass ({type, key}) {
}
return dropClass;
}
export function getSign (number) {
let sign = '+';
if (number && number < 0) {
sign = '-';
}
return sign;
}
export function round (number, nDigits) {
return Math.abs(number.toFixed(nDigits || 1));
}
export function getXPMessage (val) {
if (val < -50) return; // don't show when they level up (resetting their exp)
return `${getSign(val)} ${round(val)}`;
}