Skip to content

Commit

Permalink
Fix: Remove Banners and Modal after successful claim (#911)
Browse files Browse the repository at this point in the history
* remove banner and modal on success

* remove docs banner on success
  • Loading branch information
brendan-defi authored Aug 21, 2024
1 parent bbd290a commit d2f8736
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/web/src/components/Basenames/RegistrationFlow.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 && <RegistrationStateSwitcherDynamic />}
Expand Down

0 comments on commit d2f8736

Please sign in to comment.