Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fall back to firebase display name if no translated title #8343

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading