Update localization

This commit is contained in:
John Huang 2024-02-15 09:57:05 -08:00
parent 0391cefebe
commit 2b53b6b8d7
No known key found for this signature in database
GPG Key ID: 7BEF1876FF3664D9
4 changed files with 28 additions and 14 deletions

View File

@ -42,7 +42,7 @@
"@cosmjs/tendermint-rpc": "^0.32.1",
"@dydxprotocol/v4-abacus": "^1.4.2",
"@dydxprotocol/v4-client-js": "^1.0.20",
"@dydxprotocol/v4-localization": "^1.1.30",
"@dydxprotocol/v4-localization": "^1.1.33",
"@ethersproject/providers": "^5.7.2",
"@js-joda/core": "^5.5.3",
"@radix-ui/react-accordion": "^1.1.2",

8
pnpm-lock.yaml generated
View File

@ -36,8 +36,8 @@ dependencies:
specifier: ^1.0.20
version: 1.0.20
'@dydxprotocol/v4-localization':
specifier: ^1.1.30
version: 1.1.30
specifier: ^1.1.33
version: 1.1.33
'@ethersproject/providers':
specifier: ^5.7.2
version: 5.7.2
@ -1323,8 +1323,8 @@ packages:
- utf-8-validate
dev: false
/@dydxprotocol/v4-localization@1.1.30:
resolution: {integrity: sha512-TZfWWRSOxcjLHs972wlJVVHkE7+DVqAUnGZSs24HYHsPtUkPhZiNXMOA2Vk9YddQxumhM79xIRH0cmJSe5DDUg==}
/@dydxprotocol/v4-localization@1.1.33:
resolution: {integrity: sha512-FQiWgo+1M4T7qoEH+sJOXbC2kynhiVqUbAtXSAgXT5lp6/tmn5CH+6ZMLcqaaO7r9eqtVdzQq2tTcA0WrofU5g==}
dev: false
/@dydxprotocol/v4-proto@4.0.0-dev.0:

View File

@ -4,13 +4,23 @@ import { layoutMixins } from '@/styles/layoutMixins';
import { Dialog } from '@/components/Dialog';
import { QrCode } from '@/components/QrCode';
import { useStringGetter } from '@/hooks';
import { STRING_KEYS } from '@/constants/localization';
type ElementProps = {
setIsOpen: (open: boolean) => void;
};
const appStoreUrl = document.querySelector('meta[name="smartbanner:button-url-apple"]')?.getAttribute('content');
// const appStoreUrl = "http://example.com"; for testing only
/*
This implementation assumes "smartbanner:button-url-apple" and "smartbanner:button-url-google" are set to
the same value with onelink or other redirect URL.
Since there is no way to know what mobile device the user is using, we should give a onelink URL which
redirects to either iOS or Android app store depending on the mobile device used to scan the link.
*/
export const mobileAppUrl =
document.querySelector('meta[name="smartbanner:button-url-apple"]')?.getAttribute('content') ??
document.querySelector('meta[name="smartbanner:button-url-google"]')?.getAttribute('content');
// const mobileAppUrl = "http://example.com"; // for testing only
const MobileQrCode = ({
url,
@ -24,15 +34,22 @@ const MobileQrCode = ({
);
};
/*
MobileDownloadDialog should only been shown on desktop when mobileAppUrl has value. That's controlled by AccountMenu.tsx.
*/
export const MobileDownloadDialog = ({ setIsOpen }: ElementProps) => {
const stringGetter = useStringGetter();
const content = (
<>
<MobileQrCode url={appStoreUrl!} />
<MobileQrCode url={mobileAppUrl!} />
</>
);
return (
<Dialog isOpen setIsOpen={setIsOpen} title="Scan and Download">
<Dialog isOpen setIsOpen={setIsOpen} title={
stringGetter({ key: STRING_KEYS.DOWNLOAD_MOBILE_APP })
}>
<Styled.Content>{content}</Styled.Content>
</Dialog>
);

View File

@ -40,6 +40,7 @@ import { getAppTheme } from '@/state/configsSelectors';
import { isTruthy } from '@/lib/isTruthy';
import { truncateAddress } from '@/lib/wallet';
import { MustBigNumber } from '@/lib/numbers';
import { appStoreUrl } from '../dialogs/MobileDownloadDialog';
export const AccountMenu = () => {
const stringGetter = useStringGetter();
@ -60,10 +61,6 @@ export const AccountMenu = () => {
dispatch(openDialog({ type: DialogTypes.Onboarding }));
};
const appStoreUrl = document.querySelector('meta[name="smartbanner:button-url-apple"]')?.getAttribute('content');
// const appStoreUrl = "http://example.com"; for testing
return onboardingState === OnboardingState.Disconnected ? (
<OnboardingTriggerButton size={ButtonSize.XSmall} />
) : (
@ -198,7 +195,7 @@ export const AccountMenu = () => {
{
value: 'MobileDownload',
icon: <Icon iconName={IconName.Qr} />,
label: "Download Mobile App",
label: stringGetter({ key: STRING_KEYS.DOWNLOAD_MOBILE_APP }),
onSelect: () => {
dispatch(openDialog({ type: DialogTypes.MobileDownload }));
},