Skip to content

Commit

Permalink
move cleanup (try to reduce diff size)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Sep 23, 2024
1 parent b2bc89b commit 4d4b3b3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/popup/components/ConnectWalletForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const ConnectWalletForm = ({
setErrors((_) => ({ ..._, walletAddressUrl: '' }));
if (!walletAddressUrl) return;
try {
setIsValidating((e) => ({ ...e, walletAddressUrl: true }));
setIsValidating((_) => ({ ..._, walletAddressUrl: true }));
const url = new URL(toWalletAddressUrl(walletAddressUrl));
const walletAddress = await getWalletInfo(url.toString());
setWalletAddressInfo(walletAddress);
Expand Down Expand Up @@ -132,6 +132,7 @@ export const ConnectWalletForm = ({
setIsSubmitting(false);
}
};

React.useEffect(() => {
if (!walletAddressInfo) return;
setCurrencySymbol({
Expand Down Expand Up @@ -216,15 +217,15 @@ export const ConnectWalletForm = ({
addOn={<span className="text-weak">{currencySymbol.symbol}</span>}
errorMessage={errors.amount}
required={true}
onKeyDown={(ev) => {
onKeyDown={(e) => {
if (
(!charIsNumber(ev.key) &&
ev.key !== 'Backspace' &&
ev.key !== 'Delete' &&
ev.key !== 'Tab') ||
(ev.key === '.' && ev.currentTarget.value.includes('.'))
(!charIsNumber(e.key) &&
e.key !== 'Backspace' &&
e.key !== 'Delete' &&
e.key !== 'Tab') ||
(e.key === '.' && e.currentTarget.value.includes('.'))
) {
ev.preventDefault();
e.preventDefault();
}
}}
onBlur={(ev) => {
Expand Down

0 comments on commit 4d4b3b3

Please sign in to comment.