From 25bace8de76d561c49fd0728ce9d5bec42baed15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lcio=20Franco?= Date: Wed, 8 Jan 2025 01:11:41 +0800 Subject: [PATCH] fix: move location reference to component scope --- .../components/Connector/Connecting.tsx | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/react/src/ui/Connect/components/Connector/Connecting.tsx b/packages/react/src/ui/Connect/components/Connector/Connecting.tsx index bd283394..2435208f 100644 --- a/packages/react/src/ui/Connect/components/Connector/Connecting.tsx +++ b/packages/react/src/ui/Connect/components/Connector/Connecting.tsx @@ -30,18 +30,6 @@ enum ConnectStep { SIGN = 'sign', } -const copy = { - [ConnectStep.CONNECT]: { - description: `Click on the button below to connect to ${location.origin}.`, - cta: 'Connect', - }, - [ConnectStep.SIGN]: { - description: - 'Sign this message to prove you own this wallet and proceed. Canceling will disconnect you.', - cta: 'Sign', - }, -} as const; - export function Connecting({ className }: ConnectorProps) { const { fuel } = useFuel(); const { @@ -58,7 +46,18 @@ export function Connecting({ className }: ConnectorProps) { ); const { description, cta } = useMemo(() => { - return copy[connectStep]; + if (connectStep === ConnectStep.CONNECT) { + return { + description: `Click on the button below to connect to ${location.origin}.`, + cta: 'Connect', + }; + } + + return { + description: + 'Sign this message to prove you own this wallet and proceed. Canceling will disconnect you.', + cta: 'Sign', + }; }, [connectStep]); // Auto-close connecting