fix: division by zero guard, logout redirect, onboarding close button

- auto_trader_risk: skip drawdown check when entryPrice <= 0
- AuthContext: redirect to / on logout
- App.tsx: simplify data page navigation
- BeginnerOnboardingPage: add close button to overlay
This commit is contained in:
shinchan-zhai
2026-03-30 14:02:50 +08:00
parent 55db747318
commit fb0bd13f51
4 changed files with 18 additions and 13 deletions
+1 -13
View File
@@ -451,19 +451,7 @@ function App() {
// Data page - publicly accessible with embedded dashboard
if (route === '/data') {
const dataPageNavigate = (page: Page) => {
const pathMap: Record<string, string> = {
'data': '/data',
'competition': '/competition',
'strategy-market': '/strategy-market',
'traders': '/traders',
'trader': '/dashboard',
'strategy': '/strategy',
'faq': '/faq',
}
const path = pathMap[page]
if (path) {
window.location.href = path
}
navigateToPage(page)
}
return (
<div
+2
View File
@@ -290,6 +290,8 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
setToken(null)
localStorage.removeItem('auth_token')
localStorage.removeItem('auth_user')
window.history.pushState({}, '', '/')
window.dispatchEvent(new PopStateEvent('popstate'))
}
return (
+9
View File
@@ -5,6 +5,7 @@ import {
RefreshCw,
Shield,
Wallet,
X,
} from 'lucide-react'
import { QRCodeSVG } from 'qrcode.react'
import { toast } from 'sonner'
@@ -85,6 +86,14 @@ export function BeginnerOnboardingPage() {
<div className="fixed inset-0 z-[80]">
<div className="absolute inset-0 bg-black/58 backdrop-blur-[2px]" />
<div className="relative flex min-h-screen items-center justify-center px-4 py-10 sm:px-6">
<button
type="button"
onClick={handleContinue}
className="absolute right-6 top-6 z-10 inline-flex h-10 w-10 items-center justify-center rounded-full border border-white/10 bg-white/5 text-zinc-400 transition hover:border-white/20 hover:bg-white/10 hover:text-white"
aria-label={isZh ? '跳过' : 'Skip'}
>
<X className="h-5 w-5" />
</button>
<div className="w-full max-w-[1120px]">
<div className="mb-5 flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
<div className="flex items-center gap-4">