Misc UI Tweaks (#1692)
* Added a timeAgo pipe which shows live updates for a few areas. * Fixed some wording on stats page. Changed Total People count to just work on distinct names and not count multiple for different roles. * Tweaked the compact number so it only shows one decimal * Fixed a bug
This commit is contained in:
parent
20441f5ec3
commit
4548dcb1eb
9 changed files with 155 additions and 7 deletions
|
|
@ -7,12 +7,26 @@ const formatter = new Intl.NumberFormat('en-GB', {
|
|||
maximumSignificantDigits: 3
|
||||
});
|
||||
|
||||
const formatterForDoublePercision = new Intl.NumberFormat('en-GB', {
|
||||
//@ts-ignore
|
||||
notation: 'compact', // https://github.com/microsoft/TypeScript/issues/36533
|
||||
maximumSignificantDigits: 2
|
||||
});
|
||||
|
||||
const specialCases = [4, 7, 10, 13];
|
||||
|
||||
@Pipe({
|
||||
name: 'compactNumber'
|
||||
})
|
||||
export class CompactNumberPipe implements PipeTransform {
|
||||
|
||||
transform(value: number): string {
|
||||
|
||||
if (value < 1000) return value + '';
|
||||
if (specialCases.includes((value + '').length)) { // from 4, every 3 will have a case where we need to override
|
||||
return formatterForDoublePercision.format(value);
|
||||
}
|
||||
|
||||
return formatter.format(value);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue