Skip to content

Commit eb43db2

Browse files
authored
Merge pull request #365 from reservoirprotocol/ted/relay-6298-remove-route-selector-from-single-chain-mode
Hide route selector in fee breakdown in single chain mode
2 parents feb73b0 + fa63f61 commit eb43db2

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

.changeset/plenty-buckets-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@reservoir0x/relay-kit-ui': patch
3+
---
4+
5+
Hide route selector in fee breakdown in single chain mode

packages/ui/src/components/widgets/FeeBreakdown.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Props = Pick<
2323
| 'canonicalTimeEstimate'
2424
> & {
2525
toChain?: RelayChain
26+
isSingleChainLocked?: boolean
2627
}
2728

2829
const formatSwapRate = (rate: number) => {
@@ -40,7 +41,8 @@ const FeeBreakdown: FC<Props> = ({
4041
useExternalLiquidity,
4142
setUseExternalLiquidity,
4243
timeEstimate,
43-
canonicalTimeEstimate
44+
canonicalTimeEstimate,
45+
isSingleChainLocked
4446
}) => {
4547
const swapRate = price?.details?.rate
4648
const originGasFee = feeBreakdown?.breakdown?.find(
@@ -86,16 +88,20 @@ const FeeBreakdown: FC<Props> = ({
8688
mb: '6px'
8789
}}
8890
>
89-
<SwapRouteSelector
90-
chain={toChain}
91-
supportsExternalLiquidity={supportsExternalLiquidity}
92-
externalLiquidtySelected={useExternalLiquidity}
93-
onExternalLiquidityChange={(selected) => {
94-
setUseExternalLiquidity(selected)
95-
}}
96-
canonicalTimeEstimate={canonicalTimeEstimate?.formattedTime}
97-
/>
98-
<Box css={{ height: 1, background: 'gray5', width: '100%' }} />
91+
{!isSingleChainLocked ? (
92+
<>
93+
<SwapRouteSelector
94+
chain={toChain}
95+
supportsExternalLiquidity={supportsExternalLiquidity}
96+
externalLiquidtySelected={useExternalLiquidity}
97+
onExternalLiquidityChange={(selected) => {
98+
setUseExternalLiquidity(selected)
99+
}}
100+
canonicalTimeEstimate={canonicalTimeEstimate?.formattedTime}
101+
/>
102+
<Box css={{ height: 1, background: 'gray5', width: '100%' }} />
103+
</>
104+
) : null}
99105
<Flex
100106
justify="between"
101107
css={{

packages/ui/src/components/widgets/SwapWidget/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ const SwapWidget: FC<SwapWidgetProps> = ({
417417
isSingleChainLocked
418418
? [lockChainId]
419419
: fromToken?.chainId !== undefined &&
420-
fromToken?.chainId === lockChainId
421-
? [fromToken?.chainId]
422-
: undefined
420+
fromToken?.chainId === lockChainId
421+
? [fromToken?.chainId]
422+
: undefined
423423
}
424424
restrictedTokensList={tokens?.filter(
425425
(token) => token.chainId === fromToken?.chainId
@@ -765,9 +765,9 @@ const SwapWidget: FC<SwapWidgetProps> = ({
765765
isSingleChainLocked
766766
? [lockChainId]
767767
: toToken?.chainId !== undefined &&
768-
toToken?.chainId === lockChainId
769-
? [toToken?.chainId]
770-
: undefined
768+
toToken?.chainId === lockChainId
769+
? [toToken?.chainId]
770+
: undefined
771771
}
772772
restrictedTokensList={tokens?.filter(
773773
(token) => token.chainId === toToken?.chainId
@@ -883,6 +883,7 @@ const SwapWidget: FC<SwapWidgetProps> = ({
883883
})
884884
}}
885885
canonicalTimeEstimate={canonicalTimeEstimate}
886+
isSingleChainLocked={isSingleChainLocked}
886887
/>
887888
<WidgetErrorWell
888889
hasInsufficientBalance={hasInsufficientBalance}

0 commit comments

Comments
 (0)