import { SendHorizontal, X } from "lucide-react"; import { CommentEditor } from "@/components/comment-editor"; import type { SingleFileAnnotation } from "@/components/pull-request-review/review-page-model"; import { ThreadCard } from "@/components/pull-request-review/review-thread-card"; import type { InlineCommentDraft } from "@/components/pull-request-review/use-inline-comment-drafts"; import { inlineDraftStorageKey } from "@/components/pull-request-review/use-inline-drafts"; import { Button } from "@/components/ui/button"; type InlineDiffAnnotationProps = { annotation: SingleFileAnnotation; allowNestedReplies: boolean; workspace: string; repo: string; pullRequestId: string; createCommentPending: boolean; canCommentInline: boolean; canResolveThread: boolean; resolveCommentPending: boolean; updateCommentPending: boolean; getInlineDraftContent: (draft: Pick) => string; setInlineDraftContent: (draft: Pick, content: string) => void; onSubmitInlineComment: () => void; onInlineDraftReady: (focus: () => void) => void; onCancelInlineDraft: (draft: Pick) => void; currentUserDisplayName?: string; onDeleteComment: (commentId: number, hasInlineContext: boolean) => void; onResolveThread: (commentId: number, resolve: boolean) => void; onReplyToThread: (commentId: number, content: string) => void; onEditComment: (commentId: number, content: string, hasInlineContext: boolean) => void; }; export function InlineDiffAnnotation({ annotation, allowNestedReplies, workspace, repo, pullRequestId, createCommentPending, canCommentInline, canResolveThread, resolveCommentPending, updateCommentPending, getInlineDraftContent, setInlineDraftContent, onSubmitInlineComment, onInlineDraftReady, onCancelInlineDraft, currentUserDisplayName, onDeleteComment, onResolveThread, onReplyToThread, onEditComment, }: InlineDiffAnnotationProps) { const metadata = annotation.metadata; if (!metadata) return null; return (
{metadata.kind === "draft" ? (
setInlineDraftContent(metadata.draft, nextValue)} onSubmit={onSubmitInlineComment} />
) : ( )}
); }