This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Liam 982202f813
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m7s
make mini ranking text smaller
2024-10-19 15:37:25 +01:00

49 lines
1.6 KiB
TypeScript

import { Avatar, AvatarImage } from "@/components/ui/avatar";
import CountryFlag from "@/components/country-flag";
import Link from "next/link";
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
import ScoreSaberLeaderboardPlayerInfoToken from "@ssr/common/types/token/scoresaber/score-saber-leaderboard-player-info-token";
import { getScoreSaberRole } from "@ssr/common/scoresaber.util";
import ScoreSaberPlayer from "@ssr/common/player/impl/scoresaber-player";
type TablePlayerProps = {
/**
* The player to display.
*/
player: ScoreSaberPlayerToken | ScoreSaberLeaderboardPlayerInfoToken;
/**
* The player to highlight.
*/
highlightedPlayer?: ScoreSaberPlayerToken | ScoreSaberPlayer;
/**
* Hide the country flag
*/
hideCountryFlag?: boolean;
};
export function PlayerInfo({ player, highlightedPlayer, hideCountryFlag }: TablePlayerProps) {
return (
<>
<Avatar className="w-[24px] h-[24px] pointer-events-none">
<AvatarImage
alt="Profile Picture"
src={`https://img.fascinated.cc/upload/w_128,h_128/${player.profilePicture}`}
/>
</Avatar>
{!hideCountryFlag && <CountryFlag code={player.country} size={12} />}
<Link className="transform-gpu transition-all hover:text-blue-500" href={`/player/${player.id}`}>
<p
className={player.id == highlightedPlayer?.id ? "font-bold" : ""}
style={{
color: getScoreSaberRole(player)?.color,
}}
>
{player.name}
</p>
</Link>
</>
);
}