Files
nofx/web/src/components/common/Header.tsx
tinkle-community 110bf52908 feat: cream terminal redesign, English-only UI, autopilot launch fixes
- Redesign dashboard into a cream-paper + vermilion IBM Plex Mono terminal
  (live L2 order book, cost/liq map, WS K-line, signal matrix, orchestration
  topology, risk radar, execution log, current positions, equity curve)
- Convert all user-facing UI and backend strings/prompts from Chinese to
  English (multi-language retained, default English)
- Add /api/statistics/full endpoint + full-stats frontend wiring
- Fix Autopilot launch: reuse the existing trader instead of creating
  duplicates (eliminates repeat ~35s create cost and stale-trader 404s);
  launch sends 5m scan interval
- Fix unreadable toasts: cream theme with high-contrast text + per-type accent
- Silence background dashboard polls (getTraderConfig) to stop error-toast spam
2026-06-30 16:03:52 +08:00

77 lines
2.5 KiB
TypeScript

import { useLanguage } from '../../contexts/LanguageContext'
import { t } from '../../i18n/translations'
import { Container } from './Container'
interface HeaderProps {
simple?: boolean // For login/register pages
}
export function Header({ simple = false }: HeaderProps) {
const { language, setLanguage } = useLanguage()
return (
<header className="glass sticky top-0 z-50 backdrop-blur-xl">
<Container className="py-4">
<div className="flex items-center justify-between">
{/* Left - Logo and Title */}
<div className="flex items-center gap-3">
<div className="flex items-center justify-center">
<img src="/icons/nofx.svg" alt="NoFx Logo" className="w-8 h-8" />
</div>
<div>
<h1 className="text-xl font-bold" style={{ color: '#1A1813' }}>
{t('appTitle', language)}
</h1>
{!simple && (
<p className="text-xs mono" style={{ color: '#8A8478' }}>
{t('subtitle', language)}
</p>
)}
</div>
</div>
{/* Right - Language Toggle (always show) */}
<div
className="flex gap-1 rounded p-1"
style={{ background: '#E8E2D5' }}
>
<button
onClick={() => setLanguage('zh')}
className="px-3 py-1.5 rounded text-xs font-semibold transition-all"
style={
language === 'zh'
? { background: '#E0483B', color: '#F1ECE2' }
: { background: 'transparent', color: '#8A8478' }
}
>
Chinese
</button>
<button
onClick={() => setLanguage('en')}
className="px-3 py-1.5 rounded text-xs font-semibold transition-all"
style={
language === 'en'
? { background: '#E0483B', color: '#F1ECE2' }
: { background: 'transparent', color: '#8A8478' }
}
>
EN
</button>
<button
onClick={() => setLanguage('id')}
className="px-3 py-1.5 rounded text-xs font-semibold transition-all"
style={
language === 'id'
? { background: '#E0483B', color: '#F1ECE2' }
: { background: 'transparent', color: '#8A8478' }
}
>
ID
</button>
</div>
</div>
</Container>
</header>
)
}