Skip to content

Commit

Permalink
Make modal titles specific to the action
Browse files Browse the repository at this point in the history
"Select Asset to Purchase/Sell" to match the Buy/Sell scenes' modals

For the rest, generic "Select Wallet" since Swap can go either direction once you are on the scene, and Earn can be both the stake and/or reward asset.
  • Loading branch information
Jon-edge committed Feb 7, 2025
1 parent 83c6c78 commit d83b540
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/components/scenes/CoinRankingDetailsScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {
*/
const chooseWalletListResult = async (
filteredEdgeAssets: EdgeAsset[],
filteredMatchingWallets: EdgeCurrencyWallet[]
filteredMatchingWallets: EdgeCurrencyWallet[],
title: string
): Promise<Extract<WalletListResult, { type: 'wallet' }> | undefined> => {
// No compatible assets. Shouldn't happen since buttons are blocked from
// handlers anyway, if there's no filteredEdgeAssets
Expand Down Expand Up @@ -391,13 +392,7 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {

// Else, If multiple wallets, show picker. Tokens also can be added here.
const result = await Airship.show<WalletListResult>(bridge => (
<WalletListModal
bridge={bridge}
navigation={navigation as NavigationBase}
headerTitle={lstrings.select_wallet_to_send_from}
allowedAssets={filteredEdgeAssets}
showCreateWallet
/>
<WalletListModal bridge={bridge} navigation={navigation as NavigationBase} headerTitle={title} allowedAssets={filteredEdgeAssets} showCreateWallet />
))
// User aborted the flow. Callers will also noop.
if (result?.type !== 'wallet') return
Expand All @@ -406,7 +401,7 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {

const handleBuyPress = useHandler(async () => {
if (edgeAssets.length === 0) return
const forcedWalletResult = await chooseWalletListResult(edgeAssets, matchingWallets)
const forcedWalletResult = await chooseWalletListResult(edgeAssets, matchingWallets, lstrings.fiat_plugin_select_asset_to_purchase)
if (forcedWalletResult == null) return

navigation.navigate('edgeTabs', {
Expand All @@ -422,7 +417,7 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {

const handleSellPress = useHandler(async () => {
if (edgeAssets.length === 0) return
const forcedWalletResult = await chooseWalletListResult(edgeAssets, matchingWallets)
const forcedWalletResult = await chooseWalletListResult(edgeAssets, matchingWallets, lstrings.fiat_plugin_select_asset_to_sell)
if (forcedWalletResult == null) return

navigation.navigate('edgeTabs', {
Expand All @@ -439,7 +434,7 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {
const handleSwapPress = useHandler(async () => {
if (edgeAssets.length === 0) return

const walletListResult = await chooseWalletListResult(edgeAssets, matchingWallets)
const walletListResult = await chooseWalletListResult(edgeAssets, matchingWallets, lstrings.select_wallet)
if (walletListResult == null) return

const { walletId, tokenId } = walletListResult
Expand Down Expand Up @@ -484,7 +479,7 @@ const CoinRankingDetailsSceneComponent = (props: Props) => {
})

const handleStakePress = useHandler(async () => {
const walletListResult = await chooseWalletListResult(edgeStakingAssets, stakingWallets)
const walletListResult = await chooseWalletListResult(edgeStakingAssets, stakingWallets, lstrings.select_wallet)
if (walletListResult == null) return
const { walletId } = walletListResult

Expand Down

0 comments on commit d83b540

Please sign in to comment.