"use client"; // app/page.jsx — the Create flow as an Open Workspace split screen: // left pane = the current step's content, right pane = step tracker + actions. import { useEffect, useRef, useState } from "react"; import { useRouter } from "next/navigation"; import { IconArrowRight, IconArrowLeft, IconBulb, IconPencil, IconAlertTriangle, IconCircleCheck, IconCircle, IconX, } from "@tabler/icons-react"; import { ASSIGNMENT_TYPES, QUESTION_TYPES, GRADE_LEVELS, DIFFICULTIES } from "@/lib/schema"; const MAX_PASTE = 120000; const STEPS = [ { label: "Source", desc: "Add your reading material" }, { label: "Configure", desc: "Set type, grade, questions" }, { label: "Generate", desc: "Review the verified key" }, ]; const PHASE_ORDER = ["analyze", "generate", "verify", "save"]; function ProgressStep({ phase, label, currentPhase, hasVerify }) { if (phase === "verify" && !hasVerify) return null; const cur = PHASE_ORDER.indexOf(currentPhase); const me = PHASE_ORDER.indexOf(phase); const state = me < cur ? "done" : me === cur ? "active" : ""; return (
Questions are grounded strictly in this material — the AI is instructed not to add outside facts.
{ASSIGNMENT_TYPES.find((t) => t.id === config.assignmentType)?.label}{" "} · {config.gradeLevel} · {config.subject || "—"} · {config.questionCount} question{config.questionCount === 1 ? "" : "s"} · {config.difficulty} difficulty
Source: {sourceName || "Pasted text"} ({text.length.toLocaleString()} characters)
{genState && !genState.error && ( <>Local models can take a few minutes for large assignments. Leave this tab open.
> )} {genState?.error && (