import { useState, useRef } from 'react';
import DocumentProcessor from './DocumentProcessor';
function Homepage() {
const [hasFile, setHasFile] = useState(false);
const [fileName, setFileName] = useState('');
const [selectedFile, setSelectedFile] = useState(null);
const [academicBackground, setAcademicBackground] = useState('');
const [showAbout, setShowAbout] = useState(false);
const [showDocumentProcessor, setShowDocumentProcessor] = useState(false);
const fileRef = useRef(null);
function openFilePicker() {
if (fileRef.current) fileRef.current.click();
}
function handleFileChange(event) {
const file = event.target.files?.[0];
if (file) {
setSelectedFile(file);
setHasFile(true);
setFileName(file.name);
setTimeout(() => setShowAbout(true), 250);
}
}
function handleContinue() {
setShowDocumentProcessor(true);
}
// If we're showing the document processor, render it instead of the onboarding
if (showDocumentProcessor) {
return (
Guided comprehension for complex papers
Your mentor-like companion for mastering research papers. Upload a paper and we'll turn it into a guided learning path — with questions, feedback, and visible progress.
This helps us adjust our tutoring AI to adapt to what you already know.
Your PDF will be processed locally and securely.
{fileName}
{academicBackground && (Background: {academicBackground}
)}Here's how SocraticAI helps you learn deeply: