import React, { useState } from 'react'; import { HashRouter, Routes, Route, Link, Navigate } from 'react-router-dom'; import { Terminal, Flag, Trophy, Newspaper, Shield, Settings, LogOut, X } from 'lucide-react'; import { CTFProvider, useCTF } from './CTFContext'; import { ProtectedRoute, Button, Countdown } from './UIComponents'; import { Home } from './Home'; import { ChallengeList } from './Challenges'; import { Blog } from './Blog'; import { Scoreboard, ScoreMatrix } from './Scoreboard'; import { Admin } from './Admin'; import { Login, Register } from './Auth'; const ProfileSettingsModal: React.FC<{ onClose: () => void }> = ({ onClose }) => { const { updateProfile } = useCTF(); const [password, setPassword] = useState(''); const [confirm, setConfirm] = useState(''); const [error, setError] = useState(''); const [success, setSuccess] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (password !== confirm) return setError('PASSWORD_MISMATCH'); try { await updateProfile(password); setSuccess(true); setTimeout(onClose, 2000); } catch (err: any) { setError('FAILED'); } }; return (

IDENTITY_SETTINGS

{success ?
UPDATED_SUCCESSFULLY
: (
setPassword(e.target.value)} required /> setConfirm(e.target.value)} required /> {error &&

{error}

}
)}
); }; const LayoutShell: React.FC = () => { const { state, currentUser, logout, loading, loadError } = useCTF(); const [showProfileModal, setShowProfileModal] = useState(false); if (loading) return
INITIALIZING_SESSION...
; const now = Date.now(); const eventStartTime = parseInt(state.config.eventStartTime || "0"); const eventEndTime = parseInt(state.config.eventEndTime || (Date.now() + 86400000).toString()); const isEventLive = now >= eventStartTime && now <= eventEndTime && state.isStarted; const bgStyles: React.CSSProperties = { backgroundColor: state.config.bgType === 'color' ? (state.config.bgColor || '#000000') : '#000000' }; return (
{loadError &&
{loadError}
} {state.config.bgType === 'image' && state.config.bgImageData && (
)}
} /> } /> } /> } /> } /> } /> } /> {currentUser?.isAdmin ? : }} /> } />
{showProfileModal && setShowProfileModal(false)} />}
); }; const App: React.FC = () => { return ( ); }; export default App;