fixed limit

This commit is contained in:
MasterGordon 2024-10-15 22:20:58 +02:00
parent 157e4768f3
commit 10c64268c8
3 changed files with 8 additions and 2 deletions

View File

@ -33,6 +33,7 @@ export const removeGems = async (
gems: number,
) => {
const { count, totalCount } = await getGems(db, user);
if (count - gems < 0) throw new Error("Not enough gems");
await db
.update(Gems)
.set({ count: count - gems, totalCount: totalCount - gems })

View File

@ -16,7 +16,7 @@ interface LeaderboardButtonProps {
const LeaderboardButton = ({
label = "View Full Leaderboard",
}: LeaderboardButtonProps) => {
const { data: leaderboard } = useWSQuery("scoreboard.getScoreBoard", 10);
const { data: leaderboard } = useWSQuery("scoreboard.getScoreBoard", 100);
return (
<Dialog>
<DialogTrigger asChild>

View File

@ -29,6 +29,8 @@ const Collection = () => {
(e) => e.id === theme.id && e.selected,
);
const owned = collection?.entries.some((e) => e.id === theme.id);
const times =
collection?.entries.filter((e) => e.id === theme.id).length || 0;
if (!owned) return null;
return (
<div key={theme.id}>
@ -36,7 +38,10 @@ const Collection = () => {
<h3 className="text-white/90 text-lg">
{theme.name}
{owned && (
<span className="text-white/70 text-sm"> (Owned)</span>
<span className="text-white/70 text-sm">
{" "}
(Owned{times > 1 && ` ${times}x`})
</span>
)}
</h3>
{owned && (