type BarOption = { optionId: string; text: string; count: number; percent: number; isCorrect?: boolean; }; export function PresentStatsBars({ kind, options, answeredCount, percentAnswered, totalResponses, revealCorrect, }: { kind: string; options: BarOption[]; answeredCount?: number; percentAnswered?: number; totalResponses: number; revealCorrect?: boolean; }) { if (kind === "text") { return (

{answeredCount ?? 0}

of {totalResponses} responded ({percentAnswered ?? 0}%)

); } if (options.length === 0) { return

No options for this question.

; } return (
{options.map((opt) => { const highlighted = revealCorrect && opt.isCorrect === true; const barColor = highlighted ? "bg-emerald-500" : "bg-[#1e72ef]"; const borderColor = highlighted ? "border-emerald-400 ring-2 ring-emerald-200" : "border-[#e5e5ea]"; return (
{opt.text || "—"} {highlighted ? ( Correct answer ) : null}
{opt.percent}%
{opt.count} {opt.count === 1 ? "response" : "responses"}
0 ? 2 : 0, opt.percent))}%` }} />
); })}
); }