mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-04 03:21:04 +08:00
fix: resolve all TypeScript build errors
- Remove unused imports (LoginModal, Zap) and variables - Fix Language type mismatches across components - Update HeaderBar interface to use Language type - Remove unused onLoginClick parameter - Fix duplicate translation keys by renaming auth steps - Remove invalid language prop from CommunitySection 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -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 (
|
||||
<div className="min-h-screen" style={{ background: '#000000', color: '#EAECEF' }}>
|
||||
<HeaderBar
|
||||
onLoginClick={() => setShowLoginModal(true)}
|
||||
|
||||
isLoggedIn={!!user}
|
||||
currentPage="competition"
|
||||
language={language}
|
||||
@@ -269,7 +266,7 @@ function App() {
|
||||
return (
|
||||
<div className="min-h-screen" style={{ background: 'var(--brand-black)', color: 'var(--brand-light-gray)' }}>
|
||||
<HeaderBar
|
||||
onLoginClick={() => setShowLoginModal(true)}
|
||||
|
||||
isLoggedIn={!!user}
|
||||
isHomePage={false}
|
||||
currentPage={currentPage}
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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: '完成注册',
|
||||
|
||||
@@ -47,7 +47,7 @@ export function LandingPage() {
|
||||
<AboutSection language={language} />
|
||||
<FeaturesSection language={language} />
|
||||
<HowItWorksSection language={language} />
|
||||
<CommunitySection language={language} />
|
||||
<CommunitySection />
|
||||
|
||||
{/* CTA */}
|
||||
<AnimatedSection backgroundColor='var(--panel-bg)'>
|
||||
|
||||
Reference in New Issue
Block a user