mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-06 20:41:14 +08:00
fix: update token limits and error handling in Trader Dashboard
This commit is contained in:
@@ -323,8 +323,8 @@ function App() {
|
||||
const selectedTrader = traders?.find((t) => t.trader_id === selectedTraderId)
|
||||
|
||||
const effectiveAccount = account
|
||||
const effectivePositions = (positionsPollOff && !positions) ? [] as Position[] : positions
|
||||
const effectiveDecisions = (decisionsPollOff && !decisions) ? [] as DecisionRecord[] : decisions
|
||||
const effectivePositions = positions
|
||||
const effectiveDecisions = decisions
|
||||
|
||||
// Handle routing
|
||||
useEffect(() => {
|
||||
@@ -544,7 +544,9 @@ function App() {
|
||||
account={effectiveAccount}
|
||||
accountFailed={accountPollOff}
|
||||
positions={effectivePositions}
|
||||
positionsFailed={positionsPollOff}
|
||||
decisions={effectiveDecisions}
|
||||
decisionsFailed={decisionsPollOff}
|
||||
decisionsLimit={decisionsLimit}
|
||||
onDecisionsLimitChange={setDecisionsLimit}
|
||||
stats={stats}
|
||||
|
||||
@@ -1167,6 +1167,9 @@ export const translations = {
|
||||
close: 'Close',
|
||||
showingPositions: 'Showing {shown} of {total} positions',
|
||||
perPage: 'Per page',
|
||||
accountFetchFailed: 'DATA_FETCH::FAILED — Account data unavailable, check connection',
|
||||
positionsFetchFailed: 'Position data unavailable',
|
||||
decisionsFetchFailed: 'Decision data unavailable',
|
||||
},
|
||||
|
||||
// AITradersPage toast messages
|
||||
@@ -2467,6 +2470,9 @@ export const translations = {
|
||||
close: '平仓',
|
||||
showingPositions: '显示 {shown} / {total} 个持仓',
|
||||
perPage: '每页',
|
||||
accountFetchFailed: 'DATA_FETCH::FAILED — 账户数据请求失败,请检查连接',
|
||||
positionsFetchFailed: '持仓数据请求失败',
|
||||
decisionsFetchFailed: '决策记录请求失败',
|
||||
},
|
||||
|
||||
aiTradersToast: {
|
||||
@@ -3570,6 +3576,9 @@ export const translations = {
|
||||
close: 'Tutup',
|
||||
showingPositions: 'Menampilkan {shown} dari {total} posisi',
|
||||
perPage: 'Per halaman',
|
||||
accountFetchFailed: 'DATA_FETCH::FAILED — Data akun tidak tersedia, periksa koneksi',
|
||||
positionsFetchFailed: 'Data posisi tidak tersedia',
|
||||
decisionsFetchFailed: 'Data keputusan tidak tersedia',
|
||||
},
|
||||
|
||||
aiTradersToast: {
|
||||
|
||||
@@ -105,7 +105,9 @@ interface TraderDashboardPageProps {
|
||||
account?: AccountInfo
|
||||
accountFailed?: boolean
|
||||
positions?: Position[]
|
||||
positionsFailed?: boolean
|
||||
decisions?: DecisionRecord[]
|
||||
decisionsFailed?: boolean
|
||||
decisionsLimit: number
|
||||
onDecisionsLimitChange: (limit: number) => void
|
||||
stats?: Statistics
|
||||
@@ -120,7 +122,9 @@ export function TraderDashboardPage({
|
||||
account,
|
||||
accountFailed,
|
||||
positions,
|
||||
positionsFailed,
|
||||
decisions,
|
||||
decisionsFailed,
|
||||
decisionsLimit,
|
||||
onDecisionsLimitChange,
|
||||
lastUpdate,
|
||||
@@ -491,7 +495,7 @@ export function TraderDashboardPage({
|
||||
<span>PNL::{account.total_pnl?.toFixed(2)}</span>
|
||||
</div>
|
||||
) : accountFailed ? (
|
||||
<span style={{ color: '#F6465D' }}>DATA_FETCH::FAILED — 账户数据请求失败,请检查连接</span>
|
||||
<span style={{ color: '#F6465D' }}>{t('traderDashboard.accountFetchFailed', language)}</span>
|
||||
) : (
|
||||
<div className="flex gap-4">
|
||||
<span className="inline-block w-32 h-3 rounded bg-white/5 animate-pulse" />
|
||||
@@ -723,6 +727,11 @@ export function TraderDashboardPage({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : positionsFailed ? (
|
||||
<div className="text-center py-16 text-nofx-text-muted opacity-60">
|
||||
<div className="text-4xl mb-4">⚠️</div>
|
||||
<div className="text-lg font-semibold mb-2">{t('traderDashboard.positionsFetchFailed', language)}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-16 text-nofx-text-muted opacity-60">
|
||||
<div className="text-6xl mb-4 opacity-50 grayscale">📊</div>
|
||||
@@ -776,6 +785,11 @@ export function TraderDashboardPage({
|
||||
decisions.map((decision, i) => (
|
||||
<DecisionCard key={i} decision={decision} language={language} onSymbolClick={handleSymbolClick} />
|
||||
))
|
||||
) : decisionsFailed ? (
|
||||
<div className="py-16 text-center text-nofx-text-muted opacity-60">
|
||||
<div className="text-4xl mb-4">⚠️</div>
|
||||
<div className="text-lg font-semibold mb-2">{t('traderDashboard.decisionsFetchFailed', language)}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="py-16 text-center text-nofx-text-muted opacity-60">
|
||||
<div className="text-6xl mb-4 opacity-30 grayscale">🧠</div>
|
||||
|
||||
Reference in New Issue
Block a user