import React from 'react'; import { cn } from '../lib/utils'; /** * The header "N/M answered" chip for documents with `:::question` blocks * (the approved Card mock): a progress ring and the count. It is a button: * a click jumps to the next open question. With no open question left it * still reads the progress but has nothing to jump to. */ export interface QuestionProgressChipProps { /** Answered or settled questions. */ done: number; total: number; /** Whether a question is still open (not answered, settled or skipped). */ hasOpen: boolean; onJump: () => void; className?: string; } const Ring: React.FC<{ done: number; total: number }> = ({ done, total }) => { const r = 6; const c = 2 * Math.PI * r; const f = total > 0 ? done / total : 0; const complete = total > 0 && done === total; return ( ); }; export const QuestionProgressChip: React.FC = ({ done, total, hasOpen, onJump, className }) => { if (total <= 0) return null; const label = `${done} of ${total} question${total === 1 ? '' : 's'} answered.${hasOpen ? ' Go to next unanswered.' : ''}`; return ( ); };