mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 01:06:59 +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 { CompetitionPage } from './components/CompetitionPage';
|
||||||
import { LandingPage } from './pages/LandingPage';
|
import { LandingPage } from './pages/LandingPage';
|
||||||
import HeaderBar from './components/landing/HeaderBar';
|
import HeaderBar from './components/landing/HeaderBar';
|
||||||
import LoginModal from './components/landing/LoginModal';
|
|
||||||
import AILearning from './components/AILearning';
|
import AILearning from './components/AILearning';
|
||||||
import { LanguageProvider, useLanguage } from './contexts/LanguageContext';
|
import { LanguageProvider, useLanguage } from './contexts/LanguageContext';
|
||||||
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
||||||
import { t, type Language } from './i18n/translations';
|
import { t, type Language } from './i18n/translations';
|
||||||
import { useSystemConfig } from './hooks/useSystemConfig';
|
import { useSystemConfig } from './hooks/useSystemConfig';
|
||||||
import { Zap } from 'lucide-react';
|
|
||||||
import type {
|
import type {
|
||||||
SystemStatus,
|
SystemStatus,
|
||||||
AccountInfo,
|
AccountInfo,
|
||||||
@@ -45,7 +43,6 @@ function App() {
|
|||||||
const { user, token, logout, isLoading } = useAuth();
|
const { user, token, logout, isLoading } = useAuth();
|
||||||
const { config: systemConfig, loading: configLoading } = useSystemConfig();
|
const { config: systemConfig, loading: configLoading } = useSystemConfig();
|
||||||
const [route, setRoute] = useState(window.location.pathname);
|
const [route, setRoute] = useState(window.location.pathname);
|
||||||
const [showLoginModal, setShowLoginModal] = useState(false);
|
|
||||||
|
|
||||||
// 从URL路径读取初始页面状态(支持刷新保持页面)
|
// 从URL路径读取初始页面状态(支持刷新保持页面)
|
||||||
const getInitialPage = (): Page => {
|
const getInitialPage = (): Page => {
|
||||||
@@ -216,7 +213,7 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<div className="min-h-screen" style={{ background: '#000000', color: '#EAECEF' }}>
|
<div className="min-h-screen" style={{ background: '#000000', color: '#EAECEF' }}>
|
||||||
<HeaderBar
|
<HeaderBar
|
||||||
onLoginClick={() => setShowLoginModal(true)}
|
|
||||||
isLoggedIn={!!user}
|
isLoggedIn={!!user}
|
||||||
currentPage="competition"
|
currentPage="competition"
|
||||||
language={language}
|
language={language}
|
||||||
@@ -269,7 +266,7 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<div className="min-h-screen" style={{ background: 'var(--brand-black)', color: 'var(--brand-light-gray)' }}>
|
<div className="min-h-screen" style={{ background: 'var(--brand-black)', color: 'var(--brand-light-gray)' }}>
|
||||||
<HeaderBar
|
<HeaderBar
|
||||||
onLoginClick={() => setShowLoginModal(true)}
|
|
||||||
isLoggedIn={!!user}
|
isLoggedIn={!!user}
|
||||||
isHomePage={false}
|
isHomePage={false}
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export function LoginPage() {
|
|||||||
isHomePage={false}
|
isHomePage={false}
|
||||||
currentPage="login"
|
currentPage="login"
|
||||||
language={language}
|
language={language}
|
||||||
onLanguageChange={(lang) => {}}
|
onLanguageChange={() => {}}
|
||||||
onPageChange={(page) => {
|
onPageChange={(page) => {
|
||||||
console.log('LoginPage onPageChange called with:', page);
|
console.log('LoginPage onPageChange called with:', page);
|
||||||
if (page === 'competition') {
|
if (page === 'competition') {
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
import { useState, useEffect, useRef } from 'react'
|
import { useState, useEffect, useRef } from 'react'
|
||||||
import { motion } from 'framer-motion'
|
import { motion } from 'framer-motion'
|
||||||
import { Menu, X, ChevronDown } from 'lucide-react'
|
import { Menu, X, ChevronDown } from 'lucide-react'
|
||||||
import { t } from '../../i18n/translations'
|
import { t, type Language } from '../../i18n/translations'
|
||||||
|
|
||||||
interface HeaderBarProps {
|
interface HeaderBarProps {
|
||||||
onLoginClick: () => void
|
onLoginClick?: () => void
|
||||||
isLoggedIn?: boolean
|
isLoggedIn?: boolean
|
||||||
isHomePage?: boolean
|
isHomePage?: boolean
|
||||||
currentPage?: string
|
currentPage?: string
|
||||||
language?: string
|
language?: Language
|
||||||
onLanguageChange?: (lang: string) => void
|
onLanguageChange?: (lang: Language) => void
|
||||||
user?: { email: string } | null
|
user?: { email: string } | null
|
||||||
onLogout?: () => void
|
onLogout?: () => void
|
||||||
isAdminMode?: boolean
|
isAdminMode?: boolean
|
||||||
onPageChange?: (page: string) => void
|
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 [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
||||||
const [languageDropdownOpen, setLanguageDropdownOpen] = useState(false)
|
const [languageDropdownOpen, setLanguageDropdownOpen] = useState(false)
|
||||||
const [userDropdownOpen, setUserDropdownOpen] = useState(false)
|
const [userDropdownOpen, setUserDropdownOpen] = useState(false)
|
||||||
|
|||||||
@@ -301,12 +301,12 @@ export const translations = {
|
|||||||
scanQRCodeInstructions: 'Scan this QR code with Google Authenticator or Authy',
|
scanQRCodeInstructions: 'Scan this QR code with Google Authenticator or Authy',
|
||||||
otpSecret: 'Or enter this secret manually:',
|
otpSecret: 'Or enter this secret manually:',
|
||||||
qrCodeHint: 'QR code (if scanning fails, use the secret below):',
|
qrCodeHint: 'QR code (if scanning fails, use the secret below):',
|
||||||
step1Title: 'Step 1: Install Google Authenticator',
|
authStep1Title: 'Step 1: Install Google Authenticator',
|
||||||
step1Desc: 'Download and install Google Authenticator from your app store',
|
authStep1Desc: 'Download and install Google Authenticator from your app store',
|
||||||
step2Title: 'Step 2: Add account',
|
authStep2Title: 'Step 2: Add account',
|
||||||
step2Desc: 'Tap "+", then choose "Scan QR code" or "Enter a setup key"',
|
authStep2Desc: 'Tap "+", then choose "Scan QR code" or "Enter a setup key"',
|
||||||
step3Title: 'Step 3: Verify setup',
|
authStep3Title: 'Step 3: Verify setup',
|
||||||
step3Desc: 'After setup, continue to enter the 6-digit code',
|
authStep3Desc: 'After setup, continue to enter the 6-digit code',
|
||||||
setupCompleteContinue: 'I have completed setup, continue',
|
setupCompleteContinue: 'I have completed setup, continue',
|
||||||
copy: 'Copy',
|
copy: 'Copy',
|
||||||
completeRegistration: 'Complete Registration',
|
completeRegistration: 'Complete Registration',
|
||||||
@@ -713,12 +713,12 @@ export const translations = {
|
|||||||
scanQRCodeInstructions: '使用Google Authenticator或Authy扫描此二维码',
|
scanQRCodeInstructions: '使用Google Authenticator或Authy扫描此二维码',
|
||||||
otpSecret: '或手动输入此密钥:',
|
otpSecret: '或手动输入此密钥:',
|
||||||
qrCodeHint: '二维码(如果无法扫描,请使用下方密钥):',
|
qrCodeHint: '二维码(如果无法扫描,请使用下方密钥):',
|
||||||
step1Title: '步骤1:下载Google Authenticator',
|
authStep1Title: '步骤1:下载Google Authenticator',
|
||||||
step1Desc: '在手机应用商店下载并安装Google Authenticator应用',
|
authStep1Desc: '在手机应用商店下载并安装Google Authenticator应用',
|
||||||
step2Title: '步骤2:添加账户',
|
authStep2Title: '步骤2:添加账户',
|
||||||
step2Desc: '在应用中点击“+”,选择“扫描二维码”或“手动输入密钥”',
|
authStep2Desc: '在应用中点击“+”,选择“扫描二维码”或“手动输入密钥”',
|
||||||
step3Title: '步骤3:验证设置',
|
authStep3Title: '步骤3:验证设置',
|
||||||
step3Desc: '设置完成后,点击下方按钮输入6位验证码',
|
authStep3Desc: '设置完成后,点击下方按钮输入6位验证码',
|
||||||
setupCompleteContinue: '我已完成设置,继续',
|
setupCompleteContinue: '我已完成设置,继续',
|
||||||
copy: '复制',
|
copy: '复制',
|
||||||
completeRegistration: '完成注册',
|
completeRegistration: '完成注册',
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function LandingPage() {
|
|||||||
<AboutSection language={language} />
|
<AboutSection language={language} />
|
||||||
<FeaturesSection language={language} />
|
<FeaturesSection language={language} />
|
||||||
<HowItWorksSection language={language} />
|
<HowItWorksSection language={language} />
|
||||||
<CommunitySection language={language} />
|
<CommunitySection />
|
||||||
|
|
||||||
{/* CTA */}
|
{/* CTA */}
|
||||||
<AnimatedSection backgroundColor='var(--panel-bg)'>
|
<AnimatedSection backgroundColor='var(--panel-bg)'>
|
||||||
|
|||||||
Reference in New Issue
Block a user