Knossos Catch-up (#58)

* Knossos Catch-up

* bump version

* fix build

* fix build again

* Fix lint

* downgrade pnpm

* fix modals

* fix btn style

* add missing styles
This commit is contained in:
Geometrically
2023-05-28 16:36:49 -04:00
committed by GitHub
parent bbb2539ace
commit 1db59fc052
21 changed files with 3014 additions and 1992 deletions

View File

@@ -1,20 +1,20 @@
export const formatNumber = (number) => {
export const formatNumber = (number, abbreviate = true) => {
const x = +number
if (x >= 1000000) {
if (x >= 1000000 && abbreviate) {
return (x / 1000000).toFixed(2).toString() + 'M'
} else if (x >= 10000) {
return (x / 1000).toFixed(1).toString() + 'K'
} else if (x >= 10000 && abbreviate) {
return (x / 1000).toFixed(1).toString() + 'k'
} else {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
}
export function formatMoney(number) {
export function formatMoney(number, abbreviate = false) {
const x = +number
if (x >= 1000000) {
if (x >= 1000000 && abbreviate) {
return '$' + (x / 1000000).toFixed(2).toString() + 'M'
} else if (x >= 10000) {
return '$' + (x / 1000).toFixed(1).toString() + 'K'
} else if (x >= 10000 && abbreviate) {
return '$' + (x / 1000).toFixed(2).toString() + 'k'
} else {
return (
'$' +