Admin access required.
import { useState } from 'react'; import { Heart, FlaskConical, Stethoscope, Shield, Table2, ArrowLeftRight, LogIn, LogOut, Moon, Sun, Menu, } from 'lucide-react'; import { DiseaseProvider } from './context/DiseaseContext'; import { AuthProvider, useAuth } from './context/AuthContext'; import { ThemeProvider, useTheme } from './context/ThemeContext'; import DiseaseSelector from './components/DiseaseSelector'; import EngineeringMode from './components/EngineeringMode'; import ClinicalEmrMode from './components/ClinicalEmrMode'; import AdminDashboard from './components/AdminDashboard'; import BatchUpload from './components/BatchUpload'; import ComparisonMode from './components/ComparisonMode'; import OfflineBanner from './components/OfflineBanner'; import InstallPrompt from './components/InstallPrompt'; import LoginModal from './components/LoginModal'; const CLINICAL_VIEWS = [ { id: 'engineering', label: 'Engineering Mode', icon: FlaskConical, component: EngineeringMode }, { id: 'clinical', label: 'Clinical EMR Mode', icon: Stethoscope, component: ClinicalEmrMode }, { id: 'batch', label: 'Batch Prediction', icon: Table2, component: BatchUpload }, { id: 'comparison', label: 'Before/After Compare', icon: ArrowLeftRight, component: ComparisonMode }, ]; function AppContent() { const [activeView, setActiveView] = useState('engineering'); const [sidebarOpen, setSidebarOpen] = useState(false); const [showLogin, setShowLogin] = useState(false); const [pendingView, setPendingView] = useState(null); const { user, isAdmin, logout } = useAuth(); const { dark, toggle: toggleTheme } = useTheme(); const isAdminView = activeView === 'admin'; let ActiveComponent = CLINICAL_VIEWS.find((v) => v.id === activeView)?.component || EngineeringMode; if (isAdminView) ActiveComponent = AdminDashboard; function handleAdminClick() { if (user) { setActiveView('admin'); setSidebarOpen(false); } else { setPendingView('admin'); setShowLogin(true); } } function handleLoginSuccess() { if (pendingView) { setActiveView(pendingView); setPendingView(null); } } return (
Admin access required.