Skip to content

Commit

Permalink
fix: harmonize icons with Legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
KVNLS committed Sep 11, 2023
1 parent 96a21b1 commit 895bedf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/ios/ledgerlivemobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.16.1</string>
<string>3.29.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
16 changes: 8 additions & 8 deletions apps/ledger-live-mobile/src/components/TabBar/TransferDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigation } from "@react-navigation/native";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { ScrollView } from "react-native-gesture-handler";
import { Flex, IconsLegacy, Text, Box } from "@ledgerhq/native-ui";
import { Flex, Text, Box } from "@ledgerhq/native-ui";
import { StyleProp, ViewStyle } from "react-native";
import { snakeCase } from "lodash";
import { StackNavigationProp } from "@react-navigation/stack";
Expand Down Expand Up @@ -75,7 +75,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
title: t("transfer.send.title"),
description: t("transfer.send.description"),
onPress: () => onNavigate(...SEND.route),
Icon: IconsLegacy.ArrowTopMedium,
Icon: SEND.icon,
disabled: SEND.disabled,
testID: "transfer-send-button",
},
Expand All @@ -88,7 +88,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
title: t("transfer.receive.title"),
description: t("transfer.receive.description"),
onPress: () => onNavigate(...RECEIVE.route),
Icon: IconsLegacy.ArrowBottomMedium,
Icon: RECEIVE.icon,
disabled: RECEIVE.disabled,
testID: "transfer-receive-button",
},
Expand All @@ -101,7 +101,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
title: t("transfer.buy.title"),
description: t("transfer.buy.description"),
tag: t("common.popular"),
Icon: IconsLegacy.PlusMedium,
Icon: BUY.icon,
onPress: () => onNavigate(...BUY.route),
onDisabledPress: () => {
if (isPtxServiceCtaExchangeDrawerDisabled) {
Expand All @@ -126,7 +126,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
},
title: t("transfer.sell.title"),
description: t("transfer.sell.description"),
Icon: IconsLegacy.MinusMedium,
Icon: SELL.icon,
onPress: () => onNavigate(...SELL.route),
onDisabledPress: () => {
if (isPtxServiceCtaExchangeDrawerDisabled) {
Expand Down Expand Up @@ -154,7 +154,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
},
title: t("transfer.stake.title"),
description: t("transfer.stake.description"),
Icon: IconsLegacy.ClaimRewardsMedium,
Icon: STAKE.icon,
onPress: () => onNavigate(...STAKE.route),
disabled: STAKE.disabled,
testID: "transfer-stake-button",
Expand All @@ -169,7 +169,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
},
title: t("transfer.swap.title"),
description: t("transfer.swap.description"),
Icon: IconsLegacy.BuyCryptoMedium,
Icon: SWAP.icon,
onPress: () => onNavigate(...SWAP.route),
onDisabledPress: () => {
if (isPtxServiceCtaExchangeDrawerDisabled) {
Expand Down Expand Up @@ -197,7 +197,7 @@ export default function TransferDrawer({ onClose }: Omit<ModalProps, "isRequesti
},
title: t("transfer.walletConnect.title"),
description: t("transfer.walletConnect.description"),
Icon: IconsLegacy.WalletConnectMedium,
Icon: WALLET_CONNECT.icon,
onPress: () => onNavigate(...WALLET_CONNECT.route),
disabled: WALLET_CONNECT.disabled,
testID: "transfer-walletconnect-button",
Expand Down
10 changes: 10 additions & 0 deletions apps/ledger-live-mobile/src/hooks/useQuickActions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useMemo } from "react";
import { useRoute } from "@react-navigation/native";
import { useSelector } from "react-redux";
import { IconsLegacy } from "@ledgerhq/native-ui";
import { type ParamListBase } from "@react-navigation/native";
import { IconType } from "@ledgerhq/native-ui/components/Icon/type";
import useFeature from "@ledgerhq/live-common/featureFlags/useFeature";
import { NavigatorName, ScreenName } from "../const";
import { accountsCountSelector, areAccountsEmptySelector } from "../reducers/accounts";
Expand All @@ -10,6 +12,7 @@ import { readOnlyModeEnabledSelector } from "../reducers/settings";
export type QuickAction = {
disabled: boolean;
route: [NavigatorName, { screen: ScreenName; params?: ParamListBase }];
icon: IconType;
};

export type QuickActionsList = {
Expand Down Expand Up @@ -49,14 +52,17 @@ function useQuickActions() {
screen: ScreenName.SendCoin,
},
],
icon: IconsLegacy.ArrowTopMedium,
},
RECEIVE: {
disabled: readOnlyModeEnabled,
route: [NavigatorName.ReceiveFunds, { screen: ScreenName.ReceiveSelectCrypto }],
icon: IconsLegacy.ArrowBottomMedium,
},
BUY: {
disabled: isPtxServiceCtaExchangeDrawerDisabled || readOnlyModeEnabled,
route: [NavigatorName.Exchange, { screen: ScreenName.ExchangeBuy }],
icon: IconsLegacy.PlusMedium,
},
SELL: {
disabled:
Expand All @@ -65,6 +71,7 @@ function useQuickActions() {
readOnlyModeEnabled ||
areAccountsEmpty,
route: [NavigatorName.Exchange, { screen: ScreenName.ExchangeSell }],
icon: IconsLegacy.MinusMedium,
},
SWAP: {
disabled:
Expand All @@ -78,6 +85,7 @@ function useQuickActions() {
screen: ScreenName.SwapForm,
},
],
icon: IconsLegacy.BuyCryptoMedium,
},
};

Expand All @@ -91,6 +99,7 @@ function useQuickActions() {
params: { parentRoute: route },
},
],
icon: IconsLegacy.ClaimRewardsMedium,
};
}

Expand All @@ -103,6 +112,7 @@ function useQuickActions() {
screen: ScreenName.WalletConnectConnect,
},
],
icon: IconsLegacy.WalletConnectMedium,
};
}
return list;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, { useCallback } from "react";
import { ArrowDown, ArrowUp, CoinPercent, Exchange, Plus } from "@ledgerhq/native-ui/assets/icons";
import { useNavigation } from "@react-navigation/native";
import { NewIconType } from "@ledgerhq/native-ui/components/Icon/type";
import { StackNavigationProp } from "@react-navigation/stack";
import { useTranslation } from "react-i18next";
import useQuickActions from "../../hooks/useQuickActions";
Expand All @@ -13,12 +11,6 @@ const SHARED_CONFIG = {
variant: "small" as const,
textVariant: "small" as TextVariants,
};

const getIcon =
(Component: NewIconType) =>
({ color }: { color: string }) =>
<Component size="S" color={color} />;

function PortfolioQuickActionsBar() {
const navigation = useNavigation();
const { page } = useAnalytics();
Expand All @@ -41,28 +33,28 @@ function PortfolioQuickActionsBar() {
const quickActionsData: QuickActionButtonProps[] = [
{
...SHARED_CONFIG,
Icon: getIcon(Plus),
Icon: BUY.icon,
children: t("portfolio.quickActions.buy"),
onPress: () => onNavigate(...BUY.route, "quick_action_buy"),
disabled: BUY.disabled,
},
{
...SHARED_CONFIG,
Icon: getIcon(Exchange),
Icon: SWAP.icon,
children: t("portfolio.quickActions.swap"),
onPress: () => onNavigate(...SWAP.route, "quick_action_swap"),
disabled: SWAP.disabled,
},
{
...SHARED_CONFIG,
Icon: getIcon(ArrowUp),
Icon: SEND.icon,
children: t("portfolio.quickActions.send"),
onPress: () => onNavigate(...SEND.route, "quick_action_send"),
disabled: SEND.disabled,
},
{
...SHARED_CONFIG,
Icon: getIcon(ArrowDown),
Icon: RECEIVE.icon,
children: t("portfolio.quickActions.deposit"),
onPress: () => onNavigate(...RECEIVE.route, "quick_action_receive"),
disabled: RECEIVE.disabled,
Expand All @@ -71,7 +63,7 @@ function PortfolioQuickActionsBar() {
if (STAKE) {
quickActionsData.push({
...SHARED_CONFIG,
Icon: getIcon(CoinPercent),
Icon: STAKE.icon,
children: t("portfolio.quickActions.stake"),
onPress: () => onNavigate(...STAKE.route, "quick_action_stake"),
disabled: STAKE.disabled,
Expand Down

0 comments on commit 895bedf

Please sign in to comment.