Skip to content

Commit

Permalink
frontend: display fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Jun 6, 2024
1 parent 4a170c0 commit bef158e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/frontend/src/components/Modal/TxStatusModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function TxStatusModal(props: Props) {
}
}

const { fixedTimeEstimate, medianTimeEstimate, percentileTimeEstimate } = useTransferTimeEstimate(
const { fixedTimeEstimate: fixedTimeEstimateSeconds, medianTimeEstimate: medianTimeEstimateSeconds, percentileTimeEstimate: percentileTimeEstimateSeconds } = useTransferTimeEstimate(
tx.networkName,
tx.destNetworkName,
tx?.token?._symbol
Expand All @@ -42,9 +42,9 @@ export function TxStatusModal(props: Props) {
const { success, addTokenToDestNetwork } = useAddTokenToMetamask(tx.token, tx.destNetworkName)

function InfoContent(props: any) {
const { tx, medianTimeEstimate, percentileTimeEstimate, fixedTimeEstimate } = props
const { tx, medianTimeEstimateSeconds, fixedTimeEstimateSeconds } = props

if (tx && tx.token && medianTimeEstimate) {
if (tx && tx.token && medianTimeEstimateSeconds) {
return (
<>
<Typography variant="body2" color="textSecondary">
Expand All @@ -56,11 +56,11 @@ export function TxStatusModal(props: Props) {
: "at the destination"
}
<strong>{' '}
{ transferTimeDisplay(medianTimeEstimate, fixedTimeEstimate) }
{ transferTimeDisplay(medianTimeEstimateSeconds, fixedTimeEstimateSeconds) }
</strong>{' '}
after the transaction is confirmed.
</Typography>
{ medianTimeEstimate > fixedTimeEstimate * 1.5 &&
{ medianTimeEstimateSeconds > fixedTimeEstimateSeconds * 1.5 &&
<>
<br />
<Typography variant="body2" color="textSecondary" style={{ fontStyle: 'italic' }}>
Expand All @@ -70,9 +70,9 @@ export function TxStatusModal(props: Props) {
}
</>
)
} else if (tx && fixedTimeEstimate) {
} else if (tx && fixedTimeEstimateSeconds) {
return (
<Typography variant="body1"><em>{`Your ${tx.token._symbol ?? 'transfer'} will arrive ${tx.destNetworkName ? `on ${networkSlugToName(tx.destNetworkName)}` : "at the destination"} ~${fixedTimeEstimate} minutes after your transaction is confirmed.`}</em></Typography>
<Typography variant="body1"><em>{`Your ${tx.token._symbol ?? 'transfer'} will arrive ${tx.destNetworkName ? `on ${networkSlugToName(tx.destNetworkName)}` : "at the destination"} ~${Math.round(fixedTimeEstimateSeconds/60)} minutes after your transaction is confirmed.`}</em></Typography>
)
} else {
return (
Expand All @@ -93,7 +93,7 @@ export function TxStatusModal(props: Props) {

<Box display="flex" alignItems="center" className={styles.txStatusInfo}>
<Box margin="0 auto" maxWidth="32rem" paddingLeft={3} paddingRight={3}>
<InfoContent tx={tx} medianTimeEstimate={medianTimeEstimate} percentileTimeEstimate={percentileTimeEstimate} fixedTimeEstimate={fixedTimeEstimate} />
<InfoContent tx={tx} medianTimeEstimateSeconds={medianTimeEstimateSeconds} percentileTimeEstimateSeconds={percentileTimeEstimateSeconds} fixedTimeEstimateSeconds={fixedTimeEstimateSeconds} />
<br />
</Box>

Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/contexts/Web3Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ const [walletConnectV2, walletConnectV2Hooks] = initializeConnector<WalletConnec
chains: getWeb3Chains().filter((chain) => chain.isL1).map((chain) => chain.chainId),
optionalChains: getWeb3Chains().filter((chain) => !chain.isL1).map((chain) => chain.chainId),
showQrModal: true,
metadata: {
name: 'Hop Protocol',
description: 'Cross-chain bridge',
url: 'https://app.hop.exchange',
icons: ['https://app.hop.exchange/favicon.ico'],
}
},
})
)
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/src/pages/Relay/Relay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export const Relay: FC = () => {
console.log('tx', tx)
const receipt = await tx.wait()
console.log('receipt', receipt)
setLoading(false)
resolve(null)
}
run().catch(reject)
})
Expand Down

0 comments on commit bef158e

Please sign in to comment.