Skip to content

Commit

Permalink
chore(llm): generalize the messages for tokens like done on LLD (#7028)
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed Jun 7, 2024
1 parent 49c527a commit 917b0e9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-crabs-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Generalize the messages for tokens during the add accounts flow
7 changes: 6 additions & 1 deletion apps/ledger-live-mobile/src/components/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Props = {
noIcon?: boolean;
onLearnMore?: () => void;
learnMoreKey?: string;
learnMoreTransValues?: object;
learnMoreUrl?: string;
learnMoreIsInternal?: boolean;
learnMoreIcon?: IconType;
Expand Down Expand Up @@ -88,6 +89,7 @@ type LearnMoreLinkProps = {
learnMoreIsInternal?: boolean;
learnMoreKey?: string;
Icon?: IconType;
transValues?: object;
};

const LinkTouchable = styled(TouchableOpacity).attrs({
Expand All @@ -103,13 +105,14 @@ export const LearnMoreLink = ({
onPress,
learnMoreIsInternal,
learnMoreKey,
transValues,
Icon,
}: LearnMoreLinkProps) => {
const IconComponent = Icon || IconsLegacy.ExternalLinkMedium;
return (
<LinkTouchable onPress={onPress}>
<BaseAlert.UnderlinedText mr="5px">
<Trans i18nKey={learnMoreKey || "common.learnMore"} />
<Trans i18nKey={learnMoreKey || "common.learnMore"} values={transValues} />
</BaseAlert.UnderlinedText>
{(Icon || !learnMoreIsInternal) && <IconComponent size={16} />}
</LinkTouchable>
Expand All @@ -135,6 +138,7 @@ export default function Alert(props: Props) {
learnMoreKey,
learnMoreIsInternal = false,
learnMoreIcon,
learnMoreTransValues,
} = props;

const dismissedBanners = useSelector(dismissedBannersSelector);
Expand Down Expand Up @@ -173,6 +177,7 @@ export default function Alert(props: Props) {
learnMoreKey={learnMoreKey}
learnMoreIsInternal={learnMoreIsInternal}
Icon={learnMoreIcon}
transValues={learnMoreTransValues}
/>
)}
</Container>
Expand Down
32 changes: 3 additions & 29 deletions apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3844,35 +3844,9 @@
"tokens": {
"title": "Add token",
"createParentCurrencyAccount": "Add {{parrentCurrencyName}} account",
"erc20": {
"title": "Add token",
"disclaimer": "{{tokenName}} is an ERC20 Token.\nYou can receive tokens directly in an Ethereum account.",
"learnMore": "Learn more about ERC20"
},
"trc10": {
"title": "Add Token",
"disclaimer": "{{tokenName}} is a TRC10 Token.\nYou can receive tokens directly in a Tron account.",
"learnMore": "Learn more about TRC10"
},
"trc20": {
"title": "Add Token",
"disclaimer": "{{tokenName}} is a TRC20 Token.\nYou can receive tokens directly in a Tron account.",
"learnMore": "Learn more about TRC20"
},
"asa": {
"title": "Add Token",
"disclaimer": "{{tokenName}} is an ASA Token.\nYou can receive tokens directly on an Algorand account.",
"learnMore": "Learn more"
},
"bep20": {
"title": "Add Token",
"disclaimer": "{{tokenName}} is a BEP-20 Token.\nYou can receive tokens directly in a BNB account.",
"learnMore": "Learn more about BEP-20"
},
"vip180": {
"title": "Add token",
"disclaimer": "{{tokenName}} is a VIP180 Token.\nYou can receive tokens directly in a VET account.",
"learnMore": "Learn more about VIP180"
"generic": {
"disclaimer": "{{token}} ({{ticker}}) is an {{tokenType}} token.\nYou can receive tokens directly on an {{currency}} account.",
"learnMore": "Learn more about {{tokenType}}"
}
},
"showMoreChainType": "More address types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,18 @@ export default function AddAccountsTokenCurrencyDisclaimer({ navigation, route }
token.tokenType as keyof typeof urls.supportLinkByTokenType
]
}
learnMoreKey={`addAccounts.tokens.${token.tokenType}.learnMore`}
learnMoreKey={`addAccounts.tokens.generic.learnMore`}
learnMoreTransValues={{
tokenType: token.tokenType.toUpperCase(),
}}
>
<Trans
i18nKey={`addAccounts.tokens.${token.tokenType}.disclaimer`}
i18nKey={`addAccounts.tokens.generic.disclaimer`}
values={{
tokenName,
token: token.name,
ticker: token.ticker,
tokenType: token.tokenType.toUpperCase(),
currency: token.parentCurrency.name,
}}
/>
</Alert>
Expand Down

0 comments on commit 917b0e9

Please sign in to comment.