This commit is contained in:
parent
0d182d3ff4
commit
a1148d0f59
@ -2,7 +2,7 @@ import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
|
|||||||
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
|
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
|
||||||
import { timeAgo } from "@ssr/common/utils/time-utils";
|
import { timeAgo } from "@ssr/common/utils/time-utils";
|
||||||
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
|
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
|
||||||
import { TablePlayer } from "@/components/table-player";
|
import { PlayerInfo } from "@/components/player/player-info";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ export default function LeaderboardScore({ score, claimedPlayer }: Props) {
|
|||||||
|
|
||||||
{/* Player */}
|
{/* Player */}
|
||||||
<td className="px-4 py-2 flex gap-2 whitespace-nowrap">
|
<td className="px-4 py-2 flex gap-2 whitespace-nowrap">
|
||||||
<TablePlayer player={scorePlayer} claimedPlayer={claimedPlayer} />
|
<PlayerInfo player={scorePlayer} claimedPlayer={claimedPlayer} />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{/* Time Set */}
|
{/* Time Set */}
|
||||||
|
@ -22,7 +22,7 @@ type TablePlayerProps = {
|
|||||||
hideCountryFlag?: boolean;
|
hideCountryFlag?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function TablePlayer({ player, claimedPlayer, hideCountryFlag }: TablePlayerProps) {
|
export function PlayerInfo({ player, claimedPlayer, hideCountryFlag }: TablePlayerProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Avatar className="w-[24px] h-[24px] pointer-events-none">
|
<Avatar className="w-[24px] h-[24px] pointer-events-none">
|
@ -5,12 +5,11 @@ import Link from "next/link";
|
|||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import Card from "../card";
|
import Card from "../card";
|
||||||
import CountryFlag from "../country-flag";
|
import CountryFlag from "../country-flag";
|
||||||
import { Avatar, AvatarImage } from "../ui/avatar";
|
|
||||||
import { PlayerRankingSkeleton } from "@/components/ranking/player-ranking-skeleton";
|
import { PlayerRankingSkeleton } from "@/components/ranking/player-ranking-skeleton";
|
||||||
import ScoreSaberPlayer from "@ssr/common/player/impl/scoresaber-player";
|
import ScoreSaberPlayer from "@ssr/common/player/impl/scoresaber-player";
|
||||||
import { getPlayersAroundPlayer } from "@ssr/common/utils/player-utils";
|
import { getPlayersAroundPlayer } from "@ssr/common/utils/player-utils";
|
||||||
import { AroundPlayer } from "@ssr/common/types/around-player";
|
import { AroundPlayer } from "@ssr/common/types/around-player";
|
||||||
import { TablePlayer } from "@/components/table-player";
|
import { PlayerInfo } from "@/components/player/player-info";
|
||||||
import useDatabase from "@/hooks/use-database";
|
import useDatabase from "@/hooks/use-database";
|
||||||
import { useLiveQuery } from "dexie-react-hooks";
|
import { useLiveQuery } from "dexie-react-hooks";
|
||||||
|
|
||||||
@ -102,7 +101,7 @@ export default function Mini({ type, player, shouldUpdate }: MiniProps) {
|
|||||||
>
|
>
|
||||||
<p className="text-gray-400">#{formatNumberWithCommas(rank)}</p>
|
<p className="text-gray-400">#{formatNumberWithCommas(rank)}</p>
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<TablePlayer player={playerRanking} claimedPlayer={claimedPlayer} hideCountryFlag />
|
<PlayerInfo player={playerRanking} claimedPlayer={claimedPlayer} hideCountryFlag />
|
||||||
</div>
|
</div>
|
||||||
<div className="inline-flex min-w-[11.5em] gap-2 items-center">
|
<div className="inline-flex min-w-[11.5em] gap-2 items-center">
|
||||||
<p className="text-pp text-right">{formatPp(playerRanking.pp)}pp</p>
|
<p className="text-pp text-right">{formatPp(playerRanking.pp)}pp</p>
|
||||||
|
@ -5,7 +5,7 @@ import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-sabe
|
|||||||
import useDatabase from "@/hooks/use-database";
|
import useDatabase from "@/hooks/use-database";
|
||||||
import { useLiveQuery } from "dexie-react-hooks";
|
import { useLiveQuery } from "dexie-react-hooks";
|
||||||
import { clsx } from "clsx";
|
import { clsx } from "clsx";
|
||||||
import { TablePlayer } from "@/components/table-player";
|
import { PlayerInfo } from "@/components/player/player-info";
|
||||||
|
|
||||||
type PlayerRankingProps = {
|
type PlayerRankingProps = {
|
||||||
player: ScoreSaberPlayerToken;
|
player: ScoreSaberPlayerToken;
|
||||||
@ -26,7 +26,7 @@ export function PlayerRanking({ player, isCountry }: PlayerRankingProps) {
|
|||||||
<span className="text-sm">{isCountry && "(#" + formatNumberWithCommas(player.rank) + ")"}</span>
|
<span className="text-sm">{isCountry && "(#" + formatNumberWithCommas(player.rank) + ")"}</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="flex items-center gap-2 px-4 py-2">
|
<td className="flex items-center gap-2 px-4 py-2">
|
||||||
<TablePlayer player={player} claimedPlayer={claimedPlayer} />
|
<PlayerInfo player={player} claimedPlayer={claimedPlayer} />
|
||||||
</td>
|
</td>
|
||||||
<td className="px-4 py-2 text-pp text-center">{formatPp(player.pp)}pp</td>
|
<td className="px-4 py-2 text-pp text-center">{formatPp(player.pp)}pp</td>
|
||||||
<td className="px-4 py-2 text-center">{formatNumberWithCommas(player.scoreStats.totalPlayCount)}</td>
|
<td className="px-4 py-2 text-center">{formatNumberWithCommas(player.scoreStats.totalPlayCount)}</td>
|
||||||
|
Reference in New Issue
Block a user