Skip to content

Commit

Permalink
fixup! Implement provider list modal, display multiple quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Oct 24, 2023
1 parent 1d5af6b commit d9c1508
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/data/row/SwapProviderRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<IconDataRow
icon={<FastImage style={styles.providerIcon} source={{ uri: getSwapPluginIconUri(quote.pluginId, theme) }} resizeMode="contain" />}
leftText={quote.swapInfo.displayName}
leftSubtext={quote.swapInfo.isDex ? lstrings.quote_dex_provider : lstrings.quote_centralized_provider}
rightText={toAmount}
rightText={costOrReceiveAmount}
rightSubText={quote.canBePartial ? <EdgeText style={styles.partialSettlementText}>{lstrings.quote_partial_settlement}</EdgeText> : ''}
/>
)
Expand Down
16 changes: 8 additions & 8 deletions src/components/scenes/CryptoExchangeQuoteScene.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -44,18 +45,21 @@ 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)

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<ViewStyle>(
() => ({
paddingBottom: theme.rem(ModalFooter.bottomRem)
Expand Down Expand Up @@ -120,11 +124,7 @@ export const CryptoExchangeQuoteScene = (props: Props) => {
return (
<TouchableOpacity
onPress={() => {
navigation.replace('exchangeQuote', {
selectedQuote: quote,
quotes,
onApprove
})
setSelectedQuote(quote)
Airship.clear()
}}
>
Expand Down

0 comments on commit d9c1508

Please sign in to comment.