import type { FilterMode } from "../types"; interface QuestionNavProps { questionIdx: number; sampleIdx: number; maxQuestions: number; maxSamples: number; filter: FilterMode; onQuestionChange: (idx: number) => void; onSampleChange: (idx: number) => void; onFilterChange: (filter: FilterMode) => void; } const FILTERS: { value: FilterMode; label: string }[] = [ { value: "all", label: "All" }, { value: "improvements", label: "Improvements" }, { value: "regressions", label: "Regressions" }, { value: "both-correct", label: "Both Correct" }, { value: "both-wrong", label: "Both Wrong" }, ]; export default function QuestionNav({ questionIdx, sampleIdx, maxQuestions, maxSamples, filter, onQuestionChange, onSampleChange, onFilterChange, }: QuestionNavProps) { const prevQ = () => onQuestionChange(Math.max(0, questionIdx - 1)); const nextQ = () => onQuestionChange(Math.min(maxQuestions - 1, questionIdx + 1)); const prevS = () => onSampleChange(Math.max(0, sampleIdx - 1)); const nextS = () => onSampleChange(Math.min(maxSamples - 1, sampleIdx + 1)); return (
{/* Question navigation */}
Q { const v = parseInt(e.target.value); if (!isNaN(v) && v >= 0 && v < maxQuestions) onQuestionChange(v); }} className="w-16 px-1.5 py-1 text-xs text-center bg-gray-800 border border-gray-600 rounded text-gray-200 focus:border-blue-500 focus:outline-none" /> / {maxQuestions > 0 ? maxQuestions - 1 : 0}
{/* Sample navigation */} {maxSamples > 1 && (
Sample {sampleIdx + 1}/{maxSamples}
)} {/* Filter */}
{FILTERS.map((f) => ( ))}
{/* Keyboard hints */}
j/k question {" "} h/l sample
); }