import { formatNumberWithCommas } from "@ssr/common/utils/number-utils"; import StatValue from "@/components/stat-value"; import ScoreSaberPlayer from "@ssr/common/player/impl/scoresaber-player"; import { formatDate } from "@ssr/common/utils/time-utils"; import { ReactNode } from "react"; import Tooltip from "@/components/tooltip"; type Badge = { name: string; color?: string; create: (player: ScoreSaberPlayer) => { tooltip?: string | ReactNode; value: string | ReactNode; }; }; const badges: Badge[] = [ { name: "Ranked Play Count", color: "bg-pp", create: (player: ScoreSaberPlayer) => { return { value: formatNumberWithCommas(player.statistics.rankedPlayCount), }; }, }, { name: "Total Ranked Score", color: "bg-pp", create: (player: ScoreSaberPlayer) => { return { value: formatNumberWithCommas(player.statistics.totalRankedScore), }; }, }, { name: "Average Ranked Accuracy", color: "bg-pp", create: (player: ScoreSaberPlayer) => { return { value: player.statistics.averageRankedAccuracy.toFixed(2) + "%", }; }, }, { name: "Total Play Count", create: (player: ScoreSaberPlayer) => { return { value: formatNumberWithCommas(player.statistics.totalPlayCount), }; }, }, { name: "Total Score", create: (player: ScoreSaberPlayer) => { return { value: formatNumberWithCommas(player.statistics.totalScore), }; }, }, { name: "Total Replays Watched", create: (player: ScoreSaberPlayer) => { return { value: formatNumberWithCommas(player.statistics.replaysWatched), }; }, }, { name: "Joined Date", create: (player: ScoreSaberPlayer) => { return { tooltip: formatDate(player.joinedDate, "DD MMMM YYYY HH:mm"), value: formatDate(player.joinedDate), }; }, }, ]; type Props = { player: ScoreSaberPlayer; }; export default function PlayerStats({ player }: Props) { return (