show more data on the #1 feed
Some checks failed
Deploy Backend / deploy (push) Failing after 1m26s
Deploy Website / deploy (push) Failing after 1m5s

This commit is contained in:
Lee
2024-10-18 07:56:39 +01:00
parent dd8befa9e0
commit 9fb276ec4e
7 changed files with 112 additions and 53 deletions

View File

@ -1,11 +1,9 @@
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";
import { getScoreBadgeFromAccuracy } from "@/common/song-utils";
import Tooltip from "@/components/tooltip";
import { ScoreBadge, ScoreBadges } from "@/components/score/score-badge";
import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
import FullComboBadge from "@/components/score/badges/full-combo";
const badges: ScoreBadge[] = [
{
@ -57,14 +55,7 @@ const badges: ScoreBadge[] = [
{
name: "Full Combo",
create: (score: ScoreSaberScore) => {
const fullCombo = score.misses === 0;
return (
<>
<p>{fullCombo ? <span className="text-green-400">FC</span> : formatNumberWithCommas(score.misses)}</p>
<XMarkIcon className={clsx("w-5 h-5", fullCombo ? "hidden" : "text-red-400")} />
</>
);
return <FullComboBadge score={score} />;
},
},
];

View File

@ -0,0 +1,8 @@
import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
export type ScoreBadgeProps = {
/**
* The score for this badge
*/
score: ScoreSaberScore;
};

View File

@ -0,0 +1,29 @@
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";
import Tooltip from "@/components/tooltip";
import { ScoreBadgeProps } from "@/components/score/badges/badge-props";
export default function FullComboBadge({ score }: ScoreBadgeProps) {
return (
<Tooltip
display={
<div className="flex flex-col justify-center items-center">
{!score.fullCombo ? (
<>
<p>Missed Notes: {formatNumberWithCommas(score.missedNotes)}</p>
<p>Bad Cuts: {formatNumberWithCommas(score.badCuts)}</p>
</>
) : (
<p>Full Combo</p>
)}
</div>
}
>
<div className="flex gap-1">
<p>{score.fullCombo ? <span className="text-green-400">FC</span> : formatNumberWithCommas(score.misses)}</p>
<XMarkIcon className={clsx("w-5 h-5", score.fullCombo ? "hidden" : "text-red-400")} />
</div>
</Tooltip>
);
}

View File

@ -1,11 +1,10 @@
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
import { getScoreBadgeFromAccuracy } from "@/common/song-utils";
import { XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";
import Tooltip from "@/components/tooltip";
import { ScoreBadge, ScoreBadges } from "@/components/score/score-badge";
import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
import FullComboBadge from "@/components/score/badges/full-combo";
const badges: ScoreBadge[] = [
{
@ -88,33 +87,7 @@ const badges: ScoreBadge[] = [
{
name: "Full Combo",
create: (score: ScoreSaberScore) => {
return (
<Tooltip
display={
<div className="flex flex-col justify-center items-center">
{!score.fullCombo ? (
<>
<p>Missed Notes: {formatNumberWithCommas(score.misses)}</p>
<p>Bad Cuts: {formatNumberWithCommas(score.badCuts)}</p>
</>
) : (
<p>Full Combo</p>
)}
</div>
}
>
<div className="flex gap-1">
<p>
{score.fullCombo ? (
<span className="text-green-400">FC</span>
) : (
formatNumberWithCommas(score.misses + score.badCuts)
)}
</p>
<XMarkIcon className={clsx("w-5 h-5", score.fullCombo ? "hidden" : "text-red-400")} />
</div>
</Tooltip>
);
return <FullComboBadge score={score} />;
},
},
];