Skip to content

Commit e37c1cc

Browse files
committed
Modify lading copy
Memoize deploy callbacks
1 parent 2c9eb47 commit e37c1cc

File tree

6 files changed

+52
-37
lines changed

6 files changed

+52
-37
lines changed

src/components/text/A.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ type Props = PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>>;
55
export function A(props: Props) {
66
return <a target="_blank" rel="noopener noreferrer" {...props} />;
77
}
8+
9+
export function AUnderline(props: Props) {
10+
return <A {...props} className={LinkStyles.underline} />;
11+
}
12+
13+
export const LinkStyles = {
14+
underline: 'underline underline-offset-2 cursor-pointer hover:text-primary-500',
15+
};

src/features/deployerWallet/refund.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { getTransferTx, sendTxFromWallet } from './transactions';
1919
import { DeployerWallets } from './types';
2020
import { useDeployerWallets } from './wallets';
2121

22-
export function useRefundDeployerAccounts(onSettled?: () => void) {
22+
export function useRefundDeployerAccounts() {
2323
const multiProvider = useMultiProvider();
2424
const { chains } = usePastDeploymentChains();
2525
const { wallets } = useDeployerWallets();
@@ -29,7 +29,6 @@ export function useRefundDeployerAccounts(onSettled?: () => void) {
2929
mutationKey: ['refundDeployerAccounts', chains, accounts],
3030
mutationFn: () => refundDeployerAccounts(chains, wallets, multiProvider, accounts),
3131
retry: false,
32-
onSettled,
3332
});
3433

3534
useToastError(

src/features/deployment/warp/TokenTypeSelectField.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const TokenTypeDescriptions: Record<TokenType, { label: string; descripti
3232
},
3333
[TokenType.fastSynthetic]: {
3434
label: 'Fast Synthetic',
35-
description: 'A synthetic HypErc20 token to pair with a Fast Collateral token.',
35+
description: 'A synthetic HypERC20 token to pair with a Fast Collateral token.',
3636
},
3737
[TokenType.native]: {
3838
label: 'Native',
@@ -44,11 +44,11 @@ export const TokenTypeDescriptions: Record<TokenType, { label: string; descripti
4444
},
4545
[TokenType.synthetic]: {
4646
label: 'Synthetic',
47-
description: 'A synthetic HypErc20 token to pair with any collateralized type.',
47+
description: 'A synthetic HypERC20 token to pair with any collateralized type.',
4848
},
4949
[TokenType.syntheticRebase]: {
5050
label: 'Synthetic Rebased',
51-
description: 'A synthetic HypErc20 token to pair with a Collateral Rebased Vault.',
51+
description: 'A synthetic HypERC20 token to pair with a Collateral Rebased Vault.',
5252
},
5353
[TokenType.syntheticUri]: {
5454
label: 'Synthetic NFT',

src/features/deployment/warp/WarpDeploymentDeploy.tsx

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { MultiProtocolProvider, WarpCoreConfig } from '@hyperlane-xyz/sdk';
22
import { errorToString, sleep } from '@hyperlane-xyz/utils';
33
import { Button, SpinnerIcon, useModal } from '@hyperlane-xyz/widgets';
44
import clsx from 'clsx';
5-
import { useMemo, useState } from 'react';
5+
import { useCallback, useMemo, useState } from 'react';
66
import { PlanetSpinner } from '../../../components/animation/PlanetSpinner';
77
import { SlideIn } from '../../../components/animation/SlideIn';
88
import { SolidButton } from '../../../components/buttons/SolidButton';
@@ -48,19 +48,25 @@ export function WarpDeploymentDeploy() {
4848

4949
const { refundAsync } = useRefundDeployerAccounts();
5050

51-
const onFailure = (error: Error) => {
52-
const errMsg = errorToString(error, 5000);
53-
failDeployment(currentIndex, errMsg);
54-
refundAsync().finally(() => setPage(CardPage.WarpFailure));
55-
};
51+
const onFailure = useCallback(
52+
(error: Error) => {
53+
const errMsg = errorToString(error, 5000);
54+
failDeployment(currentIndex, errMsg);
55+
refundAsync().finally(() => setPage(CardPage.WarpFailure));
56+
},
57+
[currentIndex, failDeployment, refundAsync, setPage],
58+
);
5659

57-
const onDeploymentSuccess = (config: WarpCoreConfig) => {
58-
completeDeployment(currentIndex, {
59-
type: DeploymentType.Warp,
60-
result: config,
61-
});
62-
refundAsync().finally(() => setPage(CardPage.WarpSuccess));
63-
};
60+
const onDeploymentSuccess = useCallback(
61+
(config: WarpCoreConfig) => {
62+
completeDeployment(currentIndex, {
63+
type: DeploymentType.Warp,
64+
result: config,
65+
});
66+
refundAsync().finally(() => setPage(CardPage.WarpSuccess));
67+
},
68+
[currentIndex, completeDeployment, refundAsync, setPage],
69+
);
6470

6571
const {
6672
deploy,
@@ -69,12 +75,12 @@ export function WarpDeploymentDeploy() {
6975
cancel: cancelDeployment,
7076
} = useWarpDeployment(deploymentConfig, onDeploymentSuccess, onFailure);
7177

72-
const onDeployerFunded = () => {
78+
const onDeployerFunded = useCallback(() => {
7379
setStep(DeployStep.ExecuteDeploy);
7480
if (isDeploymentIdle) deploy();
75-
};
81+
}, [isDeploymentIdle, deploy, setStep]);
7682

77-
const onCancel = async () => {
83+
const onCancel = useCallback(async () => {
7884
if (isDeploymentPending) cancelDeployment();
7985
updateDeploymentStatus(currentIndex, DeploymentStatus.Cancelled);
8086
setStep(DeployStep.CancelDeploy);
@@ -86,7 +92,14 @@ export function WarpDeploymentDeploy() {
8692
await sleep(CANCEL_SLEEP_DELAY);
8793

8894
refundAsync().finally(() => setPage(CardPage.WarpForm));
89-
};
95+
}, [
96+
isDeploymentPending,
97+
currentIndex,
98+
cancelDeployment,
99+
refundAsync,
100+
setPage,
101+
updateDeploymentStatus,
102+
]);
90103

91104
if (!deploymentConfig) throw new Error('Deployment config is required');
92105

src/features/deployment/warp/WarpDeploymentReview.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Image from 'next/image';
55
import { toast } from 'react-toastify';
66
import { BackButton } from '../../../components/buttons/BackButton';
77
import { SolidButton } from '../../../components/buttons/SolidButton';
8-
import { A } from '../../../components/text/A';
8+
import { AUnderline, LinkStyles } from '../../../components/text/A';
99
import { H1 } from '../../../components/text/Headers';
1010
import { links } from '../../../consts/links';
1111
import { CardPage } from '../../../flows/CardPage';
@@ -165,17 +165,11 @@ function InfoSection() {
165165
<Image src={InfoCircle} width={16} alt="" />
166166
<p className="text-xs">
167167
To use more advanced settings, such as a custom{' '}
168-
<A className={styles.infoBtn} href={links.ismDocs}>
169-
Interchain Security Module
170-
</A>{' '}
171-
(ISM), you can{' '}
172-
<button onClick={onClickCopy} className={styles.infoBtn}>
168+
<AUnderline href={links.ismDocs}>Interchain Security Module</AUnderline> (ISM), you can{' '}
169+
<button onClick={onClickCopy} className={LinkStyles.underline}>
173170
copy this config
174171
</button>{' '}
175-
and use the{' '}
176-
<A className={styles.infoBtn} href={links.cliDocs}>
177-
Hyperlane CLI.
178-
</A>
172+
and use the <AUnderline href={links.cliDocs}>Hyperlane CLI.</AUnderline>
179173
</p>
180174
</div>
181175
);
@@ -226,7 +220,3 @@ function ButtonSection() {
226220
</div>
227221
);
228222
}
229-
230-
const styles = {
231-
infoBtn: 'underline underline-offset-2 cursor-pointer hover:text-primary-500',
232-
};

src/flows/LandingCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Image from 'next/image';
22
import { SolidButton } from '../components/buttons/SolidButton';
3+
import { AUnderline } from '../components/text/A';
34
import { links } from '../consts/links';
45
import BlueWave from '../images/illustrations/blue-wave.svg';
56
import SpaceCraft from '../images/illustrations/spacecraft.webp';
@@ -10,7 +11,7 @@ export function LandingPage() {
1011
const { setPage } = useCardNav();
1112

1213
return (
13-
<div className="max-w-full space-y-6 p-4 text-center">
14+
<div className="max-w-full space-y-5 p-4 text-center">
1415
<div className="relative -mx-8 flex items-center justify-center">
1516
<Image src={BlueWave} alt="" className="absolute left-0 right-0 top-[0.4rem] rotate-6" />
1617
<Image width={110} height={110} src={SpaceCraft} alt="" className="z-[5] -rotate-[16deg]" />
@@ -24,6 +25,10 @@ export function LandingPage() {
2425
Follow three steps to create a new route: configure your options, deploy your contracts, and
2526
set up a bridge UI.
2627
</p>
28+
<p className="max-w-md px-2 text-sm leading-relaxed">
29+
To use more advanced settings, use the{' '}
30+
<AUnderline href={links.cliDocs}>Hyperlane CLI.</AUnderline>
31+
</p>
2732
<div className="flex justify-center gap-12 pt-1">
2833
<a
2934
href={links.warpDocs}

0 commit comments

Comments
 (0)