Files
trumpsignal-frontend/app/[locale]/layout.tsx
T
k 594d9817ba fix(analytics): never mix paper + live P&L; settings live-switch copy
Money-safety/accuracy bug: analytics computed total P&L, win rate, drawdown,
and every metric over ALL trades regardless of is_paper. A user who tried
paper mode then went live saw simulated and real P&L summed into one number
on the page whose entire purpose is 'did the bot make REAL money'.

Now: split trades by is_paper. Default to LIVE. A Live/Paper toggle appears
only when the wallet has both; otherwise auto-pick whichever exists. Paper
view shows a prominent 'SIMULATED — not real-money results' banner. All
metrics derive from the selected mode's trades only.

Also: BotConfigPanel handleUpgradeToLive copy now states Auto-Trade is forced
OFF on the paper→live switch (matches backend subscribe.py safety reset).

tsc + next build clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 01:03:15 +08:00

73 lines
2.7 KiB
TypeScript

import type { Metadata } from 'next'
import { NextIntlClientProvider } from 'next-intl'
import { getMessages, getTranslations } from 'next-intl/server'
import { notFound } from 'next/navigation'
import Link from 'next/link'
import { locales } from '@/i18n'
import Providers from './Providers'
import Navbar from '@/components/nav/Navbar'
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://trumpsignal.com'
interface LayoutProps {
children: React.ReactNode
params: Promise<{ locale: string }>
}
export async function generateMetadata({ params }: LayoutProps): Promise<Metadata> {
const { locale } = await params
const isZh = false // i18n shelved — Chinese branches kept as dead code for future revival; see messages/zh.json
return {
alternates: {
canonical: `${siteUrl}/${locale}`,
languages: {
'en': `${siteUrl}/en`,
'x-default': `${siteUrl}/en`,
},
},
openGraph: {
locale: isZh ? 'zh_CN' : 'en_US',
alternateLocale: isZh ? ['en_US'] : ['zh_CN'],
},
}
}
export default async function LocaleLayout({ children, params }: LayoutProps) {
const { locale } = await params
if (!locales.includes(locale as (typeof locales)[number])) {
notFound()
}
const messages = await getMessages()
const t = await getTranslations({ locale, namespace: 'footer' })
const href = (path: string) => `/${locale}${path}`
return (
<NextIntlClientProvider messages={messages}>
<Providers>
<Navbar />
<main>{children}</main>
<footer style={{
borderTop: '1px solid var(--line)',
padding: '20px 32px',
display: 'flex',
gap: 16,
alignItems: 'center',
flexWrap: 'wrap',
fontSize: 12,
color: 'var(--ink-3)',
marginTop: 48,
}}>
<span>© {new Date().getFullYear()} Trump Alpha a research project by Endorphin</span>
<Link href={href('/methodology')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('methodology')}</Link>
<Link href={href('/glossary')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('glossary')}</Link>
<Link href={href('/case-studies')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('caseStudies')}</Link>
<Link href={href('/privacy')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('privacy')}</Link>
<Link href={href('/terms')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('terms')}</Link>
<Link href={href('/contact')} style={{ color: 'var(--ink-3)', textDecoration: 'none' }}>{t('contact')}</Link>
</footer>
</Providers>
</NextIntlClientProvider>
)
}