Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ export const byteToSize = (bytes: number, decimals: number) => {
return isNaN(i) ? `Not Defined` : `${Number.parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`;
};

/**
* The function transforms the provided number to a comma separated value
* Ex: 1000 will be 1,000
* @param num The number to convert
* @returns The number separated at every thousandth place by commas
*/
export function numberWithCommas(num: number) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

export const nullAwareLocaleCompare = (a: string, b: string) => {
if (!a && !b) {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
InboxOutlined,
QuestionCircleOutlined
} from '@ant-design/icons';
import { numberWithCommas } from '@/utils/common';


// ------------- Types -------------- //
Expand Down Expand Up @@ -138,7 +139,7 @@ const OverviewSimpleCard: React.FC<OverviewCardProps> = ({
<IconSelector iconType={icon} style={iconStyle} />
</Col>
<Col style={dataColStyle}>
{data}
{numberWithCommas(data)}
</Col>
</Row>
</Card>
Expand Down