fix(electron): fix wallet detail modal buttons
1. Copy address button: - Changed from alert() to visual feedback (shows "✓ 已复制") - Feedback auto-hides after 2 seconds 2. Explorer link button: - Was hardcoded to testnet (true) - Now uses getCurrentNetwork() to determine correct explorer URL - Links to kavascan.com for mainnet, testnet.kavascan.com for testnet 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
77bbb43eb5
commit
f7de1e8d09
|
|
@ -82,6 +82,7 @@ export default function Home() {
|
|||
const [transferError, setTransferError] = useState<string | null>(null);
|
||||
const [preparedTx, setPreparedTx] = useState<PreparedTransaction | null>(null);
|
||||
const [isCalculatingMax, setIsCalculatingMax] = useState(false);
|
||||
const [copySuccess, setCopySuccess] = useState(false);
|
||||
|
||||
// 计算扣除 Gas 费后的最大可转账金额
|
||||
const calculateMaxAmount = async () => {
|
||||
|
|
@ -248,9 +249,14 @@ export default function Home() {
|
|||
setShowQrModal(true);
|
||||
};
|
||||
|
||||
const handleCopyAddress = (address: string) => {
|
||||
navigator.clipboard.writeText(address);
|
||||
alert('地址已复制到剪贴板');
|
||||
const handleCopyAddress = async (address: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(address);
|
||||
setCopySuccess(true);
|
||||
setTimeout(() => setCopySuccess(false), 2000);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy address:', err);
|
||||
}
|
||||
};
|
||||
|
||||
// 打开转账模态框
|
||||
|
|
@ -714,10 +720,10 @@ export default function Home() {
|
|||
className={styles.primaryButton}
|
||||
onClick={() => handleCopyAddress(selectedShare.evmAddress || '')}
|
||||
>
|
||||
复制地址
|
||||
{copySuccess ? '✓ 已复制' : '复制地址'}
|
||||
</button>
|
||||
<a
|
||||
href={getKavaExplorerUrl(selectedShare.evmAddress || '', true)}
|
||||
href={getKavaExplorerUrl(selectedShare.evmAddress || '', getCurrentNetwork() === 'testnet')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={styles.secondaryButton}
|
||||
|
|
|
|||
Loading…
Reference in New Issue