Update giveaway entry count

This commit is contained in:
EdiFarcas
2025-05-05 15:23:23 +03:00
parent 31f04039b2
commit 3d1fe2d520
3 changed files with 2506 additions and 2328 deletions
+2491 -2328
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
import { db } from "@/lib/db";
async function entrycount(userId: string, giveawayId: string) {
const entryCount = await db.entry.count({
where: {
userId: userId,
giveawayId: giveawayId,
},
});
return entryCount;
}
export default entrycount;
+2
View File
@@ -1,6 +1,7 @@
"use client"
import React, { useState } from 'react';
import handleEnterGiveawayClick from './GiveawayCardServer';
import entrycount from './EntryCount';
interface GiveawayCardProps {
id: string;
@@ -34,6 +35,7 @@ const GiveawayCard: React.FC<GiveawayCardProps> = ({ id, title, description, ima
<h3 className="text-lg font-bold mb-2">{title}</h3>
<p className="text-gray-600 text-sm">{description}</p>
<p className="text-gray-600 text-sm mt-2">Value: {value} coins</p>
<p className="text-gray-600 text-sm mt-2">Your entries: {entrycount(userId, id)}</p>
</div>
<div className="p-4 flex items-center">
<button