feat: Add Binance setup guide with tutorial modal

- Add Binance configuration tutorial image (guide.png)
- Implement "View Guide" button in exchange configuration modal
- Add tutorial display modal with image viewer
- Add i18n support for guide-related text (EN/ZH)
- Button only appears when configuring Binance exchange

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
Ember
2025-11-04 14:50:38 +08:00
parent 92272fc2b0
commit cd9cd42267
3 changed files with 67 additions and 19 deletions

BIN
web/public/images/guide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 KiB

View File

@@ -8,7 +8,7 @@ import { useAuth } from '../contexts/AuthContext';
import { getExchangeIcon } from './ExchangeIcons';
import { getModelIcon } from './ModelIcons';
import { TraderConfigModal } from './TraderConfigModal';
import { Bot, Brain, Landmark, BarChart3, Trash2, Plus, Users, AlertTriangle } from 'lucide-react';
import { Bot, Brain, Landmark, BarChart3, Trash2, Plus, Users, AlertTriangle, BookOpen } from 'lucide-react';
// 获取友好的AI模型名称
function getModelDisplayName(modelId: string): string {
@@ -1162,10 +1162,11 @@ function ExchangeConfigModal({
const [secretKey, setSecretKey] = useState('');
const [passphrase, setPassphrase] = useState('');
const [testnet, setTestnet] = useState(false);
const [showGuide, setShowGuide] = useState(false);
// Hyperliquid 特定字段
const [hyperliquidWalletAddr, setHyperliquidWalletAddr] = useState('');
// Aster 特定字段
const [asterUser, setAsterUser] = useState('');
const [asterSigner, setAsterSigner] = useState('');
@@ -1226,21 +1227,34 @@ function ExchangeConfigModal({
<h3 className="text-xl font-bold" style={{ color: '#EAECEF' }}>
{editingExchangeId ? t('editExchange', language) : t('addExchange', language)}
</h3>
{editingExchangeId && (
<button
type="button"
onClick={() => {
if (confirm(t('confirmDeleteExchange', language))) {
onDelete(editingExchangeId);
}
}}
className="p-2 rounded hover:bg-red-100 transition-colors"
style={{ background: 'rgba(246, 70, 93, 0.1)', color: '#F6465D' }}
title={t('deleteConfigFailed', language)}
>
<Trash2 className="w-4 h-4" />
</button>
)}
<div className="flex items-center gap-2">
{selectedExchange?.id === 'binance' && (
<button
type="button"
onClick={() => setShowGuide(true)}
className="px-3 py-2 rounded text-sm font-semibold transition-all hover:scale-105 flex items-center gap-2"
style={{ background: 'rgba(240, 185, 11, 0.1)', color: '#F0B90B' }}
>
<BookOpen className="w-4 h-4" />
{t('viewGuide', language)}
</button>
)}
{editingExchangeId && (
<button
type="button"
onClick={() => {
if (confirm(t('confirmDeleteExchange', language))) {
onDelete(editingExchangeId);
}
}}
className="p-2 rounded hover:bg-red-100 transition-colors"
style={{ background: 'rgba(246, 70, 93, 0.1)', color: '#F6465D' }}
title={t('deleteConfigFailed', language)}
>
<Trash2 className="w-4 h-4" />
</button>
)}
</div>
</div>
<form onSubmit={handleSubmit} className="space-y-4">
@@ -1468,7 +1482,7 @@ function ExchangeConfigModal({
<button
type="submit"
disabled={
!selectedExchange ||
!selectedExchange ||
(selectedExchange.id === 'binance' && (!apiKey.trim() || !secretKey.trim())) ||
(selectedExchange.id === 'okx' && (!apiKey.trim() || !secretKey.trim() || !passphrase.trim())) ||
(selectedExchange.id === 'hyperliquid' && (!apiKey.trim() || !hyperliquidWalletAddr.trim())) ||
@@ -1483,6 +1497,34 @@ function ExchangeConfigModal({
</div>
</form>
</div>
{/* Binance Setup Guide Modal */}
{showGuide && (
<div className="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4" onClick={() => setShowGuide(false)}>
<div className="bg-gray-800 rounded-lg p-6 w-full max-w-4xl relative" style={{ background: '#1E2329' }} onClick={(e) => e.stopPropagation()}>
<div className="flex items-center justify-between mb-4">
<h3 className="text-xl font-bold flex items-center gap-2" style={{ color: '#EAECEF' }}>
<BookOpen className="w-6 h-6" style={{ color: '#F0B90B' }} />
{t('binanceSetupGuide', language)}
</h3>
<button
onClick={() => setShowGuide(false)}
className="px-4 py-2 rounded text-sm font-semibold transition-all hover:scale-105"
style={{ background: '#2B3139', color: '#848E9C' }}
>
{t('closeGuide', language)}
</button>
</div>
<div className="overflow-y-auto max-h-[80vh]">
<img
src="/images/guide.png"
alt={t('binanceSetupGuide', language)}
className="w-full h-auto rounded"
/>
</div>
</div>
</div>
)}
</div>
);
}

View File

@@ -257,6 +257,9 @@ export const translations = {
exchangeConfigWarning2: '• Do not grant withdrawal permissions to ensure fund security',
exchangeConfigWarning3: '• After deleting configuration, related traders will not be able to trade',
edit: 'Edit',
viewGuide: 'View Guide',
binanceSetupGuide: 'Binance Setup Guide',
closeGuide: 'Close',
// Error Messages
createTraderFailed: 'Failed to create trader',
@@ -671,6 +674,9 @@ export const translations = {
exchangeConfigWarning2: '• 不要授予提现权限,确保资金安全',
exchangeConfigWarning3: '• 删除配置后,相关交易员将无法正常交易',
edit: '编辑',
viewGuide: '查看教程',
binanceSetupGuide: '币安配置教程',
closeGuide: '关闭',
// Error Messages
createTraderFailed: '创建交易员失败',