Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent focus on tool dialog contents #1333

Merged
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
4 changes: 0 additions & 4 deletions ui/admin/app/components/chat/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ export function PromptMessage({
name={prompt.name}
category={prompt.metadata.category}
icon={prompt.metadata.icon}
disableTooltip
className="h-5 w-5"
/>
{str}
Expand Down Expand Up @@ -221,7 +220,6 @@ export function PromptMessage({
icon={prompt.metadata.icon}
category={prompt.metadata.category}
name={prompt.name}
disableTooltip
/>

{getCtaText()}
Expand All @@ -237,7 +235,6 @@ export function PromptMessage({
icon={prompt.metadata?.icon}
category={prompt.metadata?.category}
name={prompt.name}
disableTooltip
/>
}
>
Expand Down Expand Up @@ -271,7 +268,6 @@ export function PromptMessage({
icon={prompt.metadata?.icon}
category={prompt.metadata?.category}
name={prompt.name}
disableTooltip
/>
}
>
Expand Down
25 changes: 2 additions & 23 deletions ui/admin/app/components/tools/ToolIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ import { WrenchIcon } from "lucide-react";

import { cn } from "~/lib/utils";

import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "~/components/ui/tooltip";

type ToolIconProps = {
name: string;
category?: string;
icon?: string;
className?: string;
disableTooltip?: boolean;
};

export function ToolIcon(props: ToolIconProps) {
const { name, category, icon, className, disableTooltip } = props;
const { name, icon, className } = props;

const content = icon ? (
return icon ? (
<img
alt={name}
src={icon}
Expand All @@ -31,18 +24,4 @@ export function ToolIcon(props: ToolIconProps) {
) : (
<WrenchIcon className={cn("mr-2 h-4 w-4", className)} />
);

if (disableTooltip) {
return content;
}

return (
<Tooltip>
<TooltipTrigger>{content}</TooltipTrigger>

<TooltipContent>
{[category, name].filter((x) => !!x).join(" - ")}
</TooltipContent>
</Tooltip>
);
}
1 change: 0 additions & 1 deletion ui/admin/app/components/tools/ToolItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export function ToolItem({
category={tool.metadata?.category}
name={tool.name}
className="mr-2 h-4 w-4"
disableTooltip
/>
{tool.name}
</span>
Expand Down
1 change: 0 additions & 1 deletion ui/admin/app/components/tools/ToolTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export function ToolTooltip({
category={tool.metadata?.category}
name={tool.name}
className="mr-4 h-10 w-10"
disableTooltip
/>
) : (
<WrenchIcon className="mr-2 h-4 w-4" />
Expand Down
1 change: 0 additions & 1 deletion ui/admin/app/components/tools/toolGrid/BundleToolList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function BundleToolList({
<Separator className="mb-4" />
<div className="flex items-center gap-4">
<ToolIcon
disableTooltip
className="h-6 w-6"
name={bundle?.name ?? ""}
icon={bundle?.metadata?.icon}
Expand Down
1 change: 0 additions & 1 deletion ui/admin/app/components/tools/toolGrid/ToolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export function ToolCard({
<CardContent className="flex flex-col items-center gap-2 text-center">
<ToolIcon
className="h-16 w-16"
disableTooltip
name={tool?.name ?? ""}
icon={tool?.metadata?.icon}
/>
Expand Down
17 changes: 11 additions & 6 deletions ui/admin/app/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ const DialogContent = React.forwardRef<
)}
{...dialogProps}
>
<DialogPrimitive.Close
className={cn(
"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
{ hidden: hideCloseButton }
)}
disabled={hideCloseButton}
>
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>

{children}
{!hideCloseButton && (
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
);
Expand Down