Initial commit: Gold Trading Simulator with AI-powered analysis
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import LiveMarketPanel from './components/LiveMarketPanel'
|
||||
import MultiChartSSEPanel from './components/MultiChartSSEPanel'
|
||||
import AccountPositionsPanel from './components/AccountPositionsPanel'
|
||||
import EquityPerformancePanel from './components/EquityPerformancePanel'
|
||||
import DecisionLogPanel from './components/DecisionLogPanel'
|
||||
import SettingsPanel from './components/SettingsPanel'
|
||||
import PromptTemplatesPanel from './components/PromptTemplatesPanel'
|
||||
import { statusApi } from './services/api'
|
||||
|
||||
function Tabs({ tabs, active, onChange }: { tabs: string[]; active: string; onChange: (t: string) => void }) {
|
||||
return (
|
||||
<div style={{ display: 'flex', gap: 8, marginBottom: 12 }}>
|
||||
{tabs.map(t => (
|
||||
<button key={t} className={`btn ${active === t ? 'bg-blue-600 text-white' : 'bg-dark-surface text-gray-300'}`} onClick={() => onChange(t)}>
|
||||
{t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const [activeTab, setActiveTab] = useState<'Live' | 'Account' | 'Equity' | 'Decisions' | 'Settings' | 'Prompts'>('Live')
|
||||
const [backendStatus, setBackendStatus] = useState<any>(null)
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true
|
||||
;(async () => {
|
||||
try {
|
||||
const s = await statusApi.getStatus()
|
||||
if (mounted) setBackendStatus(s)
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
})()
|
||||
return () => { mounted = false }
|
||||
}, [])
|
||||
|
||||
const tabs = ['Live', 'Account', 'Equity', 'Decisions', 'Settings', 'Prompts']
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-dark-bg p-6">
|
||||
<div className="max-w-[1400px] mx-auto">
|
||||
<header className="mb-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-gold-500">Assistant Market Simulator</h1>
|
||||
<p className="text-gray-400 text-sm">Minimal UI wired to new backend endpoints</p>
|
||||
</div>
|
||||
<div className="text-sm text-gray-400">
|
||||
{backendStatus ? (
|
||||
<span>API: {backendStatus.app?.name} v{backendStatus.app?.version}</span>
|
||||
) : (
|
||||
<span>Checking API…</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<Tabs tabs={tabs} active={activeTab} onChange={(t) => setActiveTab(t as any)} />
|
||||
|
||||
{activeTab === 'Live' && (
|
||||
<div style={{ display: 'grid', gap: 16 }}>
|
||||
<LiveMarketPanel />
|
||||
<MultiChartSSEPanel />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === 'Account' && <AccountPositionsPanel />}
|
||||
{activeTab === 'Equity' && <EquityPerformancePanel />}
|
||||
{activeTab === 'Decisions' && <DecisionLogPanel />}
|
||||
{activeTab === 'Settings' && <SettingsPanel />}
|
||||
{activeTab === 'Prompts' && <PromptTemplatesPanel />}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user