Skip to content

Commit

Permalink
fix: fall back to firebase display name if no translated title (#8343)
Browse files Browse the repository at this point in the history
* fix: fall back to firebase display name if no translated title

* chore: update codeowners for evm stake modal
  • Loading branch information
beths-ledger authored Nov 13, 2024
1 parent f232030 commit a99d671
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/few-owls-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"live-mobile": patch
---

Add a fallback to the provider display name from the firebase JSON if there is no translated title for the given provider. Required to add new providers like Coinbase to EVM staking.
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ apps/ledger-live-desktop/src/renderer/screens/earn/ @ledgerhq/p
apps/ledger-live-desktop/src/renderer/screens/exchange/ @ledgerhq/ptx
apps/ledger-live-desktop/src/renderer/screens/stake/ @ledgerhq/ptx
apps/ledger-live-desktop/src/renderer/screens/swapWeb/ @ledgerhq/ptx
apps/ledger-live-desktop/src/renderer/families/evm/StakeFlowModal @ledgerhq/ptx
apps/ledger-live-desktop/src/renderer/families/evm/StakeFlowModal_deprecated @ledgerhq/ptx
apps/ledger-live-mobile/src/families/evm/StakingDrawer/ @ledgerhq/ptx
apps/ledger-live-mobile/src/families/evm/StakingDrawer_deprecated/ @ledgerhq/ptx
apps/ledger-live-mobile/src/actions/earn.ts @ledgerhq/ptx
apps/ledger-live-mobile/src/actions/swap.ts @ledgerhq/ptx
apps/ledger-live-mobile/src/components/ProviderIcon/ @ledgerhq/ptx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ interface Props {
}

export const ProviderItem = ({ provider, stakeOnClick }: Props) => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();

const localManifest = useLocalLiveAppManifest(provider.liveAppId);
const remoteManifest = useRemoteLiveAppManifest(provider.liveAppId);
Expand All @@ -79,6 +79,10 @@ export const ProviderItem = ({ provider, stakeOnClick }: Props) => {
}
}, [provider, stakeOnClick, manifest]);

const displayName = i18n.exists(`stake.ethereum.provider.${provider.id}.title`)
? t(`stake.ethereum.provider.${provider.id}.title`)
: provider.name;

return (
<Container
alignItems="center"
Expand All @@ -91,7 +95,7 @@ export const ProviderItem = ({ provider, stakeOnClick }: Props) => {
<StakingIcon icon={provider.icon} />
<Flex alignItems="flex-start" flex={2} flexDirection="column">
<Text variant="bodyLineHeight" fontSize={14} fontWeight="semiBold" mr={2}>
{t(`ethereum.stake.provider.${provider.id}.title`)}
{displayName}
</Text>
<Text variant="paragraph" fontSize={13} color="neutral.c70">
{provider.lst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ export function EvmStakingDrawerProvider({ provider, onProviderPress }: Props) {

const theme = useTheme();

const { t } = useTranslation();
const { t, i18n } = useTranslation();

const providerPress = useCallback(() => {
if (manifest) {
onProviderPress({ manifest, provider });
}
}, [manifest, provider, onProviderPress]);

const displayName = i18n.exists(`stake.ethereum.provider.${provider.id}.title`)
? t(`stake.ethereum.provider.${provider.id}.title`)
: provider.name;

return (
<TouchableOpacity onPress={providerPress}>
<Flex
Expand All @@ -52,7 +56,7 @@ export function EvmStakingDrawerProvider({ provider, onProviderPress }: Props) {
<Flex rowGap={2} alignItems="flex-start" flex={3}>
<Flex flexDirection="column" flex={1} alignItems="flex-start">
<Text variant="bodyLineHeight" fontSize={14} fontWeight="semiBold" mr={2}>
{t(`stake.ethereum.provider.${provider.id}.title`)}
{displayName}
</Text>
<Text variant="paragraph" fontSize={13} color="neutral.c70">
{provider.lst
Expand Down

0 comments on commit a99d671

Please sign in to comment.