From 7c10f7ad60194a9172a72ef9df76fb9fa95108f1 Mon Sep 17 00:00:00 2001 From: mamos Date: Fri, 31 May 2024 15:15:55 -0700 Subject: [PATCH] add loading state --- .../components/known-scam-overlay/useShowScamWarning.tsx | 3 ++- .../ui/app/components/user-approve-container/index.tsx | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/wallet/src/ui/app/components/known-scam-overlay/useShowScamWarning.tsx b/apps/wallet/src/ui/app/components/known-scam-overlay/useShowScamWarning.tsx index 354968309e2d7..ef49b260aedf3 100644 --- a/apps/wallet/src/ui/app/components/known-scam-overlay/useShowScamWarning.tsx +++ b/apps/wallet/src/ui/app/components/known-scam-overlay/useShowScamWarning.tsx @@ -8,7 +8,7 @@ import { useCheckBlocklist } from '../../hooks/useDomainBlocklist'; export function useShowScamWarning({ hostname }: { hostname?: string }) { const [userBypassed, setUserBypassed] = useState(false); - const { data } = useCheckBlocklist(hostname); + const { data, isPending } = useCheckBlocklist(hostname); const bypass = () => setUserBypassed(true); useEffect(() => { @@ -19,6 +19,7 @@ export function useShowScamWarning({ hostname }: { hostname?: string }) { return { isOpen: !!data?.block && !userBypassed, + isPending: isPending, userBypassed, bypass, }; diff --git a/apps/wallet/src/ui/app/components/user-approve-container/index.tsx b/apps/wallet/src/ui/app/components/user-approve-container/index.tsx index bc2fb4c782383..6adb9e1e7e914 100644 --- a/apps/wallet/src/ui/app/components/user-approve-container/index.tsx +++ b/apps/wallet/src/ui/app/components/user-approve-container/index.tsx @@ -60,7 +60,11 @@ export function UserApproveContainer({ const { data: selectedAccount } = useAccountByAddress(address); const parsedOrigin = useMemo(() => new URL(origin), [origin]); - const { isOpen, bypass } = useShowScamWarning({ hostname: parsedOrigin.hostname }); + const { + isOpen, + isPending: isDomainCheckLoading, + bypass, + } = useShowScamWarning({ hostname: parsedOrigin.hostname }); return ( <> @@ -110,7 +114,7 @@ export function UserApproveContainer({ handleOnResponse(true); }} disabled={approveDisabled} - loading={submitting || approveLoading} + loading={submitting || approveLoading || isDomainCheckLoading} text={approveTitle} />