From e93ce6b2288f24f2a645a93e9bcf083bdd6e5307 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Tue, 19 Nov 2024 10:55:58 +0800 Subject: [PATCH] fix: hide the shortcuts entry outside of the desktop scenario & add showPaginationButton props on banner & fix dismiss i18n text (OK-33947) (#6221) --- .../components/src/actions/Alert/index.tsx | 7 ++++++- .../components/src/composite/Banner/index.tsx | 5 ++++- .../container/PasswordVerifyContainer.tsx | 2 +- packages/kit/src/views/Earn/EarnHome.tsx | 18 ++++++++++++++---- .../pages/List/AdvancedSection/index.tsx | 19 +++++++++++-------- .../pages/List/ResourceSection/index.tsx | 4 ++-- .../src/views/Setting/pages/List/index.tsx | 7 ++++--- packages/shared/src/locale/json/en.json | 2 +- packages/shared/src/locale/json/en_US.json | 2 +- packages/shared/src/locale/json/zh_CN.json | 4 ++-- packages/shared/src/locale/json/zh_HK.json | 8 ++++---- packages/shared/src/locale/json/zh_TW.json | 4 ++-- 12 files changed, 52 insertions(+), 30 deletions(-) diff --git a/packages/components/src/actions/Alert/index.tsx b/packages/components/src/actions/Alert/index.tsx index 7676b552924..2f7e7abd3ae 100644 --- a/packages/components/src/actions/Alert/index.tsx +++ b/packages/components/src/actions/Alert/index.tsx @@ -1,8 +1,11 @@ import { cloneElement, useCallback, useContext, useState } from 'react'; +import { useIntl } from 'react-intl'; import { StyleSheet } from 'react-native'; import { createStyledContext, styled } from 'tamagui'; +import { ETranslations } from '@onekeyhq/shared/src/locale'; + import { Button, Icon, @@ -130,6 +133,8 @@ export const Alert = AlertFrame.styleable((props, ref) => { onCloseProp?.(); }, [onCloseProp]); + const intl = useIntl(); + if (!show) return null; return ( @@ -172,7 +177,7 @@ export const Alert = AlertFrame.styleable((props, ref) => { ) : null} {closable ? ( ({ indicatorContainerStyle, leftIconButtonStyle, rightIconButtonStyle, + showPaginationButton = false, ...props }: { data: T[]; @@ -108,6 +109,7 @@ export function Banner({ rightIconButtonStyle?: Omit; indicatorContainerStyle?: IStackStyle; itemTitleContainerStyle?: IStackStyle; + showPaginationButton?: boolean; size?: 'small' | 'large'; onItemPress: (item: T) => void; isLoading?: boolean; @@ -134,7 +136,7 @@ export function Banner({ gotToPrevIndex, }: IRenderPaginationParams) => ( <> - {media.gtMd ? ( + {showPaginationButton || media.gtMd ? ( <> {currentIndex !== 0 ? ( ({ ), [ + showPaginationButton, media.gtMd, data, leftIconButtonStyle, diff --git a/packages/kit/src/components/Password/container/PasswordVerifyContainer.tsx b/packages/kit/src/components/Password/container/PasswordVerifyContainer.tsx index 90fb6c0c2b1..e95ffd92f01 100644 --- a/packages/kit/src/components/Password/container/PasswordVerifyContainer.tsx +++ b/packages/kit/src/components/Password/container/PasswordVerifyContainer.tsx @@ -1,4 +1,4 @@ -import { memo, useCallback, useEffect, useMemo, useState } from 'react'; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { AuthenticationType } from 'expo-local-authentication'; import { useIntl } from 'react-intl'; diff --git a/packages/kit/src/views/Earn/EarnHome.tsx b/packages/kit/src/views/Earn/EarnHome.tsx index abe4a91c2e7..624fc8497b8 100644 --- a/packages/kit/src/views/Earn/EarnHome.tsx +++ b/packages/kit/src/views/Earn/EarnHome.tsx @@ -34,8 +34,12 @@ import { import { ETranslations } from '@onekeyhq/shared/src/locale'; import { defaultLogger } from '@onekeyhq/shared/src/logger/logger'; import { getPrimaryColor } from '@onekeyhq/shared/src/modules3rdParty/react-native-image-colors'; +import platformEnv from '@onekeyhq/shared/src/platformEnv'; import { EModalRoutes, EModalStakingRoutes } from '@onekeyhq/shared/src/routes'; -import { openUrlInApp } from '@onekeyhq/shared/src/utils/openUrlUtils'; +import { + openUrlExternal, + openUrlInApp, +} from '@onekeyhq/shared/src/utils/openUrlUtils'; import timerUtils from '@onekeyhq/shared/src/utils/timerUtils'; import { EAccountSelectorSceneName } from '@onekeyhq/shared/types'; import type { @@ -716,6 +720,7 @@ function BasicEarnHome() { const onBannerPress = useCallback( async ({ + hrefType, href, }: { imgUrl: string; @@ -747,7 +752,11 @@ function BasicEarnHome() { } return; } - openUrlInApp(href); + if (hrefType === 'external') { + openUrlExternal(href); + } else { + openUrlInApp(href); + } } }, [account, indexedAccount?.id, navigation], @@ -757,6 +766,7 @@ function BasicEarnHome() { if (earnBanners) { return earnBanners.length ? ( diff --git a/packages/kit/src/views/Setting/pages/List/AdvancedSection/index.tsx b/packages/kit/src/views/Setting/pages/List/AdvancedSection/index.tsx index de3f06f45fc..3c4d853f645 100644 --- a/packages/kit/src/views/Setting/pages/List/AdvancedSection/index.tsx +++ b/packages/kit/src/views/Setting/pages/List/AdvancedSection/index.tsx @@ -98,14 +98,17 @@ export const AdvancedSection = () => { return (
- + {platformEnv.isWeb ? null : ( + + )} + - ); + ) : null; } export const ResourceSection = () => { diff --git a/packages/kit/src/views/Setting/pages/List/index.tsx b/packages/kit/src/views/Setting/pages/List/index.tsx index 19d9c22f4d1..f7c5d8b5ebb 100644 --- a/packages/kit/src/views/Setting/pages/List/index.tsx +++ b/packages/kit/src/views/Setting/pages/List/index.tsx @@ -113,7 +113,7 @@ const SocialButtonGroup = () => { { {versionString} - {appUpdateInfo.status === EAppUpdateStatus.done ? ( - + {!appUpdateInfo.latestVersion || + appUpdateInfo.latestVersion === platformEnv.version ? ( + {intl.formatMessage({ id: ETranslations.update_app_up_to_date })} ) : null} diff --git a/packages/shared/src/locale/json/en.json b/packages/shared/src/locale/json/en.json index 03c7ce0394b..4a9bf4dfe41 100644 --- a/packages/shared/src/locale/json/en.json +++ b/packages/shared/src/locale/json/en.json @@ -528,7 +528,7 @@ "explore.default_wallet_set": "OneKey is your default wallet now.", "explore.default_wallet_settings": "Default Wallet Settings", "explore.disconnect": "Disconnect", - "explore.dismiss": "dismiss", + "explore.dismiss": "Dismiss", "explore.enter_bookmark_name": "Please enter the bookmark name", "explore.excluded_dapps": "Excluded dApps", "explore.excluded_dapps_description": "Right-click blank space, select the option below to exclude.", diff --git a/packages/shared/src/locale/json/en_US.json b/packages/shared/src/locale/json/en_US.json index 9f05b6eddfe..903bd7c00d9 100644 --- a/packages/shared/src/locale/json/en_US.json +++ b/packages/shared/src/locale/json/en_US.json @@ -528,7 +528,7 @@ "explore.default_wallet_set": "OneKey is your default wallet now.", "explore.default_wallet_settings": "Default Wallet Settings", "explore.disconnect": "Disconnect", - "explore.dismiss": "dismiss", + "explore.dismiss": "Dismiss", "explore.enter_bookmark_name": "Please enter the bookmark name", "explore.excluded_dapps": "Excluded dApps", "explore.excluded_dapps_description": "Right-click blank space, select the option below to exclude.", diff --git a/packages/shared/src/locale/json/zh_CN.json b/packages/shared/src/locale/json/zh_CN.json index b9969c15c47..6501a82f6d6 100644 --- a/packages/shared/src/locale/json/zh_CN.json +++ b/packages/shared/src/locale/json/zh_CN.json @@ -1777,7 +1777,7 @@ "swap_page.alert.no_provider_supports_trade": "没有提供商支持此交易", "swap_page.alert.not_best_rate": "当前的渠道商未为此交易提供最佳报价。", "swap_page.alert.require_native_token_content": "部分跨链桥接会收取额外的源链原生代币作为桥接费用", - "swap_page.alert.require_native_token_title": "需要{n} {token}", + "swap_page.alert.require_native_token_title": "需要 {n} {token}", "swap_page.alert.tax_detected": "代币税由代币项目方收取,而非 OneKey。", "swap_page.alert.tax_detected_buy": "购买", "swap_page.alert.tax_detected_sell": "卖出", @@ -1854,7 +1854,7 @@ "swap_page.toast.approve_failed_detail": "{token}", "swap_page.toast.approve_successful": "授权成功", "swap_page.toast.approve_successful_detail": "{token}", - "swap_page.toast.insufficient_balance_content": "您应至少保留{number} {token} 来支付网络费用。", + "swap_page.toast.insufficient_balance_content": "您应至少保留 {number} {token} 来支付网络费用。", "swap_page.toast.insufficient_balance_title": "{token} 余额不足", "swap_page.toast.insufficient_input_amount": "输入金额不足", "swap_page.toast.swap_failed": "交易失败", diff --git a/packages/shared/src/locale/json/zh_HK.json b/packages/shared/src/locale/json/zh_HK.json index 8e785cde5af..a51941a9b37 100644 --- a/packages/shared/src/locale/json/zh_HK.json +++ b/packages/shared/src/locale/json/zh_HK.json @@ -1410,8 +1410,8 @@ "onboarding.enable_bluetooth_help_text": "要繼續進行,需要開啟藍牙。", "onboarding.finalize_creating_wallet": "建立您的錢包", "onboarding.finalize_encrypting_data": "加密您的數據", - "onboarding.finalize_generating_accounts": "正在建立您的帳戶。", - "onboarding.finalize_ready": "您的錢包現已準備就緒。", + "onboarding.finalize_generating_accounts": "正在建立您的帳戶", + "onboarding.finalize_ready": "您的錢包現已準備就緒", "onboarding.finalize_wallet_setup": "完成錢包設置", "onboarding.import_recovery_phrase_warning": "安全警告", "onboarding.import_recovery_phrase_warning_help_text": "為了您的資產安全,避免導入硬件錢包的助記詞,而是使用「連接硬件錢包」以獲得最佳的安全性。", @@ -1777,7 +1777,7 @@ "swap_page.alert.no_provider_supports_trade": "沒有渠道商支持該交易。", "swap_page.alert.not_best_rate": "當前的渠道商未為此交易提供最佳報價。", "swap_page.alert.require_native_token_content": "部分跨鏈橋會收取額外的來源鏈原生代幣作為橋樑費用", - "swap_page.alert.require_native_token_title": "需要{n} {token}", + "swap_page.alert.require_native_token_title": "需要 {n} {token}", "swap_page.alert.tax_detected": "代幣稅由代幣項目方收取,而非 OneKey。", "swap_page.alert.tax_detected_buy": "購買", "swap_page.alert.tax_detected_sell": "賣出", @@ -1854,7 +1854,7 @@ "swap_page.toast.approve_failed_detail": "{token}", "swap_page.toast.approve_successful": "授權成功", "swap_page.toast.approve_successful_detail": "{token}", - "swap_page.toast.insufficient_balance_content": "你應該至少保留{number} {token} 來支付網絡費用。", + "swap_page.toast.insufficient_balance_content": "你應該至少保留 {number} {token} 來支付網絡費用。", "swap_page.toast.insufficient_balance_title": "{token} 餘額不足", "swap_page.toast.insufficient_input_amount": "輸入金額不足", "swap_page.toast.swap_failed": "交易失敗", diff --git a/packages/shared/src/locale/json/zh_TW.json b/packages/shared/src/locale/json/zh_TW.json index a94e5e8bc76..cfc76af33e9 100644 --- a/packages/shared/src/locale/json/zh_TW.json +++ b/packages/shared/src/locale/json/zh_TW.json @@ -1777,7 +1777,7 @@ "swap_page.alert.no_provider_supports_trade": "沒有供應商支援這此交易", "swap_page.alert.not_best_rate": "目前的渠道商並未提供這筆交易最佳的報價。", "swap_page.alert.require_native_token_content": "部分跨鏈橋會收取額外的源鏈原生代幣作為橋樑費用", - "swap_page.alert.require_native_token_title": "需要{n} {token}", + "swap_page.alert.require_native_token_title": "需要 {n} {token}", "swap_page.alert.tax_detected": "代幣稅由代幣項目方收取,而非 OneKey。", "swap_page.alert.tax_detected_buy": "購買", "swap_page.alert.tax_detected_sell": "賣出", @@ -1854,7 +1854,7 @@ "swap_page.toast.approve_failed_detail": "{token}", "swap_page.toast.approve_successful": "授權成功", "swap_page.toast.approve_successful_detail": "{token}", - "swap_page.toast.insufficient_balance_content": "您應該至少保留{number} {token} 來支付網絡費用。", + "swap_page.toast.insufficient_balance_content": "您應該至少保留 {number} {token} 來支付網絡費用。", "swap_page.toast.insufficient_balance_title": "{token} 餘額不足", "swap_page.toast.insufficient_input_amount": "輸入金額不足", "swap_page.toast.swap_failed": "交換失敗",