11import { User } from "lucide-react" ;
2- import { useEffect , useRef , useState } from "react" ;
32import ReactMarkdown from "react-markdown" ;
43import rehypeHighlight from "rehype-highlight" ;
54import remarkGfm from "remark-gfm" ;
65
76import { AgentIdenticon } from "./AgentIdenticon" ;
87import { formatRelative } from "./TaskDetailFields" ;
9- import { Button } from "./ui/button" ;
108
119interface ActivityLogProps {
1210 initialNotes : any [ ] ;
@@ -107,10 +105,6 @@ function hasBody(log: any): boolean {
107105}
108106
109107export function ActivityLog ( { initialNotes, sseNotes, reconnecting } : ActivityLogProps ) {
110- const containerRef = useRef < HTMLDivElement > ( null ) ;
111- const [ autoScroll , setAutoScroll ] = useState ( true ) ;
112- const [ newCount , setNewCount ] = useState ( 0 ) ;
113-
114108 const displayed = ( ( ) => {
115109 const seen = new Set < string > ( ) ;
116110 const merged : any [ ] = [ ] ;
@@ -123,28 +117,6 @@ export function ActivityLog({ initialNotes, sseNotes, reconnecting }: ActivityLo
123117 return merged . sort ( ( a , b ) => a . created_at . localeCompare ( b . created_at ) ) ;
124118 } ) ( ) ;
125119
126- useEffect ( ( ) => {
127- if ( autoScroll && containerRef . current ) {
128- containerRef . current . scrollTop = containerRef . current . scrollHeight ;
129- } else if ( ! autoScroll && sseNotes . length > 0 ) {
130- setNewCount ( ( c ) => c + 1 ) ;
131- }
132- } , [ autoScroll , sseNotes . length ] ) ;
133-
134- function handleScroll ( ) {
135- if ( ! containerRef . current ) return ;
136- const { scrollTop, scrollHeight, clientHeight } = containerRef . current ;
137- const atBottom = scrollHeight - scrollTop - clientHeight < 20 ;
138- setAutoScroll ( atBottom ) ;
139- if ( atBottom ) setNewCount ( 0 ) ;
140- }
141-
142- function scrollToLatest ( ) {
143- containerRef . current ?. scrollTo ( { top : containerRef . current . scrollHeight , behavior : "smooth" } ) ;
144- setNewCount ( 0 ) ;
145- setAutoScroll ( true ) ;
146- }
147-
148120 if ( displayed . length === 0 ) {
149121 return < p className = "text-sm text-content-tertiary" > No activity yet. Assign an agent to see notes.</ p > ;
150122 }
@@ -153,13 +125,7 @@ export function ActivityLog({ initialNotes, sseNotes, reconnecting }: ActivityLo
153125 < div className = "relative" >
154126 { reconnecting && < div className = "text-[10px] text-warning mb-1" > Reconnecting...</ div > }
155127
156- { newCount > 0 && ! autoScroll && (
157- < Button onClick = { scrollToLatest } size = "xs" className = "absolute bottom-2 left-1/2 -translate-x-1/2 z-10 text-[11px] font-mono" >
158- ↓ { newCount } new
159- </ Button >
160- ) }
161-
162- < div ref = { containerRef } onScroll = { handleScroll } className = "mt-2 max-h-96 overflow-y-auto pr-1" aria-live = "polite" >
128+ < div className = "mt-2 pr-1" aria-live = "polite" >
163129 < div className = "relative" >
164130 < div className = "absolute left-3.5 top-0 bottom-0 w-px bg-border" />
165131
0 commit comments