From 1c2214a65906cabd07456d61c42f2d95667edf41 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 28 Oct 2024 16:22:33 +0000 Subject: [PATCH] made the player page look much nicer --- .../components/score/badges/hand-accuracy.tsx | 2 +- .../score/badges/score-misses-and-pauses.tsx | 127 ++++++++++-------- .../src/components/score/score-badge.tsx | 17 ++- .../src/components/score/score-song-info.tsx | 2 +- .../src/components/score/score-stats.tsx | 6 +- .../website/src/components/score/score.tsx | 8 +- .../website/src/components/stat-value.tsx | 10 +- projects/website/src/components/tooltip.tsx | 21 ++- 8 files changed, 112 insertions(+), 81 deletions(-) diff --git a/projects/website/src/components/score/badges/hand-accuracy.tsx b/projects/website/src/components/score/badges/hand-accuracy.tsx index 970699b..6dc0719 100644 --- a/projects/website/src/components/score/badges/hand-accuracy.tsx +++ b/projects/website/src/components/score/badges/hand-accuracy.tsx @@ -21,7 +21,7 @@ export function HandAccuracyBadge({ score, hand }: HandAccuracyProps) { const formattedHand = capitalizeFirstLetter(hand); return ( -
+
diff --git a/projects/website/src/components/score/badges/score-misses-and-pauses.tsx b/projects/website/src/components/score/badges/score-misses-and-pauses.tsx index 1bfd05a..94748f7 100644 --- a/projects/website/src/components/score/badges/score-misses-and-pauses.tsx +++ b/projects/website/src/components/score/badges/score-misses-and-pauses.tsx @@ -1,9 +1,7 @@ import { formatNumberWithCommas } from "@ssr/common/utils/number-utils"; -import { PauseIcon } from "@heroicons/react/24/solid"; import { ScoreBadgeProps } from "@/components/score/badges/badge-props"; import { ScoreMissesTooltip } from "@/components/score/score-misses-tooltip"; import { Misses } from "@ssr/common/model/additional-score-data/misses"; -import Tooltip from "@/components/tooltip"; type ScoreMissesBadgeProps = ScoreBadgeProps & { /** @@ -34,69 +32,82 @@ export default function ScoreMissesAndPausesBadge({ score, hideXMark }: ScoreMis return (
- -
+
+

{score.fullCombo ? FC : formatNumberWithCommas(score.misses)} {!hideXMark && !score.fullCombo && x}

-
- - {additionalData && !!pauses && pauses > 0 && ( - <> -

|

- - {pauses}x Pause{pauses > 1 ? "s" : ""} -

- } + + {additionalData && previousScoreMisses && scoreImprovement && misses && isMissImprovement && ( + -
-

{pauses && pauses}

- +
+

(vs {previousScoreFc ? "FC" : formatNumberWithCommas(previousScoreMisses.misses)}x)

- - - )} -
- {additionalData && previousScoreMisses && scoreImprovement && misses && isMissImprovement && ( -
- -
- {previousScoreFc ? ( -

FC

- ) : ( - formatNumberWithCommas(previousScoreMisses.misses) - )} -
-
-

->

- -
- {additionalData.fullCombo ?

FC

: formatNumberWithCommas(misses.misses)} -
-
+ + )}
- )} + {/*{additionalData && !!pauses && pauses > 0 && (*/} + {/* <>*/} + {/*

|

*/} + {/* */} + {/* {pauses}x Pause{pauses > 1 ? "s" : ""}*/} + {/*

*/} + {/* }*/} + {/* >*/} + {/*
*/} + {/*

{pauses && pauses}

*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/*)}*/} +
+ {/*{additionalData && previousScoreMisses && scoreImprovement && misses && isMissImprovement && (*/} + {/*
*/} + {/* */} + {/*
*/} + {/* {previousScoreFc ? (*/} + {/*

FC

*/} + {/* ) : (*/} + {/* formatNumberWithCommas(previousScoreMisses.misses)*/} + {/* )}*/} + {/*
*/} + {/* */} + {/*

->

*/} + {/* */} + {/*
*/} + {/* {additionalData.fullCombo ?

FC

: formatNumberWithCommas(misses.misses)}*/} + {/*
*/} + {/* */} + {/*
*/} + {/*)}*/}
); } diff --git a/projects/website/src/components/score/score-badge.tsx b/projects/website/src/components/score/score-badge.tsx index c278f5e..7450abb 100644 --- a/projects/website/src/components/score/score-badge.tsx +++ b/projects/website/src/components/score/score-badge.tsx @@ -1,6 +1,6 @@ -import StatValue from "@/components/stat-value"; import { ScoreSaberScore } from "@ssr/common/model/score/impl/scoresaber-score"; import ScoreSaberLeaderboard from "@ssr/common/model/leaderboard/impl/scoresaber-leaderboard"; +import clsx from "clsx"; /** * A badge to display in the score stats. @@ -27,6 +27,19 @@ export function ScoreBadges({ badges, score, leaderboard }: ScoreBadgeProps) { if (toRender === undefined) { return
; } - return ; + return ( +
+ {toRender} +
+ ); }); } diff --git a/projects/website/src/components/score/score-song-info.tsx b/projects/website/src/components/score/score-song-info.tsx index 6450700..77233e3 100644 --- a/projects/website/src/components/score/score-song-info.tsx +++ b/projects/website/src/components/score/score-song-info.tsx @@ -63,7 +63,7 @@ export default function ScoreSongInfo({ leaderboard, beatSaverMap }: Props) { > {leaderboard.songName} {leaderboard.songSubName} -
+

{leaderboard.songAuthorName}

- +
+
+ +
); } diff --git a/projects/website/src/components/score/score.tsx b/projects/website/src/components/score/score.tsx index c44f00e..b1f3f84 100644 --- a/projects/website/src/components/score/score.tsx +++ b/projects/website/src/components/score/score.tsx @@ -120,12 +120,12 @@ export default function Score({ leaderboard, beatSaverMap, score, settings, high }; const gridColsClass = settings?.noScoreButtons - ? "grid-cols-[20px 1fr_1fr] lg:grid-cols-[0.5fr_4fr_300px]" // Fewer columns if no buttons - : "grid-cols-[20px 1fr_1fr] lg:grid-cols-[0.5fr_4fr_1fr_300px]"; // Original with buttons + ? "grid-cols-[20px 1fr_1fr] lg:grid-cols-[0.5fr_4fr_350px]" // Fewer columns if no buttons + : "grid-cols-[20px 1fr_1fr] lg:grid-cols-[0.5fr_4fr_1fr_350px]"; // Original with buttons return ( -
-
+
+
{!settings?.noScoreButtons && ( diff --git a/projects/website/src/components/stat-value.tsx b/projects/website/src/components/stat-value.tsx index 247984a..2a2cd02 100644 --- a/projects/website/src/components/stat-value.tsx +++ b/projects/website/src/components/stat-value.tsx @@ -16,18 +16,24 @@ type Props = { */ color?: string; + /** + * The additional classes for the stat. + */ + className?: string; + /** * The value of the stat. */ value: React.ReactNode; }; -export default function StatValue({ name, icon, color, value }: Props) { +export default function StatValue({ name, icon, color, className, value }: Props) { return (
setOpen(true)} - onMouseLeave={() => setOpen(false)} - onTouchStart={() => setOpen(!open)} - onTouchEnd={() => setOpen(!open)} - > - {children} -
+ setOpen(true)} + onMouseLeave={() => setOpen(false)} + onTouchStart={() => setOpen(!open)} + onTouchEnd={() => setOpen(!open)} + > + {children} {display}