diff --git a/projects/backend/src/service/score.service.ts b/projects/backend/src/service/score.service.ts index f8e4938..2af7963 100644 --- a/projects/backend/src/service/score.service.ts +++ b/projects/backend/src/service/score.service.ts @@ -708,6 +708,7 @@ export class ScoreService { pp: previousScore.pp, weight: previousScore.weight, maxCombo: previousScore.maxCombo, + timestamp: previousScore.timestamp, change: { score: score.score - previousScore.score, accuracy: score.accuracy - previousScore.accuracy, diff --git a/projects/common/src/model/score/previous-score.ts b/projects/common/src/model/score/previous-score.ts index 491ed45..714b1fc 100644 --- a/projects/common/src/model/score/previous-score.ts +++ b/projects/common/src/model/score/previous-score.ts @@ -35,4 +35,9 @@ export type PreviousScore = { * The full combo of the previous score. */ fullCombo?: boolean; + + /** + * When the previous score was set. + */ + timestamp: Date; }; diff --git a/projects/website/src/components/score/score-rank-info.tsx b/projects/website/src/components/score/score-rank-info.tsx index 9d3ae68..d40550c 100644 --- a/projects/website/src/components/score/score-rank-info.tsx +++ b/projects/website/src/components/score/score-rank-info.tsx @@ -5,6 +5,7 @@ import { getPageFromRank } from "@ssr/common/utils/utils"; import { ScoreSaberScore } from "@ssr/common/model/score/impl/scoresaber-score"; import ScoreSaberLeaderboard from "@ssr/common/model/leaderboard/impl/scoresaber-leaderboard"; import { ScoreTimeSet } from "@/components/score/score-time-set"; +import { timeAgo } from "@ssr/common/utils/time-utils"; type Props = { score: ScoreSaberScore; @@ -23,6 +24,12 @@ export default function ScoreRankInfo({ score, leaderboard }: Props) { + {score.previousScore?.timestamp && ( +
+

vs

+

{timeAgo(new Date(score.previousScore.timestamp))}

+
+ )} ); } diff --git a/projects/website/src/components/score/score.tsx b/projects/website/src/components/score/score.tsx index b1f3f84..e66ec93 100644 --- a/projects/website/src/components/score/score.tsx +++ b/projects/website/src/components/score/score.tsx @@ -124,8 +124,8 @@ export default function Score({ leaderboard, beatSaverMap, score, settings, high : "grid-cols-[20px 1fr_1fr] lg:grid-cols-[0.5fr_4fr_1fr_350px]"; // Original with buttons return ( -
-
+
+
{!settings?.noScoreButtons && (