import { useState } from 'react'; import { PatientHistoryPage } from './pages/PatientHistoryPage'; import HomePage from './pages/HomePage.tsx'; import { PatientRegistry } from './pages/PatientRegistry.tsx'; import { GuidedCapturePage } from './pages/GuidedCapturePage'; import { AcetowhiteExamPage } from './pages/AcetowhiteExamPage'; import { GreenFilterPage } from './pages/GreenFilterPage'; import { LugolExamPage } from './pages/LugolExamPage'; import { BiopsyMarking } from './pages/BiopsyMarking'; import { ReportPage } from './pages/ReportPage'; import { Sidebar } from './components/Sidebar'; import { Header } from './components/Header'; import { Footer } from './components/Footer'; import { ChatBot } from './components/ChatBot'; export function App() { const [currentPage, setCurrentPage] = useState<'home' | 'patientinfo' | 'patienthistory' | 'colposcopyimaging' | 'acetowhite' | 'greenfilter' | 'lugol' | 'guidedcapture' | 'biopsymarking' | 'capture' | 'annotation' | 'compare' | 'report' | 'settings'>('home'); const [currentPatientId, setCurrentPatientId] = useState(undefined); const [isNewPatientFlow, setIsNewPatientFlow] = useState(false); const [capturedImages, setCapturedImages] = useState([]); const [guidanceMode, setGuidanceMode] = useState<'capture' | 'annotation' | 'compare' | 'report'>('capture'); const goToPatientRegistry = () => { setCurrentPatientId(undefined); setIsNewPatientFlow(false); setCurrentPage('patientinfo'); }; const goToPatientHistory = (patientId?: string, isNewPatient: boolean = false) => { setCurrentPatientId(patientId); setIsNewPatientFlow(isNewPatient); setCurrentPage('patienthistory'); }; const goToHome = () => { setCurrentPatientId(undefined); setIsNewPatientFlow(false); setCurrentPage('home'); }; const goToColposcopyImaging = () => setCurrentPage('colposcopyimaging'); const goToAcetowhite = () => setCurrentPage('acetowhite'); const goToGreenFilter = () => setCurrentPage('greenfilter'); const goToLugol = () => setCurrentPage('lugol'); const goToGuidedCapture = () => { setCurrentPage('capture'); setGuidanceMode('capture'); }; const goToBiopsyMarking = () => setCurrentPage('biopsymarking'); const goToCapture = () => { setCurrentPage('capture'); setGuidanceMode('capture'); }; const goToAnnotation = () => { setCurrentPage('annotation'); setGuidanceMode('annotation'); }; const goToCompare = () => { setCurrentPage('compare'); setGuidanceMode('compare'); }; const goToReport = () => setCurrentPage('report'); const renderMain = () => { switch (currentPage) { case 'home': return ; case 'patientinfo': return goToPatientHistory(newPatientId, true)} onSelectExisting={(id: string) => goToPatientHistory(id)} onBackToHome={goToHome} onNext={goToGuidedCapture} />; case 'patienthistory': return ; case 'acetowhite': return ; case 'greenfilter': return ; case 'lugol': return ; case 'biopsymarking': return ; case 'capture': return ; case 'annotation': return ; case 'compare': return ; case 'report': return ; default: return
Page "{currentPage}" not implemented yet.
; } }; // Sidebar is shown on all pages except home const showSidebar = currentPage !== 'home'; const sidebarKey = currentPage === 'patienthistory' ? 'patientinfo' : (currentPage === 'guidedcapture' && guidanceMode === 'report') ? 'report' : ['capture', 'annotation', 'compare', 'guidedcapture'].includes(currentPage) ? guidanceMode : currentPage; return (
{showSidebar && { if (k === 'home') goToHome(); else if (k === 'patientinfo') goToPatientRegistry(); else if (k === 'capture') goToCapture(); else if (k === 'annotation') goToAnnotation(); else if (k === 'compare') goToCompare(); else if (k === 'report') goToReport(); else setCurrentPage(k as any); }} />}
{renderMain()}
); }