diff --git a/web/src/App.tsx b/web/src/App.tsx index 9335c132..11e604ce 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -8,13 +8,11 @@ import { RegisterPage } from './components/RegisterPage'; import { CompetitionPage } from './components/CompetitionPage'; import { LandingPage } from './pages/LandingPage'; import HeaderBar from './components/landing/HeaderBar'; -import LoginModal from './components/landing/LoginModal'; import AILearning from './components/AILearning'; import { LanguageProvider, useLanguage } from './contexts/LanguageContext'; import { AuthProvider, useAuth } from './contexts/AuthContext'; import { t, type Language } from './i18n/translations'; import { useSystemConfig } from './hooks/useSystemConfig'; -import { Zap } from 'lucide-react'; import type { SystemStatus, AccountInfo, @@ -45,7 +43,6 @@ function App() { const { user, token, logout, isLoading } = useAuth(); const { config: systemConfig, loading: configLoading } = useSystemConfig(); const [route, setRoute] = useState(window.location.pathname); - const [showLoginModal, setShowLoginModal] = useState(false); // 从URL路径读取初始页面状态(支持刷新保持页面) const getInitialPage = (): Page => { @@ -216,7 +213,7 @@ function App() { return (
setShowLoginModal(true)} + isLoggedIn={!!user} currentPage="competition" language={language} @@ -269,7 +266,7 @@ function App() { return (
setShowLoginModal(true)} + isLoggedIn={!!user} isHomePage={false} currentPage={currentPage} diff --git a/web/src/components/LoginPage.tsx b/web/src/components/LoginPage.tsx index 9040fba1..a1ed3512 100644 --- a/web/src/components/LoginPage.tsx +++ b/web/src/components/LoginPage.tsx @@ -57,7 +57,7 @@ export function LoginPage() { isHomePage={false} currentPage="login" language={language} - onLanguageChange={(lang) => {}} + onLanguageChange={() => {}} onPageChange={(page) => { console.log('LoginPage onPageChange called with:', page); if (page === 'competition') { diff --git a/web/src/components/landing/HeaderBar.tsx b/web/src/components/landing/HeaderBar.tsx index b5531dcc..41db209b 100644 --- a/web/src/components/landing/HeaderBar.tsx +++ b/web/src/components/landing/HeaderBar.tsx @@ -1,22 +1,22 @@ import { useState, useEffect, useRef } from 'react' import { motion } from 'framer-motion' import { Menu, X, ChevronDown } from 'lucide-react' -import { t } from '../../i18n/translations' +import { t, type Language } from '../../i18n/translations' interface HeaderBarProps { - onLoginClick: () => void + onLoginClick?: () => void isLoggedIn?: boolean isHomePage?: boolean currentPage?: string - language?: string - onLanguageChange?: (lang: string) => void + language?: Language + onLanguageChange?: (lang: Language) => void user?: { email: string } | null onLogout?: () => void isAdminMode?: boolean onPageChange?: (page: string) => void } -export default function HeaderBar({ onLoginClick, isLoggedIn = false, isHomePage = false, currentPage, language = 'zh', onLanguageChange, user, onLogout, isAdminMode = false, onPageChange }: HeaderBarProps) { +export default function HeaderBar({ isLoggedIn = false, isHomePage = false, currentPage, language = 'zh' as Language, onLanguageChange, user, onLogout, isAdminMode = false, onPageChange }: HeaderBarProps) { const [mobileMenuOpen, setMobileMenuOpen] = useState(false) const [languageDropdownOpen, setLanguageDropdownOpen] = useState(false) const [userDropdownOpen, setUserDropdownOpen] = useState(false) diff --git a/web/src/i18n/translations.ts b/web/src/i18n/translations.ts index 2aff0bdc..8cab8cbe 100644 --- a/web/src/i18n/translations.ts +++ b/web/src/i18n/translations.ts @@ -301,12 +301,12 @@ export const translations = { scanQRCodeInstructions: 'Scan this QR code with Google Authenticator or Authy', otpSecret: 'Or enter this secret manually:', qrCodeHint: 'QR code (if scanning fails, use the secret below):', - step1Title: 'Step 1: Install Google Authenticator', - step1Desc: 'Download and install Google Authenticator from your app store', - step2Title: 'Step 2: Add account', - step2Desc: 'Tap "+", then choose "Scan QR code" or "Enter a setup key"', - step3Title: 'Step 3: Verify setup', - step3Desc: 'After setup, continue to enter the 6-digit code', + authStep1Title: 'Step 1: Install Google Authenticator', + authStep1Desc: 'Download and install Google Authenticator from your app store', + authStep2Title: 'Step 2: Add account', + authStep2Desc: 'Tap "+", then choose "Scan QR code" or "Enter a setup key"', + authStep3Title: 'Step 3: Verify setup', + authStep3Desc: 'After setup, continue to enter the 6-digit code', setupCompleteContinue: 'I have completed setup, continue', copy: 'Copy', completeRegistration: 'Complete Registration', @@ -713,12 +713,12 @@ export const translations = { scanQRCodeInstructions: '使用Google Authenticator或Authy扫描此二维码', otpSecret: '或手动输入此密钥:', qrCodeHint: '二维码(如果无法扫描,请使用下方密钥):', - step1Title: '步骤1:下载Google Authenticator', - step1Desc: '在手机应用商店下载并安装Google Authenticator应用', - step2Title: '步骤2:添加账户', - step2Desc: '在应用中点击“+”,选择“扫描二维码”或“手动输入密钥”', - step3Title: '步骤3:验证设置', - step3Desc: '设置完成后,点击下方按钮输入6位验证码', + authStep1Title: '步骤1:下载Google Authenticator', + authStep1Desc: '在手机应用商店下载并安装Google Authenticator应用', + authStep2Title: '步骤2:添加账户', + authStep2Desc: '在应用中点击“+”,选择“扫描二维码”或“手动输入密钥”', + authStep3Title: '步骤3:验证设置', + authStep3Desc: '设置完成后,点击下方按钮输入6位验证码', setupCompleteContinue: '我已完成设置,继续', copy: '复制', completeRegistration: '完成注册', diff --git a/web/src/pages/LandingPage.tsx b/web/src/pages/LandingPage.tsx index 1d835917..5f1e9e93 100644 --- a/web/src/pages/LandingPage.tsx +++ b/web/src/pages/LandingPage.tsx @@ -47,7 +47,7 @@ export function LandingPage() { - + {/* CTA */}