import React from 'react';
import { cn } from '../lib/utils';
import { questionProgress, type QuestionPanelRow } from '../utils/questionAnswers';
/**
* The annotations panel's Questions section (the approved Card mock): a
* header with the progress count, a thin progress bar, and one row per
* `:::question` block with its answer or "Not answered yet" and an
* Open / answered state. A row whose question is no longer in the document
* carries the Unanchored chip; its answer still exports.
*/
const CheckIcon = () => (
);
const StateTag: React.FC<{ row: QuestionPanelRow }> = ({ row }) => {
if (row.orphaned) {
return (
Unanchored
);
}
if (row.status === 'answered' || row.status === 'settled') {
return (
{row.status === 'settled' ? 'Settled' : 'Answered'}
);
}
if (row.status === 'skipped') {
return Skipped;
}
return (
Open
);
};
export interface QuestionsPanelSectionProps {
rows: readonly QuestionPanelRow[];
onSelect?: (row: QuestionPanelRow) => void;
/** Remove an orphaned answer (its card is gone, so the panel is the only
* place to drop it). Absent: no remove control. */
onRemoveOrphan?: (row: QuestionPanelRow) => void;
}
export const QuestionsPanelSection: React.FC = ({ rows, onSelect, onRemoveOrphan }) => {
const { done, total } = questionProgress(rows);
const complete = total > 0 && done === total;
return (