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:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user