3e237e177a
* feat: add code-walkthrough backend (MCP tool, service, persistence, WS events) * feat: render agent code walkthroughs as line-anchored cards + editor window * test: add code-walkthrough re-emit mock-agent scenario * fix: rework code-walkthrough UX (floating card, line reveal, minimize, clickable file) * fix: improve code walkthrough editor UX * fix: backfill walkthrough launcher after websocket connect * fix: improve walkthrough requests and editor anchors * fix: clear walkthrough highlights on close * feat: add walkthrough discard and prompt customization * fix: send walkthrough requests through saved prompt * fix: support postgres built-in prompt seeding * fix: address walkthrough review feedback * fix: address walkthrough review follow-ups * fix: harden walkthrough lifecycle races * fix: reuse walkthrough notification cleanup * fix: guard stale walkthrough file opens * fix: abort stale file opens before paint * fix: stabilize github settings e2e readiness * fix: use stable github settings e2e selector
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { memo } from "react";
|
|
import type { WalkthroughCommentContextItem } from "@/lib/types/context";
|
|
import { getFileName } from "@/lib/utils/file-path";
|
|
import { ContextChip } from "./context-chip";
|
|
|
|
function lineLabel(start: number, end: number) {
|
|
return start === end ? `${start}` : `${start}-${end}`;
|
|
}
|
|
|
|
export const WalkthroughCommentItem = memo(function WalkthroughCommentItem({
|
|
item,
|
|
}: {
|
|
item: WalkthroughCommentContextItem;
|
|
}) {
|
|
const preview = (
|
|
<div className="space-y-2">
|
|
{item.comments.map((comment) => (
|
|
<div key={comment.id} className="text-xs space-y-1">
|
|
<div className="font-medium text-muted-foreground truncate" title={comment.filePath}>
|
|
{getFileName(comment.filePath)}:{lineLabel(comment.startLine, comment.endLine)}
|
|
</div>
|
|
<div className="line-clamp-2 text-muted-foreground">{comment.stepText}</div>
|
|
<div className="break-words">{comment.text}</div>
|
|
<button
|
|
type="button"
|
|
className="text-muted-foreground hover:text-foreground cursor-pointer"
|
|
onClick={() => item.onRemoveComment(comment.id)}
|
|
>
|
|
Remove
|
|
</button>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<ContextChip
|
|
kind="walkthrough-comment"
|
|
label={item.label}
|
|
preview={preview}
|
|
onRemove={item.onRemove}
|
|
/>
|
|
);
|
|
});
|