import ScoreSaberPlayer from "@/common/data-fetcher/types/scoresaber/scoresaber-player"; import { formatNumberWithCommas } from "@/common/number-utils"; import { GlobeAmericasIcon } from "@heroicons/react/24/solid"; import Card from "../card"; import CountryFlag from "../country-flag"; import { Avatar, AvatarImage } from "../ui/avatar"; import ClaimProfile from "./claim-profile"; import PlayerStats from "./player-stats"; const playerData = [ { showWhenInactiveOrBanned: false, icon: () => { return ; }, render: (player: ScoreSaberPlayer) => { return

#{formatNumberWithCommas(player.rank)}

; }, }, { showWhenInactiveOrBanned: false, icon: (player: ScoreSaberPlayer) => { return ; }, render: (player: ScoreSaberPlayer) => { return

#{formatNumberWithCommas(player.countryRank)}

; }, }, { showWhenInactiveOrBanned: true, render: (player: ScoreSaberPlayer) => { return

{formatNumberWithCommas(player.pp)}pp

; }, }, ]; type Props = { player: ScoreSaberPlayer; }; export default function PlayerHeader({ player }: Props) { return (

{player.name}

{player.inactive && (

Inactive Account

)} {player.banned && (

Banned Account

)}
{playerData.map((subName, index) => { // Check if the player is inactive or banned and if the data should be shown if ( !subName.showWhenInactiveOrBanned && (player.inactive || player.banned) ) { return null; } return (
{subName.icon && subName.icon(player)} {subName.render && subName.render(player)}
); })}
); }