Skip to content

Commit

Permalink
dex - lint (#1305)
Browse files Browse the repository at this point in the history
* bump loans to Beta

* `hasBetaFeatures` flag

* update snapshot

* updates

* updates

* updates

* updates

* merge
  • Loading branch information
thedoublejay authored Nov 16, 2021
1 parent 96bb9a2 commit 6b5eb01
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions mobile-app/app/screens/AppNavigator/screens/Dex/DexScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export function DexScreen (): JSX.Element {
style={tailwind('flex flex-row px-4 py-3')}
>
<View style={tailwind('flex flex-col')}>
<ThemedText light={tailwind('text-gray-500')} dark={tailwind('text-gray-400')} style={tailwind('text-xs')}>{translate('screens/DexScreen', 'Total Value Locked (USD)')}</ThemedText>
<ThemedText light={tailwind('text-gray-500')} dark={tailwind('text-gray-400')}
style={tailwind('text-xs')}>{translate('screens/DexScreen', 'Total Value Locked (USD)')}</ThemedText>
<ThemedText>
<NumberFormat
displayType='text'
Expand Down Expand Up @@ -201,14 +202,17 @@ function YourPoolPairCards ({
availablePairs,
onAdd,
onRemove
}: { yourPairs: Array<{type: string, data: WalletToken}>, availablePairs: Array<DexItem<PoolPairData>>, onAdd: (data: PoolPairData) => void, onRemove: (data: PoolPairData) => void }): JSX.Element {
}: { yourPairs: Array<{ type: string, data: WalletToken }>, availablePairs: Array<DexItem<PoolPairData>>, onAdd: (data: PoolPairData) => void, onRemove: (data: PoolPairData) => void }): JSX.Element {
return (
<ThemedFlatList
data={yourPairs}
numColumns={1}
keyExtractor={(_item, index) => index.toString()}
testID='your_liquidity_tab'
renderItem={({ item, index }: {item: {type: string, data: WalletToken}, index: number}): JSX.Element => {
renderItem={({
item,
index
}: { item: { type: string, data: WalletToken }, index: number }): JSX.Element => {
const { data: yourPair } = item
const poolPairData = availablePairs.find(pr => pr.data.symbol === (yourPair as AddressToken).symbol)
const mappedPair = poolPairData?.data
Expand Down Expand Up @@ -273,7 +277,10 @@ function AvailablePoolPairCards ({
numColumns={1}
keyExtractor={(_item, index) => index.toString()}
testID='available_liquidity_tab'
renderItem={({ item, index }: {item: DexItem<PoolPairData>, index: number}): JSX.Element => {
renderItem={({
item,
index
}: { item: DexItem<PoolPairData>, index: number }): JSX.Element => {
const { data: pair } = item
const [symbolA, symbolB] = (pair?.tokenA != null && pair?.tokenB != null)
? [pair.tokenA.displaySymbol, pair.tokenB.displaySymbol]
Expand All @@ -297,7 +304,8 @@ function AvailablePoolPairCards ({
</ThemedText>
</View>

<PoolPairInfoDetails type='available' pair={pair} tokenATotal={pair?.tokenA.reserve} tokenBTotal={pair?.tokenB.reserve} testID='available' />
<PoolPairInfoDetails type='available' pair={pair} tokenATotal={pair?.tokenA.reserve}
tokenBTotal={pair?.tokenB.reserve} testID='available' />

<View style={tailwind('flex-row mt-4 flex-wrap')}>
<PoolPairActionButton
Expand Down Expand Up @@ -326,8 +334,14 @@ function AvailablePoolPairCards ({
)
}

function PoolPairInfoDetails (props: {type: 'available' | 'your', pairAmount?: string, pair: PoolPairData | undefined, tokenATotal: string, tokenBTotal: string, testID: string}): JSX.Element {
const { type, pair, pairAmount, tokenATotal, tokenBTotal } = props
function PoolPairInfoDetails (props: { type: 'available' | 'your', pairAmount?: string, pair: PoolPairData | undefined, tokenATotal: string, tokenBTotal: string, testID: string }): JSX.Element {
const {
type,
pair,
pairAmount,
tokenATotal,
tokenBTotal
} = props
const pairSymbol = (pair?.tokenA.displaySymbol !== undefined && pair?.tokenB.displaySymbol !== undefined) ? `${pair?.tokenA?.displaySymbol}-${pair?.tokenB?.displaySymbol}` : ''
const decimalScale = type === 'available' ? 2 : 8

Expand Down Expand Up @@ -433,8 +447,12 @@ function PoolPairInfoLine (props: PoolPairInfoLineProps): JSX.Element {
)
}

function PoolPairActions (props: {onAdd: () => void, onRemove: () => void, symbol: string }): JSX.Element {
const { onAdd, onRemove, symbol } = props
function PoolPairActions (props: { onAdd: () => void, onRemove: () => void, symbol: string }): JSX.Element {
const {
onAdd,
onRemove,
symbol
} = props
return (
<View style={tailwind('flex-row mt-3 flex-wrap -mr-2')}>
<PoolPairActionButton
Expand Down Expand Up @@ -469,7 +487,7 @@ function PoolPairActionButton (props: { name: React.ComponentProps<typeof Materi
)
}

function PoolPairIcon (props: { symbolA: string, symbolB: string}): JSX.Element {
function PoolPairIcon (props: { symbolA: string, symbolB: string }): JSX.Element {
const IconA = getNativeIcon(props.symbolA)
const IconB = getNativeIcon(props.symbolB)

Expand Down

0 comments on commit 6b5eb01

Please sign in to comment.