From 8ddbf02a809f8663f105ccb4254d68725d1280e1 Mon Sep 17 00:00:00 2001 From: Farid Salau Date: Wed, 1 Oct 2025 09:41:15 -0500 Subject: [PATCH 1/6] Update balance sections --- .../buy-sell/CryptoBalanceSection.tsx | 51 +++++++++++-------- .../buy-sell/SwapBalanceSection.tsx | 1 + .../buy-sell-modal/CryptoBalanceSection.tsx | 34 +++++++------ .../buy-sell-modal/SwapBalanceSection.tsx | 1 + .../buy-sell-modal/USDCBalanceSection.tsx | 27 ++++------ .../ReceiveTokensModal.tsx | 6 ++- .../SendTokensConfirmation.tsx | 1 + .../send-tokens-modal/SendTokensFailure.tsx | 1 + .../send-tokens-modal/SendTokensInput.tsx | 6 ++- .../send-tokens-modal/SendTokensSuccess.tsx | 1 + 10 files changed, 73 insertions(+), 56 deletions(-) diff --git a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx index 27549b430db..7d1db81497a 100644 --- a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx @@ -6,6 +6,7 @@ import { Flex, Text, useTheme, HexagonalIcon } from '@audius/harmony-native' type CryptoBalanceSectionProps = { title: string tokenInfo: TokenInfo + name?: string amount: string priceLabel?: string } @@ -13,6 +14,7 @@ type CryptoBalanceSectionProps = { export const CryptoBalanceSection = ({ title, tokenInfo, + name, amount, priceLabel }: CryptoBalanceSectionProps) => { @@ -35,29 +37,36 @@ export const CryptoBalanceSection = ({ style={{ width: iconSize, height: iconSize }} /> - - - - {amount} + + {name && ( + + {name} - - {tokenInfo.symbol} - - - - {priceLabel && ( - - {priceLabel} + )} + + + + {amount} + + + {tokenInfo.symbol} - )} + + + {priceLabel && ( + + {priceLabel} + + )} + diff --git a/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx b/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx index 48b5d2bedea..610b72bf9ee 100644 --- a/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx @@ -21,6 +21,7 @@ export const SwapBalanceSection = (props: SwapBalanceSectionProps) => { diff --git a/packages/web/src/components/buy-sell-modal/CryptoBalanceSection.tsx b/packages/web/src/components/buy-sell-modal/CryptoBalanceSection.tsx index 397c27e3102..4080b159929 100644 --- a/packages/web/src/components/buy-sell-modal/CryptoBalanceSection.tsx +++ b/packages/web/src/components/buy-sell-modal/CryptoBalanceSection.tsx @@ -10,6 +10,7 @@ const messages = { type CryptoBalanceSectionProps = { title?: string tokenInfo: TokenInfo + name?: string amount: string priceLabel?: string } @@ -17,6 +18,7 @@ type CryptoBalanceSectionProps = { export const CryptoBalanceSection = ({ title, tokenInfo, + name, amount, priceLabel }: CryptoBalanceSectionProps) => { @@ -24,33 +26,35 @@ export const CryptoBalanceSection = ({ {title ? ( - + {title} ) : null} - + - - - {amount} - - - - {messages.symbol(tokenInfo.symbol)} + + {name ? ( + + {name} - {priceLabel ? ( - - {priceLabel} + ) : null} + + + + {amount} + + + {messages.symbol(tokenInfo.symbol)} - ) : null} + diff --git a/packages/web/src/components/buy-sell-modal/SwapBalanceSection.tsx b/packages/web/src/components/buy-sell-modal/SwapBalanceSection.tsx index 99e74b0d2ca..d7bd929b306 100644 --- a/packages/web/src/components/buy-sell-modal/SwapBalanceSection.tsx +++ b/packages/web/src/components/buy-sell-modal/SwapBalanceSection.tsx @@ -31,6 +31,7 @@ export const SwapBalanceSection = (props: SwapBalanceSectionProps) => { diff --git a/packages/web/src/components/buy-sell-modal/USDCBalanceSection.tsx b/packages/web/src/components/buy-sell-modal/USDCBalanceSection.tsx index 404604530fc..0dc9402a04e 100644 --- a/packages/web/src/components/buy-sell-modal/USDCBalanceSection.tsx +++ b/packages/web/src/components/buy-sell-modal/USDCBalanceSection.tsx @@ -1,9 +1,7 @@ import { TokenInfo } from '@audius/common/store' -import { Divider, Flex, Text, IconLogoCircleUSDC } from '@audius/harmony' +import { Divider, Flex, Text } from '@audius/harmony' import { TooltipPlacement } from 'antd/lib/tooltip' -import { env } from 'services/env' - import { TooltipInfoIcon } from './TooltipInfoIcon' const messages = { @@ -20,31 +18,24 @@ type USDCBalanceSectionProps = { export const USDCBalanceSection = ({ title, - tokenInfo, amount, tooltipPlacement, hideTooltip }: USDCBalanceSectionProps) => { - const isUsdc = tokenInfo.address === env.USDC_MINT_ADDRESS return ( - - - {isUsdc ? ( - - ) : tokenInfo.icon ? ( - - ) : null} - - + + {title} - {!hideTooltip ? : null} - - {messages.amount(amount)} - + + + {messages.amount(amount)} + + {!hideTooltip ? : null} + ) } diff --git a/packages/web/src/components/receive-tokens-modal/ReceiveTokensModal.tsx b/packages/web/src/components/receive-tokens-modal/ReceiveTokensModal.tsx index 833af585824..7986bb04a88 100644 --- a/packages/web/src/components/receive-tokens-modal/ReceiveTokensModal.tsx +++ b/packages/web/src/components/receive-tokens-modal/ReceiveTokensModal.tsx @@ -105,7 +105,11 @@ export const ReceiveTokensModal = () => { > {tokenInfo && balance ? ( - + ) : null} diff --git a/packages/web/src/components/send-tokens-modal/SendTokensConfirmation.tsx b/packages/web/src/components/send-tokens-modal/SendTokensConfirmation.tsx index eeb4d225084..451ae32af73 100644 --- a/packages/web/src/components/send-tokens-modal/SendTokensConfirmation.tsx +++ b/packages/web/src/components/send-tokens-modal/SendTokensConfirmation.tsx @@ -92,6 +92,7 @@ const SendTokensConfirmation = ({ {/* Token Balance Section */} diff --git a/packages/web/src/components/send-tokens-modal/SendTokensFailure.tsx b/packages/web/src/components/send-tokens-modal/SendTokensFailure.tsx index 1793110d24f..e468c03be4f 100644 --- a/packages/web/src/components/send-tokens-modal/SendTokensFailure.tsx +++ b/packages/web/src/components/send-tokens-modal/SendTokensFailure.tsx @@ -92,6 +92,7 @@ const SendTokensFailure = ({ {/* Token Balance Section */} diff --git a/packages/web/src/components/send-tokens-modal/SendTokensInput.tsx b/packages/web/src/components/send-tokens-modal/SendTokensInput.tsx index 4c51f435dbd..79bde7b2e92 100644 --- a/packages/web/src/components/send-tokens-modal/SendTokensInput.tsx +++ b/packages/web/src/components/send-tokens-modal/SendTokensInput.tsx @@ -164,7 +164,11 @@ const SendTokensInput = ({ return ( {/* Token Balance Section */} - + diff --git a/packages/web/src/components/send-tokens-modal/SendTokensSuccess.tsx b/packages/web/src/components/send-tokens-modal/SendTokensSuccess.tsx index 817aea521ce..2d0c8bc992c 100644 --- a/packages/web/src/components/send-tokens-modal/SendTokensSuccess.tsx +++ b/packages/web/src/components/send-tokens-modal/SendTokensSuccess.tsx @@ -89,6 +89,7 @@ const SendTokensSuccess = ({ {/* Token Balance Section */} From 481b5caa66c923eeac79defba95ce55122b0d891 Mon Sep 17 00:00:00 2001 From: Farid Salau Date: Wed, 1 Oct 2025 09:47:29 -0500 Subject: [PATCH 2/6] Update mobile --- .../buy-sell/CryptoBalanceSection.tsx | 21 +++---------------- .../buy-sell/USDCBalanceSection.tsx | 15 ++++++------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx index 7d1db81497a..5f3e6fdc9f5 100644 --- a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx @@ -1,7 +1,7 @@ import { type TokenInfo } from '@audius/common/store' import { Image } from 'react-native' -import { Flex, Text, useTheme, HexagonalIcon } from '@audius/harmony-native' +import { Flex, HexagonalIcon, Text, useTheme } from '@audius/harmony-native' type CryptoBalanceSectionProps = { title: string @@ -19,13 +19,13 @@ export const CryptoBalanceSection = ({ priceLabel }: CryptoBalanceSectionProps) => { const { logoURI } = tokenInfo - const { iconSizes, spacing } = useTheme() + const { iconSizes } = useTheme() const iconSize = iconSizes['4xl'] return ( {/* Header */} - + {title} @@ -52,21 +52,6 @@ export const CryptoBalanceSection = ({ {tokenInfo.symbol} - - {priceLabel && ( - - {priceLabel} - - )} - diff --git a/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx b/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx index b13bcf8f9c1..9bc90ca3cc2 100644 --- a/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx @@ -2,7 +2,7 @@ import React from 'react' import type { TokenInfo } from '@audius/common/store' -import { Flex, IconTokenUSDC, Text } from '@audius/harmony-native' +import { Flex, Text } from '@audius/harmony-native' import { TooltipInfoIcon } from './TooltipInfoIcon' @@ -25,17 +25,18 @@ export const USDCBalanceSection = ({ {/* Header */} - - + {title} - {/* Amount */} - - {messages.amount(amount)} - + + + {messages.amount(amount)} + + + ) } From 1c3167ac391be3228a393207cc61776a859ad49d Mon Sep 17 00:00:00 2001 From: Farid Salau Date: Wed, 1 Oct 2025 10:01:24 -0500 Subject: [PATCH 3/6] Add exchange rate --- .../buy-sell/CryptoBalanceSection.tsx | 4 +-- .../buy-sell/SwapBalanceSection.tsx | 8 ++---- .../buy-sell/USDCBalanceSection.tsx | 4 --- .../buy-sell-screen/ConfirmSwapScreen.tsx | 22 +++++++++------ .../TransactionResultScreen.tsx | 27 ++++++++++--------- .../buy-sell-modal/ConfirmSwapScreen.tsx | 15 +++++++++++ .../TransactionSuccessScreen.tsx | 17 ++++++++++++ .../buy-sell-modal/USDCBalanceSection.tsx | 2 -- .../components/LaunchpadBuyModal.tsx | 1 + 9 files changed, 65 insertions(+), 35 deletions(-) diff --git a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx index 5f3e6fdc9f5..a7b7a17e424 100644 --- a/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/CryptoBalanceSection.tsx @@ -8,15 +8,13 @@ type CryptoBalanceSectionProps = { tokenInfo: TokenInfo name?: string amount: string - priceLabel?: string } export const CryptoBalanceSection = ({ title, tokenInfo, name, - amount, - priceLabel + amount }: CryptoBalanceSectionProps) => { const { logoURI } = tokenInfo const { iconSizes } = useTheme() diff --git a/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx b/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx index 610b72bf9ee..e98e1036575 100644 --- a/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/SwapBalanceSection.tsx @@ -7,15 +7,12 @@ type SwapBalanceSectionProps = { title: string tokenInfo: TokenInfo amount: string - priceLabel?: string } export const SwapBalanceSection = (props: SwapBalanceSectionProps) => { - const { title, tokenInfo, amount, priceLabel } = props + const { title, tokenInfo, amount } = props if (tokenInfo.symbol === 'USDC') { - return ( - - ) + return } return ( { tokenInfo={tokenInfo} name={tokenInfo.name} amount={amount} - priceLabel={priceLabel} /> ) } diff --git a/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx b/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx index 9bc90ca3cc2..7e859361b96 100644 --- a/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx +++ b/packages/mobile/src/components/buy-sell/USDCBalanceSection.tsx @@ -1,7 +1,5 @@ import React from 'react' -import type { TokenInfo } from '@audius/common/store' - import { Flex, Text } from '@audius/harmony-native' import { TooltipInfoIcon } from './TooltipInfoIcon' @@ -12,13 +10,11 @@ const messages = { type USDCBalanceSectionProps = { title: string - tokenInfo: TokenInfo amount: string } export const USDCBalanceSection = ({ title, - tokenInfo, amount }: USDCBalanceSectionProps) => { return ( diff --git a/packages/mobile/src/screens/buy-sell-screen/ConfirmSwapScreen.tsx b/packages/mobile/src/screens/buy-sell-screen/ConfirmSwapScreen.tsx index 83e2177c816..fb040e0ec55 100644 --- a/packages/mobile/src/screens/buy-sell-screen/ConfirmSwapScreen.tsx +++ b/packages/mobile/src/screens/buy-sell-screen/ConfirmSwapScreen.tsx @@ -99,8 +99,6 @@ export const ConfirmSwapScreen = ({ route }: ConfirmSwapScreenProps) => { receiveTokenInfo, payAmount, receiveAmount, - pricePerBaseToken, - baseTokenSymbol, exchangeRate = null }, activeTab, @@ -246,11 +244,6 @@ export const ConfirmSwapScreen = ({ route }: ConfirmSwapScreenProps) => { decimals: receiveTokenInfo.decimals }) - const isReceivingBaseToken = receiveTokenInfo.symbol === baseTokenSymbol - const priceLabel = isReceivingBaseToken - ? messages.priceEach(pricePerBaseToken) - : undefined - const handleBack = () => { navigation.goBack() } @@ -312,9 +305,22 @@ export const ConfirmSwapScreen = ({ route }: ConfirmSwapScreenProps) => { title={messages.youReceive} tokenInfo={receiveTokenInfo} amount={formattedReceiveAmount} - priceLabel={priceLabel} /> + {exchangeRate ? ( + + + {messages.exchangeRateLabel} + + + {messages.exchangeRateValue( + payTokenInfo.symbol, + receiveTokenInfo.symbol, + exchangeRate + )} + + + ) : null} diff --git a/packages/mobile/src/screens/buy-sell-screen/TransactionResultScreen.tsx b/packages/mobile/src/screens/buy-sell-screen/TransactionResultScreen.tsx index cf90c39c2cf..80afaaa6c00 100644 --- a/packages/mobile/src/screens/buy-sell-screen/TransactionResultScreen.tsx +++ b/packages/mobile/src/screens/buy-sell-screen/TransactionResultScreen.tsx @@ -74,17 +74,7 @@ export const TransactionResultScreen = ({ } if (result.status === 'success' && successData) { - const { - payTokenInfo, - receiveTokenInfo, - pricePerBaseToken, - baseTokenSymbol - } = successData - - const isReceivingBaseToken = receiveTokenInfo.symbol === baseTokenSymbol - const priceLabel = isReceivingBaseToken - ? messages.priceEach(pricePerBaseToken) - : undefined + const { payTokenInfo, receiveTokenInfo, exchangeRate } = successData if (!formattedPayAmount || !formattedReceiveAmount) return null @@ -115,9 +105,22 @@ export const TransactionResultScreen = ({ title={messages.youReceived} tokenInfo={receiveTokenInfo} amount={formattedReceiveAmount} - priceLabel={priceLabel} /> + {exchangeRate ? ( + + + {messages.exchangeRateLabel} + + + {messages.exchangeRateValue( + payTokenInfo.symbol, + receiveTokenInfo.symbol, + exchangeRate + )} + + + ) : null} diff --git a/packages/web/src/components/buy-sell-modal/ConfirmSwapScreen.tsx b/packages/web/src/components/buy-sell-modal/ConfirmSwapScreen.tsx index 61db0a576c2..13f01e6fb55 100644 --- a/packages/web/src/components/buy-sell-modal/ConfirmSwapScreen.tsx +++ b/packages/web/src/components/buy-sell-modal/ConfirmSwapScreen.tsx @@ -115,6 +115,21 @@ export const ConfirmSwapScreen = (props: ConfirmSwapScreenProps) => { /> + {exchangeRate ? ( + + + {messages.exchangeRateLabel} + + + {messages.exchangeRateValue( + payTokenInfo.symbol, + receiveTokenInfo.symbol, + exchangeRate + )} + + + ) : null} +