import { Button } from "@agent-native/toolkit/ui/button"; import { Spinner } from "@agent-native/toolkit/ui/spinner"; import { Textarea } from "@agent-native/toolkit/ui/textarea"; import { IconFocus2, IconMessageCircle, IconSend } from "@tabler/icons-react"; import type { ReactNode } from "react"; import type { ReviewResolutionTarget } from "../../review/types.js"; import { cn } from "../utils.js"; export interface ReviewCommentComposerProps { value: string; onChange: (value: string) => void; onSubmit: (resolutionTarget: ReviewResolutionTarget) => void; submittingTarget?: ReviewResolutionTarget | null; disabled?: boolean; showAgentAction?: boolean; agentAction?: ReactNode; placeholder?: string; commentLabel?: string; agentLabel?: string; contextLabel?: string; autoFocus?: boolean; submitOnEnter?: boolean; enterSubmitTarget?: ReviewResolutionTarget; onEscape?: () => void; className?: string; } export function ReviewCommentComposer({ value, onChange, onSubmit, submittingTarget = null, disabled = false, showAgentAction = false, agentAction, placeholder = "Add a comment...", commentLabel = "Comment", agentLabel = "Send to agent", contextLabel, autoFocus = false, submitOnEnter = false, enterSubmitTarget = "human", onEscape, className, }: ReviewCommentComposerProps) { const canSubmit = Boolean(value.trim()) && !disabled; const submit = (resolutionTarget: ReviewResolutionTarget) => { if (!canSubmit) return; onSubmit(resolutionTarget); }; return (
); }