From d9c15081bb648f02ef94987379bc86424e63b392 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Mon, 23 Oct 2023 18:16:49 -0700 Subject: [PATCH] fixup! Implement provider list modal, display multiple quotes --- src/components/data/row/SwapProviderRow.tsx | 4 ++-- .../scenes/CryptoExchangeQuoteScene.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/data/row/SwapProviderRow.tsx b/src/components/data/row/SwapProviderRow.tsx index 6798e718abf..3ad0962d3fd 100644 --- a/src/components/data/row/SwapProviderRow.tsx +++ b/src/components/data/row/SwapProviderRow.tsx @@ -26,14 +26,14 @@ export const SwapProviderRow = (props: Props) => { const tokenId = isToQuote ? fromTokenId : toTokenId const nativeAmount = isToQuote ? fromNativeAmount : toNativeAmount - const toAmount = useCryptoText({ wallet, tokenId, nativeAmount }) + const costOrReceiveAmount = useCryptoText({ wallet, tokenId, nativeAmount }) return ( } leftText={quote.swapInfo.displayName} leftSubtext={quote.swapInfo.isDex ? lstrings.quote_dex_provider : lstrings.quote_centralized_provider} - rightText={toAmount} + rightText={costOrReceiveAmount} rightSubText={quote.canBePartial ? {lstrings.quote_partial_settlement} : ''} /> ) diff --git a/src/components/scenes/CryptoExchangeQuoteScene.tsx b/src/components/scenes/CryptoExchangeQuoteScene.tsx index 4de704d134f..1d09978abdd 100644 --- a/src/components/scenes/CryptoExchangeQuoteScene.tsx +++ b/src/components/scenes/CryptoExchangeQuoteScene.tsx @@ -1,5 +1,6 @@ import { div, gte } from 'biggystring' import { EdgeSwapQuote } from 'edge-core-js' +import { title } from 'process' import React, { useEffect, useState } from 'react' import { ScrollView, SectionList, TouchableOpacity, ViewStyle } from 'react-native' import { sprintf } from 'sprintf-js' @@ -44,9 +45,8 @@ interface Section { export const CryptoExchangeQuoteScene = (props: Props) => { const { route, navigation } = props - const { selectedQuote, quotes, onApprove } = route.params - const { request } = selectedQuote - const { quoteFor } = request + const { selectedQuote: initialSelectedQuote, quotes, onApprove } = route.params + const dispatch = useDispatch() const theme = useTheme() const styles = getStyles(theme) @@ -54,8 +54,12 @@ export const CryptoExchangeQuoteScene = (props: Props) => { const account = useSelector(state => state.core.account) const pending = useSelector(state => state.cryptoExchange.shiftPendingTransaction) + const [selectedQuote, setSelectedQuote] = useState(initialSelectedQuote) const [calledApprove, setCalledApprove] = useState(false) + const { request } = selectedQuote + const { quoteFor } = request + const scrollPadding = React.useMemo( () => ({ paddingBottom: theme.rem(ModalFooter.bottomRem) @@ -120,11 +124,7 @@ export const CryptoExchangeQuoteScene = (props: Props) => { return ( { - navigation.replace('exchangeQuote', { - selectedQuote: quote, - quotes, - onApprove - }) + setSelectedQuote(quote) Airship.clear() }} >