Skip to content

Commit 274bb94

Browse files
authored
Merge pull request #409 from reservoirprotocol/pedro/relay-6528-same-chain-swap-ui-bugs-on-confirmation-screen
Same chain swap UI bugs on confirmation screen
2 parents 9b3ba14 + cd44e80 commit 274bb94

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.changeset/perfect-walls-turn.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+
Fix slippage ui bugs

packages/ui/src/components/common/TransactionModal/steps/ReviewQuoteStep.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,18 @@ export const ReviewQuoteStep: FC<ReviewQuoteProps> = ({
116116

117117
let breakdown: { title: string; value: ReactNode }[] = []
118118

119-
if (
120-
minimumAmountFormatted &&
121-
quote?.details?.slippageTolerance?.destination?.percent &&
122-
quote.details.slippageTolerance.destination.percent != '0.00'
123-
) {
119+
const slippage = Number(
120+
quote?.details?.slippageTolerance?.destination?.percent ??
121+
quote?.details?.slippageTolerance?.origin?.percent ??
122+
0
123+
)
124+
125+
if (minimumAmountFormatted && slippage && slippage != 0) {
124126
breakdown.push({
125127
title: 'Min. Received',
126128
value: (
127129
<Flex
128-
align="center"
130+
align="end"
129131
direction="column"
130132
css={{
131133
gap: '1'
@@ -151,7 +153,7 @@ export const ReviewQuoteStep: FC<ReviewQuoteProps> = ({
151153
{quote?.details?.slippageTolerance?.destination?.percent ?? 0}
152154
%
153155
</Text>
154-
<Flex css={{ color: 'gray9' }}>
156+
<Flex css={{ color: 'gray8' }}>
155157
<FontAwesomeIcon
156158
icon={faInfoCircle}
157159
width={14}
@@ -169,9 +171,8 @@ export const ReviewQuoteStep: FC<ReviewQuoteProps> = ({
169171
})
170172
}
171173

172-
breakdown = [
173-
...breakdown,
174-
{
174+
if (timeEstimate.time) {
175+
breakdown.push({
175176
title: 'Estimated time',
176177
value: (
177178
<Flex
@@ -188,7 +189,11 @@ export const ReviewQuoteStep: FC<ReviewQuoteProps> = ({
188189
<Text style="subtitle2">~ {timeEstimate?.formattedTime}</Text>
189190
</Flex>
190191
)
191-
},
192+
})
193+
}
194+
195+
breakdown = [
196+
...breakdown,
192197
{
193198
title: 'Network cost',
194199
value: (

0 commit comments

Comments
 (0)