"use client"; import { useState } from "react"; export default function ControlBar({ onEnrich, onApplyChanges, onDownload, enriched, loading, loadingMessage, headingFontSize, onFontSizeChange, classifications, }) { const [showPromptEditor, setShowPromptEditor] = useState(false); const [customPrompt, setCustomPrompt] = useState(""); const [model, setModel] = useState("llama3"); const headingCount = classifications.filter((c) => c.isHeading).length; const handleEnrich = () => { onEnrich(model, customPrompt || undefined); }; const handleApplyManualChanges = () => { const headingIndices = classifications .filter((c) => c.isHeading) .map((c) => c.index); onApplyChanges(headingIndices); }; return (
{/* Main controls row */}
{/* Enrich / Re-enrich button */} {/* Apply manual changes */} {enriched && ( )} {/* Download button */} {enriched && ( )}
{/* Heading count badge */} {enriched && ( {headingCount} heading{headingCount !== 1 ? "s" : ""} detected )} {/* Font size control */}
{/* Model selector */}
setModel(e.target.value)} className="text-xs px-2 py-1 rounded border outline-none w-28" style={{ background: "var(--bg-tertiary)", borderColor: "var(--border-color)", color: "var(--text-primary)", }} placeholder="llama3" />
{/* Custom prompt toggle */}
{/* Custom prompt editor (collapsible) */} {showPromptEditor && (