cleanup
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m15s
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m15s
This commit is contained in:
parent
1e8c38eb26
commit
9b549f8dc6
@ -3,9 +3,9 @@ import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-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 { PlayerInfo } from "@/components/player/player-info";
|
import { PlayerInfo } from "@/components/player/player-info";
|
||||||
import { clsx } from "clsx";
|
import { clsx } from "clsx";
|
||||||
import { Modifier } from "@ssr/common/score/modifier";
|
|
||||||
import Tooltip from "@/components/tooltip";
|
import Tooltip from "@/components/tooltip";
|
||||||
import { ScoreTimeSet } from "@/components/score/score-time-set";
|
import { ScoreTimeSet } from "@/components/score/score-time-set";
|
||||||
|
import { ScoreModifiers } from "@/components/score/score-modifiers";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
/**
|
/**
|
||||||
@ -62,15 +62,12 @@ export default function LeaderboardScore({ score, claimedPlayer }: Props) {
|
|||||||
display={
|
display={
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold">Modifiers</p>
|
<p className="font-semibold">Modifiers</p>
|
||||||
<p>{score.modifiers.join(", ")}</p>
|
<ScoreModifiers type="full" score={score} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p className="cursor-pointer">
|
<p className="cursor-pointer">
|
||||||
{Object.entries(Modifier)
|
<ScoreModifiers type="simple" score={score} />
|
||||||
.filter(mod => score.modifiers.includes(mod[1] as Modifier))
|
|
||||||
.map(mod => mod[0])
|
|
||||||
.join(",")}
|
|
||||||
</p>
|
</p>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</td>
|
</td>
|
||||||
|
30
projects/website/src/components/score/score-modifiers.tsx
Normal file
30
projects/website/src/components/score/score-modifiers.tsx
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
|
||||||
|
import { Modifier } from "@ssr/common/score/modifier";
|
||||||
|
|
||||||
|
type ScoreModifiersProps = {
|
||||||
|
/**
|
||||||
|
* The score to get the modifiers from
|
||||||
|
*/
|
||||||
|
score: ScoreSaberScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The way to display the modifiers
|
||||||
|
*/
|
||||||
|
type: "full" | "simple";
|
||||||
|
};
|
||||||
|
|
||||||
|
export function ScoreModifiers({ score, type }: ScoreModifiersProps) {
|
||||||
|
switch (type) {
|
||||||
|
case "full":
|
||||||
|
return <span>{score.modifiers.join(", ")}</span>;
|
||||||
|
case "simple":
|
||||||
|
return (
|
||||||
|
<span>
|
||||||
|
{Object.entries(Modifier)
|
||||||
|
.filter(mod => score.modifiers.includes(mod[1] as Modifier))
|
||||||
|
.map(mod => mod[0])
|
||||||
|
.join(",")}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
|
|||||||
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
|
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
|
||||||
import FullComboBadge from "@/components/score/badges/full-combo";
|
import FullComboBadge from "@/components/score/badges/full-combo";
|
||||||
import { Modifier } from "@ssr/common/score/modifier";
|
import { Modifier } from "@ssr/common/score/modifier";
|
||||||
|
import { ScoreModifiers } from "@/components/score/score-modifiers";
|
||||||
|
|
||||||
const badges: ScoreBadge[] = [
|
const badges: ScoreBadge[] = [
|
||||||
{
|
{
|
||||||
@ -71,22 +72,14 @@ const badges: ScoreBadge[] = [
|
|||||||
{modCount > 0 && (
|
{modCount > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<p className="font-semibold">Modifiers</p>
|
<p className="font-semibold">Modifiers</p>
|
||||||
<p>{score.modifiers.join(", ")}</p>
|
<ScoreModifiers type="full" score={score} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p className="cursor-default">
|
<p className="cursor-default">
|
||||||
{acc.toFixed(2)}%
|
{acc.toFixed(2)}% {modCount > 0 && <ScoreModifiers type="simple" score={score} />}
|
||||||
{modCount > 0
|
|
||||||
? ` ${
|
|
||||||
Object.entries(Modifier)
|
|
||||||
.filter(mod => score.modifiers.includes(mod[1] as Modifier))
|
|
||||||
.map(mod => mod[0])
|
|
||||||
.slice(0, 1)[0]
|
|
||||||
}`
|
|
||||||
: ""}
|
|
||||||
</p>
|
</p>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</>
|
</>
|
||||||
|
Reference in New Issue
Block a user