diff --git a/src/browser/components/pr-overview.tsx b/src/browser/components/pr-overview.tsx index f39ae4f..32fc08a 100644 --- a/src/browser/components/pr-overview.tsx +++ b/src/browser/components/pr-overview.tsx @@ -975,6 +975,18 @@ export const PROverview = memo(function PROverview() { setTimeout(() => commentBoxEl?.querySelector("textarea")?.focus(), 100); }, []); + const handleQuoteReviewComment = useCallback((body: string) => { + const commentBoxEl = document.getElementById("conversation-comment-box"); + const quoted = + body + .split("\n") + .map((line) => `> ${line}`) + .join("\n") + "\n\n"; + setCommentText(quoted); + commentBoxEl?.scrollIntoView({ behavior: "smooth" }); + setTimeout(() => commentBoxEl?.querySelector("textarea")?.focus(), 100); + }, []); + const handleResolveThread = useCallback( async (threadId: string) => { try { @@ -1750,6 +1762,9 @@ export const PROverview = memo(function PROverview() { review={entry.data} parentReactions={seededReactions} setParentReactions={setReactions} + onQuote={ + canWrite ? handleQuoteReviewComment : undefined + } /> {/* Render associated threads under the review */} {entry.threads.map((thread) => { @@ -3027,12 +3042,14 @@ function ReviewBox({ review, parentReactions, setParentReactions, + onQuote, }: { review: Review; parentReactions: Record; setParentReactions: React.Dispatch< React.SetStateAction> >; + onQuote?: (body: string) => void; }) { const store = usePRReviewStore(); const github = useGitHub(); @@ -3215,14 +3232,26 @@ function ReviewBox({
{review.body}
- {reactions.length > 0 || canWrite ? ( -
+ {reactions.length > 0 || canWrite || onQuote ? ( +
+ {onQuote && ( +
+ +
+ )}
) : null}