Skip to content

Commit 16a1327

Browse files
Merge pull request NoFxAiOS#404 from 0xEmberZz/feature/binance-guide
feat: Add Binance setup guide with tutorial modal
2 parents c7271ca + 94b7b05 commit 16a1327

3 files changed

Lines changed: 67 additions & 19 deletions

File tree

web/public/images/guide.png

712 KB
Loading

web/src/components/AITradersPage.tsx

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useAuth } from '../contexts/AuthContext';
88
import { getExchangeIcon } from './ExchangeIcons';
99
import { getModelIcon } from './ModelIcons';
1010
import { TraderConfigModal } from './TraderConfigModal';
11-
import { Bot, Brain, Landmark, BarChart3, Trash2, Plus, Users, AlertTriangle } from 'lucide-react';
11+
import { Bot, Brain, Landmark, BarChart3, Trash2, Plus, Users, AlertTriangle, BookOpen } from 'lucide-react';
1212

1313
// 获取友好的AI模型名称
1414
function getModelDisplayName(modelId: string): string {
@@ -1162,10 +1162,11 @@ function ExchangeConfigModal({
11621162
const [secretKey, setSecretKey] = useState('');
11631163
const [passphrase, setPassphrase] = useState('');
11641164
const [testnet, setTestnet] = useState(false);
1165-
1165+
const [showGuide, setShowGuide] = useState(false);
1166+
11661167
// Hyperliquid 特定字段
11671168
const [hyperliquidWalletAddr, setHyperliquidWalletAddr] = useState('');
1168-
1169+
11691170
// Aster 特定字段
11701171
const [asterUser, setAsterUser] = useState('');
11711172
const [asterSigner, setAsterSigner] = useState('');
@@ -1226,21 +1227,34 @@ function ExchangeConfigModal({
12261227
<h3 className="text-xl font-bold" style={{ color: '#EAECEF' }}>
12271228
{editingExchangeId ? t('editExchange', language) : t('addExchange', language)}
12281229
</h3>
1229-
{editingExchangeId && (
1230-
<button
1231-
type="button"
1232-
onClick={() => {
1233-
if (confirm(t('confirmDeleteExchange', language))) {
1234-
onDelete(editingExchangeId);
1235-
}
1236-
}}
1237-
className="p-2 rounded hover:bg-red-100 transition-colors"
1238-
style={{ background: 'rgba(246, 70, 93, 0.1)', color: '#F6465D' }}
1239-
title={t('deleteConfigFailed', language)}
1240-
>
1241-
<Trash2 className="w-4 h-4" />
1242-
</button>
1243-
)}
1230+
<div className="flex items-center gap-2">
1231+
{selectedExchange?.id === 'binance' && (
1232+
<button
1233+
type="button"
1234+
onClick={() => setShowGuide(true)}
1235+
className="px-3 py-2 rounded text-sm font-semibold transition-all hover:scale-105 flex items-center gap-2"
1236+
style={{ background: 'rgba(240, 185, 11, 0.1)', color: '#F0B90B' }}
1237+
>
1238+
<BookOpen className="w-4 h-4" />
1239+
{t('viewGuide', language)}
1240+
</button>
1241+
)}
1242+
{editingExchangeId && (
1243+
<button
1244+
type="button"
1245+
onClick={() => {
1246+
if (confirm(t('confirmDeleteExchange', language))) {
1247+
onDelete(editingExchangeId);
1248+
}
1249+
}}
1250+
className="p-2 rounded hover:bg-red-100 transition-colors"
1251+
style={{ background: 'rgba(246, 70, 93, 0.1)', color: '#F6465D' }}
1252+
title={t('deleteConfigFailed', language)}
1253+
>
1254+
<Trash2 className="w-4 h-4" />
1255+
</button>
1256+
)}
1257+
</div>
12441258
</div>
12451259

12461260
<form onSubmit={handleSubmit} className="space-y-4">
@@ -1468,7 +1482,7 @@ function ExchangeConfigModal({
14681482
<button
14691483
type="submit"
14701484
disabled={
1471-
!selectedExchange ||
1485+
!selectedExchange ||
14721486
(selectedExchange.id === 'binance' && (!apiKey.trim() || !secretKey.trim())) ||
14731487
(selectedExchange.id === 'okx' && (!apiKey.trim() || !secretKey.trim() || !passphrase.trim())) ||
14741488
(selectedExchange.id === 'hyperliquid' && (!apiKey.trim() || !hyperliquidWalletAddr.trim())) ||
@@ -1483,6 +1497,34 @@ function ExchangeConfigModal({
14831497
</div>
14841498
</form>
14851499
</div>
1500+
1501+
{/* Binance Setup Guide Modal */}
1502+
{showGuide && (
1503+
<div className="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4" onClick={() => setShowGuide(false)}>
1504+
<div className="bg-gray-800 rounded-lg p-6 w-full max-w-4xl relative" style={{ background: '#1E2329' }} onClick={(e) => e.stopPropagation()}>
1505+
<div className="flex items-center justify-between mb-4">
1506+
<h3 className="text-xl font-bold flex items-center gap-2" style={{ color: '#EAECEF' }}>
1507+
<BookOpen className="w-6 h-6" style={{ color: '#F0B90B' }} />
1508+
{t('binanceSetupGuide', language)}
1509+
</h3>
1510+
<button
1511+
onClick={() => setShowGuide(false)}
1512+
className="px-4 py-2 rounded text-sm font-semibold transition-all hover:scale-105"
1513+
style={{ background: '#2B3139', color: '#848E9C' }}
1514+
>
1515+
{t('closeGuide', language)}
1516+
</button>
1517+
</div>
1518+
<div className="overflow-y-auto max-h-[80vh]">
1519+
<img
1520+
src="/images/guide.png"
1521+
alt={t('binanceSetupGuide', language)}
1522+
className="w-full h-auto rounded"
1523+
/>
1524+
</div>
1525+
</div>
1526+
</div>
1527+
)}
14861528
</div>
14871529
);
14881530
}

web/src/i18n/translations.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ export const translations = {
257257
exchangeConfigWarning2: '• Do not grant withdrawal permissions to ensure fund security',
258258
exchangeConfigWarning3: '• After deleting configuration, related traders will not be able to trade',
259259
edit: 'Edit',
260+
viewGuide: 'View Guide',
261+
binanceSetupGuide: 'Binance Setup Guide',
262+
closeGuide: 'Close',
260263

261264
// Error Messages
262265
createTraderFailed: 'Failed to create trader',
@@ -671,6 +674,9 @@ export const translations = {
671674
exchangeConfigWarning2: '• 不要授予提现权限,确保资金安全',
672675
exchangeConfigWarning3: '• 删除配置后,相关交易员将无法正常交易',
673676
edit: '编辑',
677+
viewGuide: '查看教程',
678+
binanceSetupGuide: '币安配置教程',
679+
closeGuide: '关闭',
674680

675681
// Error Messages
676682
createTraderFailed: '创建交易员失败',

0 commit comments

Comments
 (0)