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

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

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

@ -1,7 +1,9 @@
import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-score-token"; import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-score-token";
import { formatNumberWithCommas } from "@/common/number-utils"; import { formatNumberWithCommas } from "@/common/number-utils";
import { timeAgo } from "@/common/time-utils"; import { timeAgo } from "@/common/time-utils";
import { format } from "@formkit/tempo";
import { GlobeAmericasIcon } from "@heroicons/react/24/solid"; import { GlobeAmericasIcon } from "@heroicons/react/24/solid";
import Tooltip from "../tooltip";
type Props = { type Props = {
score: ScoreSaberScoreToken; score: ScoreSaberScoreToken;
@ -14,7 +16,18 @@ export default function ScoreRankInfo({ score }: Props) {
<GlobeAmericasIcon className="w-5 h-5" /> <GlobeAmericasIcon className="w-5 h-5" />
<p className="text-pp">#{formatNumberWithCommas(score.rank)}</p> <p className="text-pp">#{formatNumberWithCommas(score.rank)}</p>
</div> </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> </div>
); );
} }

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