add time set hover to scores
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
Lee 2024-09-27 22:05:46 +01:00
parent 89389667f8
commit 0a2faf80e0
4 changed files with 20 additions and 21 deletions

View File

@ -66,7 +66,7 @@ export default function RootLayout({
<Toaster />
<BackgroundImage />
<PreloadResources />
<TooltipProvider>
<TooltipProvider delayDuration={100}>
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem disableTransitionOnChange>
<QueryProvider>
<AnimatePresence>

View File

@ -1,5 +1,5 @@
import ScoreSaberLeaderboardToken from "@/common/model/token/scoresaber/score-saber-leaderboard-token";
import BeatSaverMap from "@/common/database/types/beatsaver-map";
import ScoreSaberLeaderboardToken from "@/common/model/token/scoresaber/score-saber-leaderboard-token";
import { getDifficultyFromScoreSaberDifficulty } from "@/common/scoresaber-utils";
import { songDifficultyToColor } from "@/common/song-utils";
import FallbackLink from "@/components/fallback-link";
@ -14,13 +14,9 @@ type Props = {
};
export default function ScoreSongInfo({ leaderboard, beatSaverMap }: Props) {
const diff = getDifficultyFromScoreSaberDifficulty(
leaderboard.difficulty.difficulty,
);
const diff = getDifficultyFromScoreSaberDifficulty(leaderboard.difficulty.difficulty);
const mappersProfile =
beatSaverMap != undefined
? `https://beatsaver.com/profile/${beatSaverMap?.fullData.uploader.id}`
: undefined;
beatSaverMap != undefined ? `https://beatsaver.com/profile/${beatSaverMap?.fullData.uploader.id}` : undefined;
return (
<div className="flex gap-3 items-center">
@ -72,13 +68,7 @@ export default function ScoreSongInfo({ leaderboard, beatSaverMap }: Props) {
</p>
<p className="text-sm text-gray-400">{leaderboard.songAuthorName}</p>
<FallbackLink href={mappersProfile}>
<p
className={clsx(
"text-sm",
mappersProfile &&
"hover:brightness-75 transform-gpu transition-all",
)}
>
<p className={clsx("text-sm", mappersProfile && "hover:brightness-75 transform-gpu transition-all")}>
{leaderboard.levelAuthorName}
</p>
</FallbackLink>

View File

@ -1,7 +1,9 @@
import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-score-token";
import { formatNumberWithCommas } from "@/common/number-utils";
import { timeAgo } from "@/common/time-utils";
import { format } from "@formkit/tempo";
import { GlobeAmericasIcon } from "@heroicons/react/24/solid";
import Tooltip from "../tooltip";
type Props = {
score: ScoreSaberScoreToken;
@ -14,7 +16,18 @@ export default function ScoreRankInfo({ score }: Props) {
<GlobeAmericasIcon className="w-5 h-5" />
<p className="text-pp">#{formatNumberWithCommas(score.rank)}</p>
</div>
<p className="text-sm">{timeAgo(new Date(score.timeSet))}</p>
<Tooltip
display={
<p>
{format({
date: new Date(score.timeSet),
format: "DD MMMM YYYY HH:mm a",
})}
</p>
}
>
<p className="text-sm cursor-default">{timeAgo(new Date(score.timeSet))}</p>
</Tooltip>
</div>
);
}

View File

@ -1,8 +1,4 @@
import {
Tooltip as ShadCnTooltip,
TooltipContent,
TooltipTrigger,
} from "./ui/tooltip";
import { Tooltip as ShadCnTooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
type Props = {
/**