Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(wallet): replace hardcoded strings with i18n translations and improve accessibility

Steven Enamakeld898a392742b
diff --git a/app/src/components/settings/panels/RecoveryPhraseGenerateMode.tsx b/app/src/components/settings/panels/RecoveryPhraseGenerateMode.tsx
index cfb2afd700..87e80b63c6 100644
--- a/app/src/components/settings/panels/RecoveryPhraseGenerateMode.tsx
+++ b/app/src/components/settings/panels/RecoveryPhraseGenerateMode.tsx
@@ -104,6 +104,7 @@ const RecoveryPhraseGenerateMode = ({
<SettingsCheckbox
id="mnemonic-confirm-checkbox"
checked={confirmed}
+ disabled={!revealed}
onCheckedChange={onConfirmedChange}
/>
<span className={`text-sm ${revealed ? 'text-content' : 'text-content-secondary'}`}>
diff --git a/app/src/components/settings/panels/RecoveryPhrasePanel.tsx b/app/src/components/settings/panels/RecoveryPhrasePanel.tsx
index 75c0745286..a40f19f0cc 100644
--- a/app/src/components/settings/panels/RecoveryPhrasePanel.tsx
+++ b/app/src/components/settings/panels/RecoveryPhrasePanel.tsx
@@ -291,7 +291,7 @@ const RecoveryPhrasePanel = () => {
const isImportComplete =
importWords.every(w => w.trim()) &&
BIP39_IMPORT_LENGTHS.includes(importWordCount as (typeof BIP39_IMPORT_LENGTHS)[number]);
- const canSave = mode === 'generate' ? confirmed : isImportComplete;
+ const canSave = mode === 'generate' ? confirmed && revealed : isImportComplete;
return (
<SettingsPanel
diff --git a/app/src/components/settings/panels/RecoveryPhraseViewMode.tsx b/app/src/components/settings/panels/RecoveryPhraseViewMode.tsx
index 3cc38dfa07..b4bc585a5d 100644
--- a/app/src/components/settings/panels/RecoveryPhraseViewMode.tsx
+++ b/app/src/components/settings/panels/RecoveryPhraseViewMode.tsx
@@ -143,7 +143,7 @@ const RecoveryPhraseViewMode = ({
{t('mnemonic.walletWordCount')}
</span>
<span className="text-sm font-medium text-content">
- {walletStatus.mnemonicWordCount} words
+ {walletStatus.mnemonicWordCount} {t('mnemonic.words')}
</span>
</div>
)}
@@ -194,7 +194,7 @@ const RecoveryPhraseViewMode = ({
<button
onClick={() => handleCopy(account.chain, account.address)}
className="p-1.5 rounded-md hover:bg-surface-muted text-content-muted transition-colors"
- title="Copy address">
+ title={t('walletBalances.copyAddress')}>
{copiedChain === account.chain ? (
<LuCheck className="w-3.5 h-3.5 text-emerald-500" />
) : (
@@ -227,7 +227,7 @@ const RecoveryPhraseViewMode = ({
{isRevealing ? (
<>
<Spinner className="w-4 h-4" />
- <span>Loading...</span>
+ <span>{t('common.loading')}</span>
</>
) : (
t('mnemonic.revealRecoveryPhrase')
diff --git a/app/src/components/settings/panels/WalletBalancesPanel.tsx b/app/src/components/settings/panels/WalletBalancesPanel.tsx
index 7a7a9bc0b5..fdbdf87a6b 100644
--- a/app/src/components/settings/panels/WalletBalancesPanel.tsx
+++ b/app/src/components/settings/panels/WalletBalancesPanel.tsx
@@ -263,7 +263,7 @@ const BalanceRow = ({ balance, onSend, onReceive }: BalanceRowProps) => {
<div className="flex justify-start gap-4 pr-2">
<button
type="button"
- className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface dark:bg-white/5 border border-line hover:bg-surface-hover dark:hover:bg-white/10 group focus-visible:outline-none transition-all duration-200 hover:scale-105 active:scale-95"
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface dark:bg-white/5 border border-line hover:bg-surface-hover dark:hover:bg-white/10 group outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500/40 transition-all duration-200 hover:scale-105 active:scale-95"
onClick={() => onSend(balance)}
data-testid={`wallet-send-${balanceKey(balance)}`}
aria-label={t('walletBalances.send')}>
@@ -285,7 +285,7 @@ const BalanceRow = ({ balance, onSend, onReceive }: BalanceRowProps) => {
</button>
<button
type="button"
- className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface dark:bg-white/5 border border-line hover:bg-surface-hover dark:hover:bg-white/10 group focus-visible:outline-none transition-all duration-200 hover:scale-105 active:scale-95"
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface dark:bg-white/5 border border-line hover:bg-surface-hover dark:hover:bg-white/10 group outline-hidden focus-visible:ring-2 focus-visible:ring-primary-500/40 transition-all duration-200 hover:scale-105 active:scale-95"
onClick={() => onReceive(balance)}
data-testid={`wallet-receive-${balanceKey(balance)}`}
aria-label={t('walletBalances.receive')}>
@@ -679,7 +679,7 @@ const WalletBalancesPanel = () => {
title={
<div className="flex items-center gap-2.5">
<svg
- className="w-5 h-5 text-white"
+ className="w-5 h-5 text-content"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
diff --git a/app/src/components/settings/panels/wallet/RevealRecoveryModal.tsx b/app/src/components/settings/panels/wallet/RevealRecoveryModal.tsx
index 58626f6170..35e3f1fa74 100644
--- a/app/src/components/settings/panels/wallet/RevealRecoveryModal.tsx
+++ b/app/src/components/settings/panels/wallet/RevealRecoveryModal.tsx
@@ -1,6 +1,7 @@
import { Dialog as DialogPrimitive } from 'radix-ui';
import { useCallback, useEffect, useState } from 'react';
+import { useT } from '../../../../lib/i18n/I18nContext';
import Button from '../../../ui/Button';
import { CheckIcon } from '../../../ui/icons';
@@ -11,6 +12,7 @@ interface RevealRecoveryModalProps {
}
export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealRecoveryModalProps) {
+ const { t } = useT();
const [revealed, setRevealed] = useState(false);
const [copied, setCopied] = useState(false);
@@ -66,12 +68,12 @@ export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealR
className="fixed left-1/2 top-1/2 z-50 w-full max-w-[500px] -translate-x-1/2 -translate-y-1/2 rounded-3xl bg-surface p-0 shadow-2xl duration-200 animate-in fade-in zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95 flex flex-col max-h-[85vh] border border-white/5">
<div className="relative flex items-center justify-center px-5 py-4 shrink-0">
<DialogPrimitive.Title className="text-sm font-semibold text-content m-0 p-0">
- Save Secret Recovery Phrase
+ {t('mnemonic.saveRecoveryPhrase')}
</DialogPrimitive.Title>
<button
onClick={onClose}
className="absolute right-3 flex h-8 w-8 items-center justify-center rounded-full text-content-muted hover:bg-surface-hover hover:text-content transition-colors"
- aria-label="Close">
+ aria-label={t('common.close')}>
<svg
className="h-5 w-5"
fill="none"
@@ -85,8 +87,7 @@ export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealR
<div className="px-5 pb-5 overflow-y-auto">
<p className="text-sm text-content-muted leading-relaxed mb-6">
- This phrase is the key to your wallet. Store it somewhere private and in the correct
- order. Anyone with access to it can control your wallet.
+ {t('mnemonic.warning')}
</p>
{mnemonic ? (
@@ -110,7 +111,7 @@ export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealR
{!revealed && (
<button
type="button"
- aria-label="Reveal recovery phrase"
+ aria-label={t('mnemonic.revealPhrase')}
className="absolute inset-0 z-10 flex flex-col items-center justify-center cursor-pointer bg-black/40 hover:bg-black/30 transition-colors"
onClick={() => setRevealed(true)}>
<svg
@@ -126,10 +127,10 @@ export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealR
/>
</svg>
<span className="text-[15px] font-semibold text-white mb-1 tracking-tight">
- Tap to reveal
+ {t('mnemonic.revealPhrase')}
</span>
<span className="text-[12px] font-medium text-white/80">
- Make sure no one is watching your screen.
+ {t('mnemonic.warning')}
</span>
</button>
)}
@@ -148,10 +149,10 @@ export default function RevealRecoveryModal({ open, onClose, mnemonic }: RevealR
{copied ? (
<>
<CheckIcon className="w-4 h-4 text-sage-400" />
- <span className="text-sage-400">Copied!</span>
+ <span className="text-sage-400">{t('common.copied')}</span>
</>
) : (
- 'Copy to clipboard'
+ t('mnemonic.copyToClipboard')
)}
</Button>
</div>
diff --git a/app/src/components/settings/panels/wallet/SelectNetworkModal.tsx b/app/src/components/settings/panels/wallet/SelectNetworkModal.tsx
index 18c77d3d4e..68c372c169 100644
--- a/app/src/components/settings/panels/wallet/SelectNetworkModal.tsx
+++ b/app/src/components/settings/panels/wallet/SelectNetworkModal.tsx
@@ -53,20 +53,14 @@ export default function SelectNetworkModal({
const iconSrc = chainIcons[filter.id];
return (
- <div
+ <button
+ type="button"
key={filter.id}
+ aria-pressed={isSelected}
onClick={() => {
onSelect(filter.id);
onClose();
}}
- role="button"
- tabIndex={0}
- onKeyDown={e => {
- if (e.key === 'Enter' || e.key === ' ') {
- onSelect(filter.id);
- onClose();
- }
- }}
className={cn(
'flex w-full cursor-pointer items-center justify-between px-4 py-3 transition-colors hover:bg-surface-hover/50',
isSelected && 'bg-surface-hover/30'
@@ -93,7 +87,7 @@ export default function SelectNetworkModal({
<span
className={cn(
'text-sm font-medium',
- isSelected ? 'text-content' : 'text-content'
+ 'text-content'
)}>
{filter.label}
</span>
@@ -113,7 +107,7 @@ export default function SelectNetworkModal({
/>
</svg>
)}
- </div>
+ </button>
);
})}
</div>