@@ -242,10 +242,16 @@ export function RealtimeStreamViewer({
242242 </ Paragraph >
243243 < div className = "flex items-center gap-3" >
244244 < TooltipProvider >
245- < Tooltip disableHoverableContent >
245+ < Tooltip open = { chunks . length === 0 ? false : undefined } disableHoverableContent >
246246 < TooltipTrigger
247+ disabled = { chunks . length === 0 }
247248 onClick = { ( ) => setViewMode ( viewMode === "list" ? "compact" : "list" ) }
248- className = "text-text-dimmed transition-colors focus-custom hover:cursor-pointer hover:text-text-bright"
249+ className = { cn (
250+ "text-text-dimmed transition-colors focus-custom" ,
251+ chunks . length === 0
252+ ? "cursor-not-allowed opacity-50"
253+ : "hover:cursor-pointer hover:text-text-bright"
254+ ) }
249255 >
250256 { viewMode === "list" ? (
251257 < SnakedArrowIcon className = "size-4" />
@@ -258,55 +264,65 @@ export function RealtimeStreamViewer({
258264 </ TooltipContent >
259265 </ Tooltip >
260266 </ TooltipProvider >
261- { chunks . length > 0 && (
262- < TooltipProvider >
263- < Tooltip open = { copied || mouseOver } disableHoverableContent >
264- < TooltipTrigger
265- onClick = { onCopied }
266- onMouseEnter = { ( ) => setMouseOver ( true ) }
267- onMouseLeave = { ( ) => setMouseOver ( false ) }
268- className = { cn (
269- "transition-colors duration-100 focus-custom hover:cursor-pointer" ,
270- copied ? "text-success" : "text-text-dimmed hover:text-text-bright"
271- ) }
272- >
273- { copied ? (
274- < ClipboardCheck className = "size-4" />
275- ) : (
276- < Clipboard className = "size-4" />
277- ) }
278- </ TooltipTrigger >
279- < TooltipContent side = "left" className = "text-xs" >
280- { copied ? "Copied" : "Copy" }
281- </ TooltipContent >
282- </ Tooltip >
283- </ TooltipProvider >
284- ) }
285- { chunks . length > 0 && (
286- < TooltipProvider >
287- < Tooltip disableHoverableContent >
288- < TooltipTrigger
289- onClick = { ( ) => {
290- if ( isAtBottom ) {
291- scrollRef . current ?. scrollTo ( { top : 0 , behavior : "smooth" } ) ;
292- } else {
293- bottomRef . current ?. scrollIntoView ( { behavior : "smooth" , block : "end" } ) ;
294- }
295- } }
296- className = "text-text-dimmed transition-colors focus-custom hover:cursor-pointer hover:text-text-bright"
297- >
298- { isAtBottom ? (
299- < MoveToTopIcon className = "size-4" />
300- ) : (
301- < MoveToBottomIcon className = "size-4" />
302- ) }
303- </ TooltipTrigger >
304- < TooltipContent side = "left" className = "text-xs" >
305- { isAtBottom ? "Scroll to top" : "Scroll to bottom" }
306- </ TooltipContent >
307- </ Tooltip >
308- </ TooltipProvider >
309- ) }
267+ < TooltipProvider >
268+ < Tooltip
269+ open = { chunks . length === 0 ? false : copied || mouseOver || undefined }
270+ disableHoverableContent
271+ >
272+ < TooltipTrigger
273+ disabled = { chunks . length === 0 }
274+ onClick = { onCopied }
275+ onMouseEnter = { ( ) => setMouseOver ( true ) }
276+ onMouseLeave = { ( ) => setMouseOver ( false ) }
277+ className = { cn (
278+ "transition-colors duration-100 focus-custom" ,
279+ chunks . length === 0
280+ ? "cursor-not-allowed opacity-50"
281+ : copied
282+ ? "text-success hover:cursor-pointer"
283+ : "text-text-dimmed hover:cursor-pointer hover:text-text-bright"
284+ ) }
285+ >
286+ { copied ? (
287+ < ClipboardCheck className = "size-4" />
288+ ) : (
289+ < Clipboard className = "size-4" />
290+ ) }
291+ </ TooltipTrigger >
292+ < TooltipContent side = "left" className = "text-xs" >
293+ { copied ? "Copied" : "Copy" }
294+ </ TooltipContent >
295+ </ Tooltip >
296+ </ TooltipProvider >
297+ < TooltipProvider >
298+ < Tooltip open = { chunks . length === 0 ? false : undefined } disableHoverableContent >
299+ < TooltipTrigger
300+ disabled = { chunks . length === 0 }
301+ onClick = { ( ) => {
302+ if ( isAtBottom ) {
303+ scrollRef . current ?. scrollTo ( { top : 0 , behavior : "smooth" } ) ;
304+ } else {
305+ bottomRef . current ?. scrollIntoView ( { behavior : "smooth" , block : "end" } ) ;
306+ }
307+ } }
308+ className = { cn (
309+ "text-text-dimmed transition-colors focus-custom" ,
310+ chunks . length === 0
311+ ? "cursor-not-allowed opacity-50"
312+ : "hover:cursor-pointer hover:text-text-bright"
313+ ) }
314+ >
315+ { isAtBottom ? (
316+ < MoveToTopIcon className = "size-4" />
317+ ) : (
318+ < MoveToBottomIcon className = "size-4" />
319+ ) }
320+ </ TooltipTrigger >
321+ < TooltipContent side = "left" className = "text-xs" >
322+ { isAtBottom ? "Scroll to top" : "Scroll to bottom" }
323+ </ TooltipContent >
324+ </ Tooltip >
325+ </ TooltipProvider >
310326 </ div >
311327 </ div >
312328 </ div >
0 commit comments