mirror of
https://github.com/EdiFarcas/Giveaway-app.git
synced 2026-06-22 07:00:57 +03:00
Update giveaway entry count
This commit is contained in:
Generated
+2491
-2328
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user