Skip to content

Commit 813152c

Browse files
committed
Simplify exchange details tile
1 parent f020a96 commit 813152c

File tree

1 file changed

+11
-34
lines changed

1 file changed

+11
-34
lines changed

src/components/cards/SwapDetailsCard.tsx

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { abs, sub } from 'biggystring'
22
import { EdgeCurrencyWallet, EdgeTransaction, EdgeTxSwap } from 'edge-core-js'
33
import * as React from 'react'
4-
import { Linking, Platform, View } from 'react-native'
4+
import { Linking, Platform } from 'react-native'
55
import Mailer from 'react-native-mail'
66
import SafariView from 'react-native-safari-view'
77
import { sprintf } from 'sprintf-js'
@@ -21,7 +21,6 @@ import { convertNativeToDisplay, unixToLocaleDateTime } from '../../util/utils'
2121
import { RawTextModal } from '../modals/RawTextModal'
2222
import { EdgeRow } from '../rows/EdgeRow'
2323
import { Airship, showError } from '../services/AirshipInstance'
24-
import { cacheStyles, Theme, useTheme } from '../services/ThemeContext'
2524
import { EdgeText } from '../themed/EdgeText'
2625
import { EdgeCard } from './EdgeCard'
2726

@@ -35,8 +34,6 @@ const TXID_PLACEHOLDER = '{{TXID}}'
3534

3635
export function SwapDetailsCard(props: Props) {
3736
const { swapData, transaction, wallet } = props
38-
const theme = useTheme()
39-
const styles = getStyles(theme)
4037

4138
const { memos = [], spendTargets = [], tokenId } = transaction
4239
const { currencyInfo } = wallet
@@ -159,12 +156,6 @@ export function SwapDetailsCard(props: Props) {
159156
getExchangeDenom(destinationWallet.currencyConfig, null).name
160157
})`
161158

162-
const symbolString =
163-
currencyInfo.currencyCode === transaction.currencyCode &&
164-
walletDefaultDenom.symbol != null
165-
? walletDefaultDenom.symbol
166-
: transaction.currencyCode
167-
168159
const createExchangeDataString = (newline: string = '\n') => {
169160
const uniqueIdentifier = memos
170161
.map(
@@ -216,23 +207,16 @@ export function SwapDetailsCard(props: Props) {
216207
title={lstrings.transaction_details_exchange_details}
217208
onPress={handleExchangeDetails}
218209
>
219-
<View style={styles.tileColumn}>
220-
<EdgeText>
221-
{lstrings.title_exchange + ' ' + sourceAmount + ' ' + symbolString}
222-
</EdgeText>
223-
<EdgeText>
224-
{lstrings.string_to_capitalize +
225-
' ' +
226-
destinationAmount +
227-
' ' +
228-
destinationAssetName}
229-
</EdgeText>
230-
<EdgeText>
231-
{swapData.isEstimate
232-
? lstrings.estimated_quote
233-
: lstrings.fixed_quote}
234-
</EdgeText>
235-
</View>
210+
<EdgeText>
211+
{`${sourceAmount} ${sourceAssetName}` +
212+
' → ' +
213+
`${destinationAmount} ${destinationAssetName}`}
214+
</EdgeText>
215+
<EdgeText>
216+
{swapData.isEstimate
217+
? lstrings.estimated_quote
218+
: lstrings.fixed_quote}
219+
</EdgeText>
236220
</EdgeRow>
237221
{orderUri == null ? null : (
238222
<EdgeRow
@@ -253,10 +237,3 @@ export function SwapDetailsCard(props: Props) {
253237
</EdgeCard>
254238
)
255239
}
256-
257-
const getStyles = cacheStyles((theme: Theme) => ({
258-
tileColumn: {
259-
flexDirection: 'column',
260-
justifyContent: 'center'
261-
}
262-
}))

0 commit comments

Comments
 (0)