import React from "react"; import { Separator } from "@/src/components/ui/separator"; import { numberFormatter } from "@/src/utils/numbers"; import { Skeleton } from "@/src/components/ui/skeleton"; export type LevelCount = { level: string; count: number | bigint; symbol: string; customNumberFormatter?: (number: number | bigint) => string; }; interface LevelCountsDisplayProps { counts: LevelCount[]; isLoading?: boolean; } export function LevelCountsDisplay({ counts, isLoading, }: LevelCountsDisplayProps) { if (isLoading) return ; const nonZeroCounts = counts.filter((item) => item.count > 0); return (
{nonZeroCounts.map( ({ level, count, symbol, customNumberFormatter }, index) => (
{symbol}{" "} {customNumberFormatter ? customNumberFormatter(count) : numberFormatter(count, 0)}
{index < nonZeroCounts.length - 1 && ( )}
), )}
); }