Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/browser/components/tools/shared/ToolResultImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ export const ToolResultImages: React.FC<ToolResultImagesProps> = ({ result }) =>
{/* Lightbox modal for full-size image viewing */}
<Dialog open={selectedImage !== null} onOpenChange={() => setSelectedImage(null)}>
<DialogContent
onKeyDown={(e) => {
// Prevent Escape from propagating to global handlers (stream interrupt)
if (e.key === "Escape") {
e.stopPropagation();
}
}}
maxWidth="90vw"
maxHeight="90vh"
className="flex items-center justify-center bg-black/90 p-2"
Expand Down
69 changes: 45 additions & 24 deletions src/browser/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,51 @@ const DialogContent = React.forwardRef<
/** Maximum height of the dialog */
maxHeight?: string;
}
>(({ className, children, showCloseButton = true, maxWidth, maxHeight, style, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"bg-dark border-border fixed top-[50%] left-[50%] z-[1500] grid w-[90%] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
!maxWidth && "max-w-lg",
maxHeight && "overflow-y-auto",
className
)}
style={{ ...(maxWidth && { maxWidth }), ...(maxHeight && { maxHeight }), ...style }}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close className="text-muted hover:text-foreground absolute top-4 right-4 rounded-sm transition-colors focus:outline-none disabled:pointer-events-none">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
));
>(
(
{
className,
children,
showCloseButton = true,
maxWidth,
maxHeight,
style,
onKeyDown,
...props
},
ref
) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
onKeyDown={(e) => {
// Prevent Escape from propagating to global handlers (e.g., stream interrupt)
if (e.key === "Escape") {
e.stopPropagation();
}
onKeyDown?.(e);
}}
className={cn(
"bg-dark border-border fixed top-[50%] left-[50%] z-[1500] grid w-[90%] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
!maxWidth && "max-w-lg",
maxHeight && "overflow-y-auto",
className
)}
style={{ ...(maxWidth && { maxWidth }), ...(maxHeight && { maxHeight }), ...style }}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close className="text-muted hover:text-foreground absolute top-4 right-4 rounded-sm transition-colors focus:outline-none disabled:pointer-events-none">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
)
);
DialogContent.displayName = DialogPrimitive.Content.displayName;

const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
Expand Down
Loading