diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx index 2ce765b6ccd..5c80b70aad0 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountBanners/AccountBanners.tsx @@ -1,5 +1,8 @@ import { Context } from '@suite-common/message-system'; -import { isSupportedEthStakingNetworkSymbol } from '@suite-common/wallet-utils'; +import { + isSupportedEthStakingNetworkSymbol, + isSupportedSolStakingNetworkSymbol, +} from '@suite-common/wallet-utils'; import { Column } from '@trezor/components'; import { spacings } from '@trezor/theme'; @@ -31,6 +34,9 @@ export const AccountBanners = ({ account }: AccountBannersProps) => { {account?.symbol && isSupportedEthStakingNetworkSymbol(account.symbol) && route?.name === 'wallet-staking' && } + {account?.symbol && + isSupportedSolStakingNetworkSymbol(account.symbol) && + route?.name === 'wallet-staking' && } diff --git a/packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx b/packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx index 77dbf85b126..cf4327bbd2b 100644 --- a/packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx +++ b/packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx @@ -1,8 +1,12 @@ +import { useMemo } from 'react'; + import { Context, selectContextMessageContent } from '@suite-common/message-system'; -import { Banner } from '@trezor/components'; +import { Banner, Row } from '@trezor/components'; -import { useSelector } from 'src/hooks/suite'; -import { selectLanguage } from 'src/reducers/suite/suiteReducer'; +import { goto } from 'src/actions/suite/routerActions'; +import { useDispatch, useSelector } from 'src/hooks/suite'; +import { selectLanguage, selectTorState } from 'src/reducers/suite/suiteReducer'; +import { getTorUrlIfAvailable } from 'src/utils/suite/tor'; type ContextMessageProps = { context: (typeof Context)[keyof typeof Context]; @@ -11,14 +15,54 @@ type ContextMessageProps = { export const ContextMessage = ({ context }: ContextMessageProps) => { const language = useSelector(selectLanguage); const message = useSelector(state => selectContextMessageContent(state, context, language)); + const { isTorEnabled } = useSelector(selectTorState); + const torOnionLinks = useSelector(state => state.suite.settings.torOnionLinks); + const dispatch = useDispatch(); + + // Removed unused destructuring of message properties. + + const actionConfig = useMemo(() => { + if (!message?.cta) return undefined; + + const { action, label, link, anchor } = message.cta; + let onClick: () => Window | Promise | null; + + if (action === 'internal-link') { + // @ts-expect-error: impossible to add all href options to the message system config json schema + onClick = () => dispatch(goto(link, { anchor, preserveParams: true })); + } else if (action === 'external-link') { + onClick = () => + window.open( + isTorEnabled && torOnionLinks ? getTorUrlIfAvailable(link) : link, + '_blank', + ); + } else { + return undefined; + } + + const labelMapping = label as unknown as Record; + + return { + label: labelMapping[language] || labelMapping.en, + onClick: onClick!, + 'data-testid': `@context-message/${context}/cta`, + }; + }, [message, dispatch, language, isTorEnabled, torOnionLinks, context]); return message ? ( {message.cta.label} - ) : undefined + + {actionConfig && ( + + {actionConfig.label} + + )} + } > {message.content} diff --git a/suite-common/message-system/config/config.v1.json b/suite-common/message-system/config/config.v1.json index 916981e8a99..08894b49232 100644 --- a/suite-common/message-system/config/config.v1.json +++ b/suite-common/message-system/config/config.v1.json @@ -1,7 +1,7 @@ { "version": 1, "timestamp": "2025-02-24T00:00:00+00:00", - "sequence": 81, + "sequence": 87, "actions": [ { "conditions": [ @@ -294,6 +294,64 @@ } } }, + { + "conditions": [ + { + "settings": [ + { + "sol": true + } + ], + "environment": { + "desktop": ">25.2.0", + "mobile": "!", + "web": ">25.2.2" + } + } + ], + "message": { + "id": "ccd7b443-1e0e-449e-b58f-affa0459a29d", + "priority": 93, + "dismissible": true, + "variant": "info", + "category": ["context"], + "content": { + "en-GB": "Tady to aktualizuj, delej.", + "en": "Tady to aktualizuj, delej..", + "es": "Si encuentras algún problema al sincronizar tus cuentas de Solana, por favor actualiza tu Trezor Suite a la última versión.", + "cs": "Tady to aktualizuj delej", + "ru": "Если у вас возникли проблемы с синхронизацией ваших счетов Solana, обновите Trezor Suite до последней версии.", + "ja": "Solanaアカウントの同期に問題がある場合は、Trezor Suiteを最新バージョンに更新してください。", + "hu": "Ha bármilyen problémába ütközik a Solana fiókjainak szinkronizálásakor, frissítse a Trezor Suite alkalmazást a legújabb verzióra.", + "it": "Se riscontri problemi di sincronizzazione dei tuoi account Solana, aggiorna la tua Trezor Suite all'ultima versione.", + "fr": "Si vous rencontrez des problèmes de synchronisation de vos comptes Solana, veuillez mettre à jour votre Trezor Suite vers la dernière version.", + "de": "Wenn Sie Probleme beim Synchronisieren Ihrer Solana-Konten haben, aktualisieren Sie Ihre Trezor Suite auf die neueste Version.", + "tr": "Solana hesaplarınızı senkronize etme konusunda herhangi bir sorunla karşılaşırsanız, Trezor Suite'inizi en son sürüme güncelleyin.", + "pt": "Se encontrar problemas ao sincronizar as suas contas Solana, atualize o seu Trezor Suite para a versão mais recente.", + "uk": "Якщо у вас виникли проблеми з синхронізацією ваших рахунків Solana, оновіть ваш Trezor Suite до останньої версії." + }, + "cta": { + "action": "internal-link", + "link": "firmware-index", + "label": { + "en-GB": "Update now", + "en": "Update now", + "es": "Actualizar ahora", + "cs": "Aktualizovat teď", + "ru": "Обновить сейчас", + "ja": "今すぐアップデート", + "hu": "Frissítés most", + "it": "Aggiorna ora", + "fr": "Mettre à jour maintenant", + "de": "Jetzt aktualisieren", + "tr": "Şimdi güncelle", + "pt": "Atualizar agora", + "uk": "Оновити зараз" + } + }, + "context": { "domain": "accounts.sol.staking" } + } + }, { "conditions": [ { @@ -1239,7 +1297,7 @@ "priority": 96, "dismissible": true, "variant": "critical", - "category": "banner", + "category": ["banner"], "content": { "en-GB": "Updating the firmware may wipe your Trezor. Verify your backup now to ensure you can recover your assets.", "en": "Updating the firmware may wipe your Trezor. Verify your backup now to ensure you can recover your assets.", diff --git a/suite-common/message-system/src/messageSystemTypes.ts b/suite-common/message-system/src/messageSystemTypes.ts index cb03bb7c068..6fb16c6b265 100644 --- a/suite-common/message-system/src/messageSystemTypes.ts +++ b/suite-common/message-system/src/messageSystemTypes.ts @@ -36,6 +36,7 @@ export type FeatureDomain = (typeof Feature)[keyof typeof Feature]; export const Context = { coinjoin: 'accounts.coinjoin', ethStaking: 'accounts.eth.staking', + solStaking: 'accounts.sol.staking', } as const; export type ContextDomain = (typeof Context)[keyof typeof Context];