From d2f87368e5752e27cab9b92e90ea97fde4e25ea8 Mon Sep 17 00:00:00 2001 From: Brendan from DeFi Date: Wed, 21 Aug 2024 14:55:49 -0700 Subject: [PATCH] Fix: Remove Banners and Modal after successful claim (#911) * remove banner and modal on success * remove docs banner on success --- .../src/components/Basenames/RegistrationFlow.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/Basenames/RegistrationFlow.tsx b/apps/web/src/components/Basenames/RegistrationFlow.tsx index 0451838e61..d6e1da4565 100644 --- a/apps/web/src/components/Basenames/RegistrationFlow.tsx +++ b/apps/web/src/components/Basenames/RegistrationFlow.tsx @@ -1,6 +1,6 @@ 'use client'; import dynamic from 'next/dynamic'; - +import { useLocalStorage } from 'usehooks-ts'; import { Transition } from '@headlessui/react'; import { useAnalytics } from 'apps/web/contexts/Analytics'; import RegistrationBackground from 'apps/web/src/components/Basenames/RegistrationBackground'; @@ -46,6 +46,9 @@ export function RegistrationFlow() { const { chain } = useAccount(); const { logEventWithContext } = useAnalytics(); const searchParams = useSearchParams(); + const [, setIsModalOpen] = useLocalStorage('BasenamesLaunchModalVisible', true); + const [, setIsBannerVisible] = useLocalStorage('basenamesLaunchBannerVisible', true); + const [, setIsDocsBannerVisible] = useLocalStorage('basenamesLaunchDocsBannerVisible', true); const { registrationStep, @@ -115,6 +118,14 @@ export function RegistrationFlow() { } }, [basenameChain.id, searchParams, setSelectedName]); + useEffect(() => { + if (isSuccess) { + setIsModalOpen(false); + setIsBannerVisible(false); + setIsDocsBannerVisible(false); + } + }, [isSuccess, setIsModalOpen, setIsBannerVisible, setIsDocsBannerVisible]); + return ( <> {false && isDevelopment && }