From 974c2a06e60a7c6aac825c3f0b7c2d54c6f506be Mon Sep 17 00:00:00 2001 From: "Carina.Akaia.io" Date: Mon, 24 Jun 2024 21:04:53 +0400 Subject: [PATCH] wip --- src/app/_components/Hero.tsx | 28 ++++++-- src/common/api/potlock/hooks.ts | 12 +++- .../potlock/interfaces/donate.interfaces.ts | 3 +- src/common/types.ts | 4 ++ .../core/components/TotalTokenValue.tsx | 64 +++++++++++++++++++ src/modules/core/index.ts | 1 + .../components/DonationConfirmation.tsx | 42 ++++-------- .../donation/components/DonationSuccess.tsx | 40 +++++++----- 8 files changed, 135 insertions(+), 59 deletions(-) create mode 100644 src/modules/core/components/TotalTokenValue.tsx diff --git a/src/app/_components/Hero.tsx b/src/app/_components/Hero.tsx index 6bbe97e5..ee392e2d 100644 --- a/src/app/_components/Hero.tsx +++ b/src/app/_components/Hero.tsx @@ -1,17 +1,27 @@ import Link from "next/link"; +import { potlock } from "@/common/api/potlock"; import { Button } from "@/common/ui/components"; import useWallet from "@/modules/auth/hooks/useWallet"; import useRegistration from "@/modules/core/hooks/useRegistration"; +import { useDonation } from "@/modules/donation"; const Hero = () => { const wallet = useWallet(); const accountId = wallet?.wallet?.accountId || ""; const { registration, loading } = useRegistration(accountId); - const isRegisteredProject = !!registration.id; + const { isLoading: isAccountListLoading, data: accountList } = + potlock.useAccounts(); + + const randomProjectAccountId = "unknown"; + + const { openDonationModal: openRandomDonationModal } = useDonation({ + accountId: randomProjectAccountId ?? "unknown", + }); + return (
@@ -23,12 +33,16 @@ const Hero = () => {
participate in funding rounds.
- + {isAccountListLoading + ? null + : randomProjectAccountId && ( + + )} {!loading && (
@@ -153,7 +129,11 @@ export const DonationConfirmation: React.FC = ({ const isSpecified = typeof field.value === "string"; return ( - +
-
- 50 NEAR - ~$350 -
+ {isLoading ? ( + + ) : ( + + )} -

- has been donated to - {result?.recipient_id} -

+ {isLoading ? ( + + ) : ( +

+ has been donated to + {result?.recipient_id} +

+ )} View donation