diff --git a/.changeset/slimy-suns-speak.md b/.changeset/slimy-suns-speak.md new file mode 100644 index 000000000000..880b5aa2ca5b --- /dev/null +++ b/.changeset/slimy-suns-speak.md @@ -0,0 +1,7 @@ +--- +"ledger-live-desktop": minor +"live-mobile": minor +"@ledgerhq/coin-framework": minor +--- + +add banner to warn users about the migration diff --git a/apps/ledger-live-desktop/src/renderer/screens/account/index.tsx b/apps/ledger-live-desktop/src/renderer/screens/account/index.tsx index 8636918ae259..9dfb49b11cc3 100644 --- a/apps/ledger-live-desktop/src/renderer/screens/account/index.tsx +++ b/apps/ledger-live-desktop/src/renderer/screens/account/index.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from "react"; import { compose } from "redux"; import { connect } from "react-redux"; -import { withTranslation } from "react-i18next"; +import { withTranslation, Trans } from "react-i18next"; import { TFunction } from "i18next"; import { Redirect } from "react-router"; import { SyncOneAccountOnMount } from "@ledgerhq/live-common/bridge/react/index"; @@ -141,6 +141,11 @@ const AccountPage = ({ const localizedContactSupportURL = useLocalizedUrl(urls.contactSupportWebview); + const supportLink = (currencyConfig?.status as { link?: string })?.link; + const openSupportLink = useCallback(() => { + openURL(supportLink || localizedContactSupportURL); + }, [supportLink, localizedContactSupportURL]); + if (!account || !mainAccount || !currency) { return ; } @@ -150,11 +155,6 @@ const AccountPage = ({ const displayOrdinals = isOrdinalsEnabled && isBitcoinBasedAccount(account) && isBitcoinAccount(account); - const openFeatureUnvailableSupportLink = () => { - currencyConfig?.status.type === "feature_unavailable" && - openURL(currencyConfig?.status.link || localizedContactSupportURL); - }; - return ( + {currencyConfig?.status.type === "migration" && ( + + , + ]} + /> + + ), + }} + link={{ + text: t("account.migrationBanner.contactSupport"), + href: localizedContactSupportURL, + }} + /> + )} {currencyConfig?.status.type === "feature_unavailable" && ( + {t("account.featureUnavailable.support")} diff --git a/apps/ledger-live-desktop/static/i18n/en/app.json b/apps/ledger-live-desktop/static/i18n/en/app.json index b95d1a7ea112..bb47e263b7ca 100644 --- a/apps/ledger-live-desktop/static/i18n/en/app.json +++ b/apps/ledger-live-desktop/static/i18n/en/app.json @@ -768,6 +768,10 @@ "description3Link": "This integration has been carried out by <1><0>{{team}} in collaboration with Ledger" } }, + "migrationBanner": { + "title": "{{coinA}} is migrating to {{coinB}}. Follow this <0>link to know more or contact the support if you need assistance.", + "contactSupport": "Contact support" + }, "featureUnavailable": { "title": "The following feature is momentarily unavailable : {{feature}}. To know more please refer to {{support}}", "feature": { diff --git a/apps/ledger-live-mobile/src/locales/en/common.json b/apps/ledger-live-mobile/src/locales/en/common.json index d9bdfe438a90..bade293b5074 100644 --- a/apps/ledger-live-mobile/src/locales/en/common.json +++ b/apps/ledger-live-mobile/src/locales/en/common.json @@ -2619,6 +2619,10 @@ "description3Link": "This integration has been carried out by <1><0>{{team}} in collaboration with Ledger" } }, + "migrationBanner": { + "title": "{{coinA}} is migrating to {{coinB}}. Follow this <0>link to know more or contact the support if you need assistance.", + "contactSupport": "Contact support" + }, "willBedeprecatedBanner": { "title": "To optimize efficiencies, {{currencyName}} will not be supported on Ledger Live as of {{deprecatedDate}}. However, it will still be supported on Ledger hardware wallets. Please contact Ledger Customer Support if you would like assistance on this.", "contactSupport": "Contact support" diff --git a/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx b/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx index ea4333164cf6..e862f134d502 100644 --- a/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx +++ b/apps/ledger-live-mobile/src/screens/Account/ListHeaderComponent.tsx @@ -1,5 +1,5 @@ import React, { ReactNode } from "react"; -import { LayoutChangeEvent, View } from "react-native"; +import { LayoutChangeEvent, View, Linking } from "react-native"; import { isAccountEmpty, getMainAccount } from "@ledgerhq/live-common/account/index"; import { AccountLike, @@ -9,9 +9,10 @@ import { BalanceHistoryWithCountervalue, } from "@ledgerhq/types-live"; import { CryptoCurrency, Currency } from "@ledgerhq/types-cryptoassets"; -import { Box, ColorPalette } from "@ledgerhq/native-ui"; +import { Box, ColorPalette, Text } from "@ledgerhq/native-ui"; import { isNFTActive } from "@ledgerhq/coin-framework/nft/support"; -import { TFunction } from "react-i18next"; +import { TFunction, Trans } from "react-i18next"; +import styled from "styled-components/native"; import { CosmosAccount } from "@ledgerhq/live-common/families/cosmos/types"; import { PolkadotAccount } from "@ledgerhq/live-common/families/polkadot/types"; import { ElrondAccount } from "@ledgerhq/live-common/families/elrond/types"; @@ -37,6 +38,10 @@ import Alert from "~/components/Alert"; import { CurrencyConfig } from "@ledgerhq/coin-framework/config"; import { urls } from "~/utils/urls"; +const UnderlinedText = styled(Text)` + text-decoration-line: underline; +`; + type Props = { account?: AccountLike; parentAccount?: Account; @@ -128,6 +133,11 @@ export function getListHeaderComponents({ oldestEditableOperation && isStuckOperation({ family: mainAccount.currency.family, operation: oldestEditableOperation }); + const supportLink = (currencyConfig?.status as { link?: string })?.link; + const openSupportLink = () => { + Linking.openURL(supportLink || urls.contactSupportWebview.en); + }; + return { listHeaderComponents: [ @@ -143,6 +153,25 @@ export function getListHeaderComponents({ parentAccount={parentAccount} /> , + currencyConfig?.status.type === "migration" && ( + + + ]} + /> + + + ), currencyConfig?.status.type === "will_be_deprecated" && ( { } } + const supportLink = (currencyConfig?.status as { link?: string })?.link; + const openSupportLink = useCallback(() => { + Linking.openURL(supportLink || urls.contactSupportWebview.en); + }, [supportLink]); + const data = useMemo( () => [ { accountsAreEmpty={cryptoAccountsEmpty} /> , + currencyConfig?.status.type === "migration" && ( + + + ]} + /> + + + ), currencyConfig?.status.type === "will_be_deprecated" && ( { defaultAccount, onAddAccount, currencyConfig, + openSupportLink, ], ); diff --git a/libs/coin-framework/src/config.ts b/libs/coin-framework/src/config.ts index ffc8b473af29..63985370109e 100644 --- a/libs/coin-framework/src/config.ts +++ b/libs/coin-framework/src/config.ts @@ -1,4 +1,4 @@ -import { CryptoCurrency } from "@ledgerhq/types-cryptoassets"; +import { CryptoCurrency, CryptoCurrencyId } from "@ledgerhq/types-cryptoassets"; import { MissingCoinConfig } from "./errors"; type ConfigStatus = @@ -9,6 +9,13 @@ type ConfigStatus = type: "under_maintenance"; message?: string; } + | { + type: "migration"; + chain: CryptoCurrencyId; + coinA: string; + coinB: string; + link: string; + } | { type: "feature_unavailable"; link: string;