fix: Show individual discussion threads in review sidebar with navigation
Discussions section was showing only aggregate counts (total/resolved/unresolved) with no way to see or navigate to individual threads. Now lists each root comment with file:line location, body preview, resolved status, and reply count. Clicking a discussion scrolls to its file in the diff viewer.
This commit is contained in:
@@ -213,29 +213,66 @@ function FilesView({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Comment summary */}
|
{/* Discussions — individual threads */}
|
||||||
{comments.length > 0 && (
|
{comments.length > 0 && (
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
<h4 className="text-[10px] font-semibold text-muted-foreground uppercase tracking-wider">
|
<h4 className="text-[10px] font-semibold text-muted-foreground uppercase tracking-wider flex items-center justify-between">
|
||||||
Discussions
|
<span>Discussions</span>
|
||||||
</h4>
|
<span className="flex items-center gap-2 font-normal normal-case">
|
||||||
<div className="flex items-center gap-3 text-xs">
|
{unresolvedCount > 0 && (
|
||||||
<span className="flex items-center gap-1 text-muted-foreground">
|
<span className="flex items-center gap-0.5 text-status-warning-fg">
|
||||||
<MessageSquare className="h-3 w-3" />
|
<Circle className="h-2.5 w-2.5" />
|
||||||
{comments.length}
|
{unresolvedCount}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{resolvedCount > 0 && (
|
||||||
|
<span className="flex items-center gap-0.5 text-status-success-fg">
|
||||||
|
<CheckCircle2 className="h-2.5 w-2.5" />
|
||||||
|
{resolvedCount}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
{resolvedCount > 0 && (
|
</h4>
|
||||||
<span className="flex items-center gap-1 text-status-success-fg">
|
<div className="space-y-0.5">
|
||||||
<CheckCircle2 className="h-3 w-3" />
|
{comments
|
||||||
{resolvedCount}
|
.filter((c) => !c.parentCommentId)
|
||||||
</span>
|
.map((thread) => {
|
||||||
)}
|
const replyCount = comments.filter(
|
||||||
{unresolvedCount > 0 && (
|
(c) => c.parentCommentId === thread.id,
|
||||||
<span className="flex items-center gap-1 text-status-warning-fg">
|
).length;
|
||||||
<Circle className="h-3 w-3" />
|
return (
|
||||||
{unresolvedCount}
|
<button
|
||||||
</span>
|
key={thread.id}
|
||||||
)}
|
className={`
|
||||||
|
flex w-full flex-col gap-0.5 rounded px-2 py-1.5 text-left
|
||||||
|
transition-colors hover:bg-accent/50
|
||||||
|
${thread.resolved ? "opacity-50" : ""}
|
||||||
|
`}
|
||||||
|
onClick={() => onFileClick(thread.filePath)}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-1.5 w-full min-w-0">
|
||||||
|
{thread.resolved ? (
|
||||||
|
<CheckCircle2 className="h-3 w-3 text-status-success-fg shrink-0" />
|
||||||
|
) : (
|
||||||
|
<MessageSquare className="h-3 w-3 text-status-warning-fg shrink-0" />
|
||||||
|
)}
|
||||||
|
<span className="text-[10px] font-mono text-muted-foreground truncate">
|
||||||
|
{getFileName(thread.filePath)}:{thread.lineNumber}
|
||||||
|
</span>
|
||||||
|
{replyCount > 0 && (
|
||||||
|
<span className="text-[9px] text-muted-foreground/70 shrink-0 ml-auto">
|
||||||
|
{replyCount}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<span className="text-[11px] text-foreground/80 truncate pl-[18px]">
|
||||||
|
{thread.body.length > 60
|
||||||
|
? thread.body.slice(0, 57) + "..."
|
||||||
|
: thread.body}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user