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:
Joe Milazzo 2022-12-11 16:29:46 -06:00 committed by GitHub
parent 20441f5ec3
commit 4548dcb1eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 155 additions and 7 deletions

View file

@ -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);
}