Skip to content

Commit 1b4541a

Browse files
committed
Remove unneeded variables, lowing CL (cognitive-load)
1 parent dabaef3 commit 1b4541a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/components/scenes/SwapCreateScene.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,17 @@ export const SwapCreateScene = (props: Props) => {
211211
toTokenId: fromTokenId,
212212
errorDisplayInfo
213213
})
214-
const newNativeAmountFor = inputNativeAmountFor === 'from' ? 'to' : 'from'
215214
// Clear amount input state:
216-
setInputNativeAmountFor(newNativeAmountFor)
215+
setInputNativeAmountFor(inputNativeAmountFor === 'from' ? 'to' : 'from')
216+
217217
// Swap the amounts:
218-
const toAmount = newNativeAmountFor === 'to' ? inputFiatAmount : '0'
219-
const fromAmount = newNativeAmountFor === 'from' ? inputFiatAmount : '0'
220-
toInputRef.current?.setAmount('fiat', toAmount)
221-
fromInputRef.current?.setAmount('fiat', fromAmount)
218+
if (inputNativeAmountFor === 'from') {
219+
fromInputRef.current?.setAmount('fiat', '0')
220+
toInputRef.current?.setAmount('fiat', inputFiatAmount)
221+
} else {
222+
toInputRef.current?.setAmount('fiat', '0')
223+
fromInputRef.current?.setAmount('fiat', inputFiatAmount)
224+
}
222225
})
223226

224227
const handleSelectWallet = useHandler(async (walletId: string, tokenId: EdgeTokenId, direction: 'from' | 'to') => {

0 commit comments

Comments
 (0)