import type React from "react"; import type { ReasoningEffort } from "../types"; interface Props { value: ReasoningEffort; options: { value: ReasoningEffort; label: string }[]; disabled?: boolean; disabledHint?: string; compact?: boolean; header?: boolean; vertical?: boolean; readOnly?: boolean; onChange: (v: ReasoningEffort) => void; } export function ReasoningEffortControl({ value, options, disabled = false, disabledHint, compact = false, header = false, vertical = false, readOnly = false, onChange, }: Props) { const labelStyle: React.CSSProperties = { fontSize: header ? 12 : compact ? 9 : 10, color: disabled ? "#5a6478" : "var(--text-dim)", flexShrink: 0, userSelect: "none", ...(vertical ? { width: 52 } : {}), }; const btnPad = header ? "6px 14px" : compact ? "3px 7px" : "4px 9px"; const btnFont = header ? 12 : compact ? 9 : 10; const displayOptions = disabled ? [{ value: "none" as ReasoningEffort, label: "n/a" }] : options; const activeLabel = displayOptions.find((o) => o.value === (disabled ? "none" : value))?.label ?? value; if (readOnly) { return (
Reasoning {activeLabel}
); } return (
Reasoning
{(disabled ? [{ value: "none" as ReasoningEffort, label: "n/a" }] : options).map(({ value: v, label }, i, arr) => { const effort = disabled ? "none" : v; const active = !disabled && value === effort; return ( ); })}
); }