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, gems: number,
) => { ) => {
const { count, totalCount } = await getGems(db, user); const { count, totalCount } = await getGems(db, user);
if (count - gems < 0) throw new Error("Not enough gems");
await db await db
.update(Gems) .update(Gems)
.set({ count: count - gems, totalCount: totalCount - gems }) .set({ count: count - gems, totalCount: totalCount - gems })

View File

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

View File

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