Skip to content

Commit

Permalink
Update program-metrics.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Jan 4, 2025
1 parent b3bbe13 commit 2e39b20
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import useProgramMetrics from "@/lib/swr/use-program-metrics";
import { Icon } from "@dub/ui";
import { Check2, CurrencyDollar, MoneyBills2, Users } from "@dub/ui/icons";
import { currencyFormatter, nFormatter } from "@dub/utils";
import NumberFlow from "@number-flow/react";
import Link from "next/link";
import { useParams } from "next/navigation";

Expand Down Expand Up @@ -79,14 +79,19 @@ function Stat({
{error ? (
"-"
) : (
<>
{isCurrency
? currencyFormatter(value! / 100, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
: nFormatter(value)}
</>
<NumberFlow
value={isCurrency ? value! / 100 : value || 0}
{...(isCurrency
? {
format: {
style: "currency",
currency: "USD",
// @ts-ignore – this is a valid option but TS is outdated
trailingZeroDisplay: "stripIfInteger",
},
}
: {})}
/>
)}
</div>
)}
Expand Down

0 comments on commit 2e39b20

Please sign in to comment.