fix bsr copy

This commit is contained in:
Lee 2024-09-11 23:18:02 +01:00
parent b5df147728
commit fe4532d7cd
2 changed files with 10 additions and 8 deletions

@ -62,10 +62,10 @@ export default function Pagination({ mobilePagination, page, totalPages, onPageC
if (startPage > 1 && !mobilePagination) {
pageNumbers.push(
<>
<PaginationItem key="start">
<PaginationItem key="start" className="cursor-pointer">
<PaginationLink onClick={() => handlePageChange(1)}>1</PaginationLink>
</PaginationItem>
<PaginationItem key="ellipsis-start">
<PaginationItem key="ellipsis-start" className="cursor-pointer">
<PaginationEllipsis />
</PaginationItem>
</>
@ -75,7 +75,7 @@ export default function Pagination({ mobilePagination, page, totalPages, onPageC
// Generate page numbers between startPage and endPage for desktop view
for (let i = startPage; i <= endPage; i++) {
pageNumbers.push(
<PaginationItem key={i}>
<PaginationItem key={i} className="cursor-pointer">
<PaginationLink isActive={i === currentPage} onClick={() => handlePageChange(i)}>
{i}
</PaginationLink>
@ -90,7 +90,7 @@ export default function Pagination({ mobilePagination, page, totalPages, onPageC
<ShadCnPagination className="select-none">
<PaginationContent>
{/* Previous button for mobile and desktop */}
<PaginationItem>
<PaginationItem className="cursor-pointer">
<PaginationPrevious onClick={() => handlePageChange(currentPage - 1)} />
</PaginationItem>
@ -100,16 +100,16 @@ export default function Pagination({ mobilePagination, page, totalPages, onPageC
{!mobilePagination && currentPage < totalPages && (
<>
<PaginationItem key="ellipsis-end">
<PaginationEllipsis />
<PaginationEllipsis className="cursor-default" />
</PaginationItem>
<PaginationItem key="end">
<PaginationItem key="end" className="cursor-pointer">
<PaginationLink onClick={() => handlePageChange(totalPages)}>{totalPages}</PaginationLink>
</PaginationItem>
</>
)}
{/* Next button for mobile and desktop */}
<PaginationItem>
<PaginationItem className="cursor-pointer">
<PaginationNext onClick={() => handlePageChange(currentPage + 1)} />
</PaginationItem>
</PaginationContent>

@ -1,5 +1,6 @@
"use client";
import { copyToClipboard } from "@/common/browser-utils";
import { beatsaverFetcher } from "@/common/data-fetcher/impl/beatsaver";
import ScoreSaberPlayerScore from "@/common/data-fetcher/types/scoresaber/scoresaber-player-score";
import { formatNumberWithCommas } from "@/common/number-utils";
@ -30,7 +31,7 @@ export default function Score({ playerScore }: Props) {
const bsrFound = await beatsaverFetcher.getMapBsr(leaderboard.songHash);
setBsr(bsrFound);
})();
}, [playerScore]);
}, [playerScore, leaderboard.songHash]);
return (
<div className="grid gap-2 md:gap-0 pb-2 pt-2 first:pt-0 last:pb-0 grid-cols-[20px 1fr_1fr] md:grid-cols-[0.85fr_5fr_1fr_1.2fr]">
@ -68,6 +69,7 @@ export default function Score({ playerScore }: Props) {
title: "Copied!",
description: `Copied "!bsr ${bsr}" to your clipboard!`,
});
copyToClipboard(`!bsr ${bsr}`);
}}
tooltip={<p>Click to copy the bsr code</p>}
>