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.
scoresaber-reloadedv3/projects/website/src/components/leaderboard/leaderboard-player.tsx

43 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-10-04 18:25:37 +01:00
import Image from "next/image";
import Link from "next/link";
2024-10-09 01:17:00 +01:00
import ScoreSaberScoreToken from "@ssr/common/types/token/scoresaber/score-saber-score-token";
import ScoreSaberPlayer from "@ssr/common/types/player/impl/scoresaber-player";
2024-10-04 18:25:37 +01:00
type Props = {
/**
* The player who set the score.
*/
player?: ScoreSaberPlayer;
/**
* The score to display.
*/
score: ScoreSaberScoreToken;
};
export default function LeaderboardPlayer({ player, score }: Props) {
const scorePlayer = score.leaderboardPlayerInfo;
const isPlayerWhoSetScore = player && scorePlayer.id === player.id;
return (
<div className="flex gap-2">
<Image
unoptimized
src={`https://img.fascinated.cc/upload/w_48,h_48/${scorePlayer.profilePicture}`}
width={48}
height={48}
alt="Song Artwork"
className="rounded-md min-w-[48px]"
priority
/>
<Link
href={`/player/${scorePlayer.id}`}
target="_blank"
className="h-fit hover:brightness-75 transition-all transform-gpu"
>
<p className={`${isPlayerWhoSetScore && "text-pp"}`}>{scorePlayer.name}</p>
</Link>
</div>
);
}