@@ -226,7 +226,7 @@ export function ResearchCard(
226226 : undefined ;
227227 let actions = researchActions ( request , canEdit ) ;
228228 return (
229- < SidecarCard label = "Research" >
229+ < SidecarCard data-research-ready = { ready ? "" : undefined } label = "Research" >
230230 < div className = "plan-research-heading" >
231231 < strong > { ready ? ready . title : STAGES [ request . stage ] } </ strong >
232232 < span > { ready ? STAGES [ request . stage ] : request . question } </ span >
@@ -241,7 +241,7 @@ export function ResearchCard(
241241 </ >
242242 ) }
243243 { request . error && < p className = "plan-research-error" role = "status" > { request . error } </ p > }
244- { request . sources . length > 0 && (
244+ { ! ready && request . sources . length > 0 && (
245245 < ul aria-label = "Research sources" className = "plan-research-sources" >
246246 { request . sources . map ( source => (
247247 < li key = { source . url } >
@@ -251,52 +251,53 @@ export function ResearchCard(
251251 </ ul >
252252 ) }
253253 { actionError && < p className = "plan-research-error" role = "status" > { actionError } </ p > }
254- < div className = "plan-research-actions" >
255- { actions . cancel && onCancel && (
256- < button
257- aria-label = "Cancel research"
258- className = "btn btn-sm btn-secondary"
259- disabled = { busy || ! canEdit }
260- onClick = { onCancel }
261- type = "button"
262- >
263- Cancel
264- </ button >
265- ) }
266- { actions . retry && onRetry && (
267- < button
268- aria-label = "Retry research"
269- className = "btn btn-sm btn-secondary"
270- disabled = { busy || ! canEdit }
271- onClick = { onRetry }
272- type = "button"
273- >
274- Retry
275- </ button >
276- ) }
277- { actions . open && ready && onOpen && (
278- < button
279- className = "btn btn-sm btn-primary"
280- disabled = { busy }
281- onClick = { event => onOpen ( event . currentTarget ) }
282- ref = { openButtonRef }
283- type = "button"
284- >
285- Open { ready . title }
286- </ button >
287- ) }
288- { actions . remove && onRemove && (
289- < button
290- aria-label = "Remove research reference"
291- className = "btn btn-sm btn-ghost"
292- disabled = { busy || ! canEdit }
293- onClick = { onRemove }
294- type = "button"
295- >
296- Remove
297- </ button >
298- ) }
299- </ div >
254+ { ! ready && (
255+ < div className = "plan-research-actions" >
256+ { actions . cancel && onCancel && (
257+ < button
258+ aria-label = "Cancel research"
259+ className = "btn btn-sm btn-secondary"
260+ disabled = { busy || ! canEdit }
261+ onClick = { onCancel }
262+ type = "button"
263+ >
264+ Cancel
265+ </ button >
266+ ) }
267+ { actions . retry && onRetry && (
268+ < button
269+ aria-label = "Retry research"
270+ className = "btn btn-sm btn-secondary"
271+ disabled = { busy || ! canEdit }
272+ onClick = { onRetry }
273+ type = "button"
274+ >
275+ Retry
276+ </ button >
277+ ) }
278+ { actions . remove && onRemove && (
279+ < button
280+ aria-label = "Remove research reference"
281+ className = "btn btn-sm btn-ghost"
282+ disabled = { busy || ! canEdit }
283+ onClick = { onRemove }
284+ type = "button"
285+ >
286+ Remove
287+ </ button >
288+ ) }
289+ </ div >
290+ ) }
291+ { actions . open && ready && onOpen && (
292+ < button
293+ aria-label = { `Open ${ ready . title } ` }
294+ className = "plan-research-open"
295+ disabled = { busy }
296+ onClick = { event => onOpen ( event . currentTarget ) }
297+ ref = { openButtonRef }
298+ type = "button"
299+ />
300+ ) }
300301 </ SidecarCard >
301302 ) ;
302303}
0 commit comments