From e6d89e22e5bcb92e7b323df37846d02d78c09c22 Mon Sep 17 00:00:00 2001 From: Pablo Alayeto <55535804+Pabl0cks@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:40:05 +0200 Subject: [PATCH] Customize apply button and feedback depending on connected address --- .../app/_components/ApplyEligibilityLink.tsx | 82 +++++++++++++++++++ .../nextjs/app/_components/CommunityGrant.tsx | 9 +- 2 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 packages/nextjs/app/_components/ApplyEligibilityLink.tsx diff --git a/packages/nextjs/app/_components/ApplyEligibilityLink.tsx b/packages/nextjs/app/_components/ApplyEligibilityLink.tsx new file mode 100644 index 0000000..fee07ff --- /dev/null +++ b/packages/nextjs/app/_components/ApplyEligibilityLink.tsx @@ -0,0 +1,82 @@ +"use client"; + +import Link from "next/link"; +import { useAccount } from "wagmi"; +import { LockClosedIcon, LockOpenIcon } from "@heroicons/react/24/outline"; +import { useBGBuilderData } from "~~/hooks/useBGBuilderData"; + +export const ApplyEligibilityLink = () => { + const { isConnected, address: connectedAddress } = useAccount(); + const { isBuilderPresent, isLoading: isFetchingBuilderData } = useBGBuilderData(connectedAddress); + + const applyButtonColor = !isConnected + ? "btn-primary disabled" + : !isBuilderPresent + ? "btn-warning disabled" + : "btn-success"; + + const notConnectedMessage = ( +
+ 🔎 Connect your wallet to verify whether you qualify to apply or not. +
++ ❌ Not a BuidlGuidl member. +
++ Join BuidlGuidl by completing the first 3 challenges of{" "} + + speedrunethereum.com + +
++ ✅ You are eligible to apply! +
+As a member of BuidlGuidl, you can participate in the grants program.
+Do you qualify?
+ {feedbackMessage} + {ApplyButton} +