From 945758e8792178448a8d7962da5672e754d51b76 Mon Sep 17 00:00:00 2001 From: Alexandru Eduard Farcas Date: Mon, 5 May 2025 02:54:38 +0300 Subject: [PATCH] Small update --- src/app/giveaways/page.tsx | 2 ++ src/components/GiveawayCard.tsx | 54 +++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/app/giveaways/page.tsx b/src/app/giveaways/page.tsx index 54e832b..00439c0 100644 --- a/src/app/giveaways/page.tsx +++ b/src/app/giveaways/page.tsx @@ -18,6 +18,7 @@ export default async function GiveawaysPage() { title: true, description: true, prize: true, + value: true, endsAt: true, }, }); @@ -62,6 +63,7 @@ export default async function GiveawaysPage() { title={giveaway.title} description={`${giveaway.description} — 🕒 ${countdownText}`} imageUrl={giveaway.prize} + value={giveaway.value} /> ); diff --git a/src/components/GiveawayCard.tsx b/src/components/GiveawayCard.tsx index 31f01a2..02744db 100644 --- a/src/components/GiveawayCard.tsx +++ b/src/components/GiveawayCard.tsx @@ -5,14 +5,19 @@ interface GiveawayCardProps { title: string; description: string; imageUrl: string; + value: number; } -const GiveawayCard: React.FC = ({ title, description, imageUrl }) => { +const GiveawayCard: React.FC = ({ title, description, imageUrl, value }) => { const [isModalOpen, setIsModalOpen] = useState(false); const handleEnterClick = () => { - // Logic to enter the giveaway - setIsModalOpen(true); + const activeUserCoins = 300; // Replace with actual logic to fetch active user's coins (TO DO LATER) + if (activeUserCoins >= value) { + setIsModalOpen(true); + } else { + alert("You do not have enough coins to enter this giveaway."); + } }; const handleCloseModal = () => { @@ -22,35 +27,44 @@ const GiveawayCard: React.FC = ({ title, description, imageUr return (
-
-

{title}

-

{description}

-
-
- -
+
+

{title}

+

{description}

+

Value: {value} coins

+
+
+ +
{/* Modal */} {isModalOpen && ( -
-
-

{title}

-

{description}

- {title} +
+
+

{title}

+

{description}

+ {title} +
+
+
)}
);