Skip to content

Commit 654cc82

Browse files
committed
show quote error message
1 parent 2a78c45 commit 654cc82

File tree

1 file changed

+25
-4
lines changed
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget

1 file changed

+25
-4
lines changed

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/swap-ui.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ function SwapUIBase(
259259
});
260260

261261
const notEnoughBalance = !!(
262-
sellTokenBalanceQuery.data?.value &&
263-
sellTokenWithPrices?.decimals &&
262+
sellTokenBalanceQuery.data &&
263+
sellTokenWithPrices &&
264264
props.amountSelection.amount &&
265265
!!sellTokenAmount &&
266266
sellTokenBalanceQuery.data.value <
@@ -339,7 +339,21 @@ function SwapUIBase(
339339
onSelectToken={() => props.onSelectToken("buy")}
340340
/>
341341

342-
<Spacer y="lg" />
342+
{/* error message */}
343+
{preparedResultQuery.error ? (
344+
<Text
345+
size="sm"
346+
color="danger"
347+
center
348+
style={{
349+
paddingBlock: spacing.md,
350+
}}
351+
>
352+
Failed to get a quote
353+
</Text>
354+
) : (
355+
<Spacer y="lg" />
356+
)}
343357

344358
{/* Button */}
345359
{!props.activeWalletInfo ? (
@@ -428,6 +442,7 @@ function useSwapQuote(params: {
428442
sellTokenWithPrices,
429443
activeWalletInfo?.activeAccount.address,
430444
],
445+
retry: false,
431446
enabled:
432447
!!buyTokenWithPrices && !!sellTokenWithPrices && !!amountSelection.amount,
433448
queryFn: async (): Promise<
@@ -665,7 +680,13 @@ function TokenSection(props: {
665680
}}
666681
>
667682
{props.amount.isFetching ? (
668-
<Skeleton height={fontSize.xxl} width="140px" />
683+
<Skeleton
684+
height={fontSize.xxl}
685+
width="140px"
686+
style={{
687+
borderRadius: radius.lg,
688+
}}
689+
/>
669690
) : (
670691
<DecimalInput value={props.amount.data} setValue={props.setAmount} />
671692
)}

0 commit comments

Comments
 (0)