@@ -11,6 +11,8 @@ interface Props {
1111 comments : Comment [ ]
1212 onFeedback ?: ( commentId : string , action : 'accept' | 'reject' ) => void
1313 onLifecycleChange ?: ( commentId : string , status : 'open' | 'resolved' | 'dismissed' ) => void
14+ activeCommentId ?: string | null
15+ onActivateComment ?: ( commentId : string ) => void
1416}
1517
1618const statusIcon = {
@@ -27,7 +29,7 @@ const statusColor = {
2729 modified : 'text-text-secondary' ,
2830}
2931
30- export function DiffViewer ( { files, comments, onFeedback, onLifecycleChange } : Props ) {
32+ export function DiffViewer ( { files, comments, onFeedback, onLifecycleChange, activeCommentId = null , onActivateComment } : Props ) {
3133 const [ collapsedFiles , setCollapsedFiles ] = useState < Set < string > > ( new Set ( ) )
3234
3335 const commentsByFile = useMemo ( ( ) => {
@@ -108,6 +110,8 @@ export function DiffViewer({ files, comments, onFeedback, onLifecycleChange }: P
108110 commentsByLine = { commentsByFile . get ( file . path ) }
109111 onFeedback = { onFeedback }
110112 onLifecycleChange = { onLifecycleChange }
113+ activeCommentId = { activeCommentId }
114+ onActivateComment = { onActivateComment }
111115 />
112116 ) ) }
113117 { file . hunks . length === 0 && (
@@ -124,12 +128,14 @@ export function DiffViewer({ files, comments, onFeedback, onLifecycleChange }: P
124128 )
125129}
126130
127- export function HunkView ( { hunk, filePath, commentsByLine, onFeedback, onLifecycleChange } : {
131+ export function HunkView ( { hunk, filePath, commentsByLine, onFeedback, onLifecycleChange, activeCommentId , onActivateComment } : {
128132 hunk : DiffHunk
129133 filePath : string
130134 commentsByLine ?: Map < number , Comment [ ] >
131135 onFeedback ?: ( commentId : string , action : 'accept' | 'reject' ) => void
132136 onLifecycleChange ?: ( commentId : string , status : 'open' | 'resolved' | 'dismissed' ) => void
137+ activeCommentId ?: string | null
138+ onActivateComment ?: ( commentId : string ) => void
133139} ) {
134140 return (
135141 < div >
@@ -153,6 +159,8 @@ export function HunkView({ hunk, filePath, commentsByLine, onFeedback, onLifecyc
153159 filePath = { filePath }
154160 onFeedback = { onFeedback }
155161 onLifecycleChange = { onLifecycleChange }
162+ activeCommentId = { activeCommentId }
163+ onActivateComment = { onActivateComment }
156164 />
157165 )
158166 } ) }
@@ -162,12 +170,14 @@ export function HunkView({ hunk, filePath, commentsByLine, onFeedback, onLifecyc
162170 )
163171}
164172
165- export function LineRow ( { line, comments, filePath, onFeedback, onLifecycleChange } : {
173+ export function LineRow ( { line, comments, filePath, onFeedback, onLifecycleChange, activeCommentId , onActivateComment } : {
166174 line : DiffLine
167175 comments ?: Comment [ ]
168176 filePath : string
169177 onFeedback ?: ( commentId : string , action : 'accept' | 'reject' ) => void
170178 onLifecycleChange ?: ( commentId : string , status : 'open' | 'resolved' | 'dismissed' ) => void
179+ activeCommentId ?: string | null
180+ onActivateComment ?: ( commentId : string ) => void
171181} ) {
172182 const bgClass =
173183 line . type === 'add' ? 'bg-diff-add-bg' :
@@ -218,6 +228,8 @@ export function LineRow({ line, comments, filePath, onFeedback, onLifecycleChang
218228 variant = "inline"
219229 onFeedback = { onFeedback ? ( action ) => onFeedback ( c . id , action ) : undefined }
220230 onLifecycleChange = { onLifecycleChange ? ( status ) => onLifecycleChange ( c . id , status ) : undefined }
231+ isActive = { activeCommentId === c . id }
232+ onActivate = { onActivateComment ? ( ) => onActivateComment ( c . id ) : undefined }
221233 />
222234 ) ) }
223235 </ td >
0 commit comments