feat(dashboard): implement number formatting for country distribution and notice types

- Integrated formatShortNumber utility to display formatted numbers in the CountryDistribution and NoticeTypeBreakdown components.
- Enhanced user experience by providing clearer visual representation of numerical data with optional positive prefixes.
This commit is contained in:
AmirReza Jamali
2026-05-20 16:30:12 +03:30
parent 44897aba5d
commit 2daf5e7d15
3 changed files with 59 additions and 9 deletions
@@ -1,5 +1,6 @@
"use client";
import { formatShortNumber } from "@/lib/format-number";
import { cn } from "@/lib/utils";
import gsap from "gsap";
import { useLayoutEffect, useMemo, useRef } from "react";
@@ -155,7 +156,7 @@ export function CountryDistribution({ countries, isLoading }: Props) {
Total
</div>
<div className="text-2xl font-bold text-dark dark:text-white">
{isLoading ? "—" : totalShown}
{isLoading ? "—" : formatShortNumber(totalShown, { plus: true })}
</div>
</div>
</div>
@@ -1,5 +1,6 @@
"use client";
import { formatShortNumber } from "@/lib/format-number";
import gsap from "gsap";
import { useLayoutEffect, useMemo, useRef } from "react";
import { TenderIcon } from "./icons";
@@ -94,7 +95,9 @@ export function NoticeTypeBreakdown({ noticeTypes, isLoading }: Props) {
{isLoading ? "Loading…" : labelize(n.type)}
</span>
<span className="tabular-nums text-xs font-semibold text-dark-5 dark:text-dark-6">
{isLoading ? "—" : `${n.count} · ${pct}%`}
{isLoading
? "—"
: `${formatShortNumber(n.count, { plus: true })} · ${pct}%`}
</span>
</div>
<div className="relative h-2.5 w-full overflow-hidden rounded-full bg-gray-2 dark:bg-dark-3">