Skip to content

Commit cde49c5

Browse files
committed
♻️ Refactor code
1 parent bf0ad9f commit cde49c5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

js/ui/src/App.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const Step = ({
112112
</div>
113113
);
114114
};
115-
115+
const COUNTDOWN_IN_SECONDS = 5;
116116
function App() {
117117
const account = useAccount();
118118
const { disconnect } = useDisconnect();
@@ -132,7 +132,7 @@ function App() {
132132
React.useState<boolean>(false);
133133
const [activeStepNumber, setActiveStepNumber] = React.useState<number>(1);
134134
const [count, { startCountdown }] = useCountdown({
135-
countStart: 10,
135+
countStart: COUNTDOWN_IN_SECONDS,
136136
intervalMs: 1000,
137137
});
138138
let siweSessionTimeout: NodeJS.Timeout;
@@ -162,14 +162,14 @@ function App() {
162162
expires: expirationTime,
163163
}
164164
);
165-
}, 5000);
165+
}, (COUNTDOWN_IN_SECONDS - 2) * 1000);
166166
redirectTimeout = setTimeout(() => {
167167
window.location.replace(
168168
`/sign_in?redirect_uri=${encodeURI(redirect)}&state=${encodeURI(
169169
state
170170
)}&client_id=${encodeURI(client_id)}${encodeURI(oidc_nonce)}`
171171
);
172-
}, 10000);
172+
}, COUNTDOWN_IN_SECONDS * 1000);
173173
};
174174

175175
const { signMessage: wagmiSignMessage } = useSignMessage({
@@ -376,14 +376,11 @@ function App() {
376376
</ConnectKitProvider>
377377
)}
378378
{activeStepNumber === 3 && (
379-
<button
380-
onClick={handleSignInWithEthereum}
381-
className="flex w-full md:w-auto md:h-[42px] justify-center items-center px-6 py-2.5 bg-white border border-solid border-gray-3 rounded-lg"
382-
>
379+
<div className="flex w-full md:w-auto md:h-[42px] justify-center items-center px-6 py-2.5 bg-white border border-solid border-gray-3 rounded-lg">
383380
<p className="text-blue-7 font-bold">
384381
Redirecting in ({count}s)
385382
</p>
386-
</button>
383+
</div>
387384
)}
388385
</div>
389386
</div>

0 commit comments

Comments
 (0)