Skip to content

Commit ee8cc44

Browse files
author
martinvibes
committed
chore: remove specific pool
1 parent 42fd967 commit ee8cc44

File tree

2 files changed

+16
-151
lines changed

2 files changed

+16
-151
lines changed

frontend/src/app/dashboard/crowd-fund/components/CrowdFundDashboard.tsx

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ const CrowdFundDashboard: React.FC<CrowdFundDashboardProps> = ({
153153

154154
{/* Existing Funding Cards */}
155155
{paginatedFundings?.map((funding) => {
156-
// Special Pool Logic
157-
const SPECIAL_POOL_ADDRESS =
158-
"0x0491e7064752699c7b15fe2476319b3d04bec0404f98f3d57c2e1cff2239fc1f";
159156
const USDC_TOKEN_ADDRESS =
160157
"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8";
161158

@@ -177,10 +174,6 @@ const CrowdFundDashboard: React.FC<CrowdFundDashboardProps> = ({
177174
);
178175
});
179176

180-
const isSpecialPool =
181-
normalizedPoolAddr.toLowerCase() ===
182-
SPECIAL_POOL_ADDRESS.toLowerCase();
183-
184177
// Calculate Balances and Targets
185178
let currentBalance = 0;
186179
let targetValue = 0;
@@ -208,29 +201,13 @@ const CrowdFundDashboard: React.FC<CrowdFundDashboardProps> = ({
208201
targetValue = rawTarget / decimals;
209202
} else {
210203
// Fallback to Contract Data
211-
// funding.balance is from contract. implementation in hook seemed to not divide it.
212-
// funding.target is from contract. implementation in hook divided it by 1e18.
213-
// This mismatch causes issues if we just mix them.
214-
215-
// However, based on previous code:
216-
// currentBalance = balance / 1e18 (or 1e6 special)
217-
// targetValue = target (already divided by 1e18 in hook) OR 300 special.
218-
219-
currentBalance = isSpecialPool
220-
? Number.parseFloat(funding.balance.toString()) / 1e6
221-
: Number.parseFloat(funding.balance.toString()) / 1e18;
222-
targetValue = isSpecialPool
223-
? 300
224-
: Number.parseFloat(funding.target.toString());
225-
}
226-
227-
if (isSpecialPool) {
228-
targetValue = 300;
204+
currentBalance =
205+
Number.parseFloat(funding.balance.toString()) / 1e18;
206+
targetValue = Number.parseFloat(funding.target.toString());
229207
}
230208

231-
const isCompleted = isSpecialPool
232-
? currentBalance >= 300
233-
: findPool?.crowd_funding.is_complete || funding.is_completed; // Use API or Contract completion status
209+
const isCompleted =
210+
findPool?.crowd_funding.is_complete || funding.is_completed;
234211

235212
return (
236213
<div

frontend/src/app/dashboard/crowd-fund/details/[shortId]/[id]/page.tsx

Lines changed: 11 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -327,19 +327,6 @@ const FundingDetailsPage = () => {
327327
? formatAmountUsdc(usdcTokenBalance.balance)
328328
: "0.00";
329329

330-
// REMOVE ALL THIS ONES LATER
331-
const SPECIAL_POOL_ADDRESS =
332-
"0x0491e7064752699c7b15fe2476319b3d04bec0404f98f3d57c2e1cff2239fc1f";
333-
const isSpecialPool =
334-
crowdFundingAddr &&
335-
crowdFundingAddr.toLowerCase() === SPECIAL_POOL_ADDRESS.toLowerCase();
336-
337-
const finalTargetAmount = isSpecialPool ? "300.00" : targetAmount;
338-
339-
const isFinalCompleted = isSpecialPool
340-
? Number(amountRaised) >= 300
341-
: pool?.is_completed || usdcBalance?.crowd_funding?.is_complete;
342-
343330
useEffect(() => {
344331
getUsdcBalance();
345332

@@ -493,7 +480,7 @@ Every contribution counts — let's build something amazing together! 💫
493480
return (
494481
<div className="min-h-screen mb-10 relative">
495482
{/* Pool Completed Overlay */}
496-
{/* {pool?.is_completed && (
483+
{pool?.is_completed && (
497484
<div className="fixed inset-0 z-50 flex items-center justify-center bg-[#00000036] bg-opacity-50 backdrop-blur-sm animate-in fade-in duration-300">
498485
<div className="bg-[#1F2937] border border-[#10B981] rounded-lg p-8 max-w-md mx-4 text-center shadow-2xl animate-in zoom-in-95 duration-300">
499486
<div className="w-16 h-16 bg-[#10B981] rounded-full flex items-center justify-center mx-auto mb-4 animate-pulse">
@@ -510,9 +497,7 @@ Every contribution counts — let's build something amazing together! 💫
510497
<div className="flex justify-between items-center text-sm">
511498
<span className="text-[#6EE7B7]">Final Amount Raised:</span>
512499
<span className="text-[#10B981] font-bold">
513-
{formatAmountUsdc(
514-
usdcBalance?.token_history?.[0]?.balance as string
515-
)}{" "}
500+
{amountRaised}
516501
USDC
517502
</span>
518503
</div>
@@ -541,74 +526,15 @@ Every contribution counts — let's build something amazing together! 💫
541526
</button>
542527
</div>
543528
</div>
544-
)} */}
545-
546-
{isFinalCompleted && (
547-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-[#00000036] bg-opacity-50 backdrop-blur-sm animate-in fade-in duration-300">
548-
<div className="bg-[#1F2937] border border-[#10B981] rounded-lg p-8 max-w-md mx-4 text-center shadow-2xl animate-in zoom-in-95 duration-300">
549-
<div className="w-16 h-16 bg-[#10B981] rounded-full flex items-center justify-center mx-auto mb-4 animate-pulse">
550-
<Check className="w-8 h-8 text-white" />
551-
</div>
552-
<h2 className="text-2xl font-bold text-[#10B981] mb-2">
553-
Campaign Completed! 🎉
554-
</h2>
555-
<p className="text-[#DFDFE0] mb-4">
556-
This funding campaign has reached its target goal and is now
557-
closed.
558-
</p>
559-
<div className="bg-[#064E3B] border border-[#10B981] rounded-sm p-4 mb-6">
560-
<div className="flex justify-between items-center text-sm">
561-
<span className="text-[#6EE7B7]">Final Amount Raised:</span>
562-
<span className="text-[#10B981] font-bold">
563-
{/* {(Number.parseFloat(pool.balance.toString()) / 1e18).toFixed(
564-
2
565-
)}{" "} */}
566-
{formatAmountUsdc(
567-
usdcBalance?.token_history?.[0]?.balance as string
568-
)}{" "}
569-
USDC
570-
</span>
571-
</div>
572-
<div className="flex justify-between items-center text-sm mt-2">
573-
<span className="text-[#6EE7B7]">Target Goal:</span>
574-
<span className="text-[#DFDFE0]">{finalTargetAmount} USDC</span>
575-
{/* <span className="text-[#DFDFE0]">{targetAmount} USDC</span> */}
576-
</div>
577-
<div className="flex justify-between items-center text-sm mt-2">
578-
<span className="text-[#51be58]">Donors:</span>
579-
<span className="text-[#DFDFE0]">
580-
{usdcBalance?.donation_count?.total_donors || 0}
581-
</span>
582-
</div>
583-
<div className="flex justify-between items-center text-sm mt-2">
584-
<span className="text-[#6EE7B7] font-medium">
585-
Date Created:
586-
</span>
587-
<span className="text-[#DFDFE0]">{pool.create_at}</span>
588-
</div>
589-
</div>
590-
<button
591-
onClick={() => router.push("/dashboard/crowd-fund")}
592-
className="w-full bg-gradient-to-r from-[#10B981] to-[#059669] text-white py-3 px-4 rounded-sm hover:opacity-90 transition-opacity duration-200 font-medium cursor-pointer"
593-
>
594-
Back to All Campaigns
595-
</button>
596-
</div>
597-
</div>
598529
)}
599530

600531
{/* Header */}
601-
{/* <div
532+
<div
602533
className={`mb-8 border-b border-[#FFFFFF0D] pb-8 ${
603534
usdcBalance?.crowd_funding?.is_complete
604535
? "blur-sm pointer-events-none"
605536
: ""
606537
}`}
607-
> */}
608-
<div
609-
className={`mb-8 border-b border-[#FFFFFF0D] pb-8 ${
610-
isFinalCompleted ? "blur-sm pointer-events-none" : ""
611-
}`}
612538
>
613539
<button
614540
onClick={() => router.push("/dashboard/crowd-fund")}
@@ -626,8 +552,7 @@ Every contribution counts — let's build something amazing together! 💫
626552
{/* Share Section - Compact */}
627553
<div
628554
className={`mb-6 ${
629-
isFinalCompleted ? "blur-sm pointer-events-none" : ""
630-
// pool.is_completed ? "blur-sm pointer-events-none" : ""
555+
pool.is_completed ? "blur-sm pointer-events-none" : ""
631556
}`}
632557
>
633558
<div className="flex items-center flex-wrap gap-2 sm:gap-4">
@@ -663,8 +588,7 @@ Every contribution counts — let's build something amazing together! 💫
663588

664589
<div
665590
className={`flex items-center gap-2 mb-5 ${
666-
isFinalCompleted ? "blur-sm pointer-events-none" : ""
667-
// pool.is_completed ? "blur-sm pointer-events-none" : ""
591+
pool.is_completed ? "blur-sm pointer-events-none" : ""
668592
}`}
669593
>
670594
<span className="text-[#434672] font-semibold">
@@ -689,10 +613,9 @@ Every contribution counts — let's build something amazing together! 💫
689613

690614
<div
691615
className={`grid grid-cols-1 lg:grid-cols-3 gap-8 ${
692-
isFinalCompleted ? "blur-sm pointer-events-none" : ""
693-
// usdcBalance?.crowd_funding?.is_complete
694-
// ? "blur-sm pointer-events-none"
695-
// : ""
616+
usdcBalance?.crowd_funding?.is_complete
617+
? "blur-sm pointer-events-none"
618+
: ""
696619
}`}
697620
>
698621
{/* Main Content */}
@@ -710,7 +633,7 @@ Every contribution counts — let's build something amazing together! 💫
710633
</div>
711634

712635
<div className="space-y-2">
713-
{/* <h2 className="text-white font-extrabold text-xl">
636+
<h2 className="text-white font-extrabold text-xl">
714637
{usdcBalance?.crowd_funding.is_complete
715638
? 100
716639
: Math.min(
@@ -745,39 +668,6 @@ Every contribution counts — let's build something amazing together! 💫
745668
<div className="flex justify-between text-sm text-[#8398AD]">
746669
<span>Raised: {amountRaised} USDC</span>
747670
<span>Target: {targetAmount} USDC</span>
748-
</div> */}
749-
<h2 className="text-white font-extrabold text-xl">
750-
{isFinalCompleted
751-
? 100
752-
: Math.min(
753-
(Number(amountRaised) / Number(finalTargetAmount)) *
754-
100,
755-
100
756-
).toFixed(2)}
757-
%
758-
</h2>{" "}
759-
<div className="w-full bg-[#282e38] rounded-full h-2.5">
760-
<div
761-
className={`bg-blue-600 h-2.5 rounded-full transition-all duration-300`}
762-
style={{
763-
width: `${
764-
!isFinalCompleted
765-
? Math.min(
766-
(Number(amountRaised) /
767-
Number(finalTargetAmount)) *
768-
100,
769-
100
770-
)
771-
: 100
772-
}%`,
773-
}}
774-
>
775-
{" "}
776-
</div>
777-
</div>
778-
<div className="flex justify-between text-sm text-[#8398AD]">
779-
<span>Raised: {amountRaised} USDC</span>
780-
<span>Target: {finalTargetAmount} USDC</span>
781671
</div>
782672
</div>
783673
</div>
@@ -836,8 +726,7 @@ Every contribution counts — let's build something amazing together! 💫
836726
<Target className="w-5 h-5 text-[#8398AD]" />
837727
<div>
838728
<p className="text-[#DFDFE0] font-medium">
839-
{finalTargetAmount} USDC
840-
{/* {targetAmount} USDC */}
729+
{targetAmount} USDC
841730
</p>
842731
<p className="text-[#8398AD] text-sm">Target Amount</p>
843732
</div>
@@ -846,8 +735,7 @@ Every contribution counts — let's build something amazing together! 💫
846735
</div>
847736

848737
{/* Contribute Button */}
849-
{/* {!pool.is_completed && ( */}
850-
{!isFinalCompleted && (
738+
{!pool.is_completed && (
851739
<div className="bg-[#FFFFFF0D] border border-[#FFFFFF0D] rounded-sm p-6">
852740
<h3 className="text-[#DFDFE0] font-medium text-lg mb-4">
853741
Support This Campaign

0 commit comments

Comments
 (0)