Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(dialogs): dialog components with improved structure and styling (#7218)

marliessophie91730a2eafb1
diff --git a/web/src/components/ui/command.tsx b/web/src/components/ui/command.tsx
index d6b3646137..ba1c877889 100644
--- a/web/src/components/ui/command.tsx
+++ b/web/src/components/ui/command.tsx
@@ -1,12 +1,17 @@
"use client";
import * as React from "react";
-import { type DialogProps } from "@radix-ui/react-dialog";
+import { DialogTitle, type DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
import { cn } from "@/src/utils/tailwind";
-import { Dialog, DialogBody, DialogContent } from "@/src/components/ui/dialog";
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogHeader,
+} from "@/src/components/ui/dialog";
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
@@ -36,7 +41,10 @@ const CommandDialog = ({
className="overflow-hidden p-0 shadow-lg"
closeOnInteractionOutside
>
- <DialogBody>
+ <DialogHeader className="sr-only p-0">
+ <DialogTitle>Search</DialogTitle>
+ </DialogHeader>
+ <DialogBody className="p-0">
<Command
filter={filter}
className="pb-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12"
diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsx
index b27cce54e5..924496ed65 100644
--- a/web/src/components/ui/dialog.tsx
+++ b/web/src/components/ui/dialog.tsx
@@ -91,7 +91,7 @@ const DialogHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "sticky top-0 z-10 flex flex-shrink-0 flex-col space-y-1.5 bg-background p-6 pb-4 text-center sm:text-left",
+ "sticky top-0 z-10 flex flex-shrink-0 flex-col space-y-1.5 border-b bg-background p-6 pb-4 text-center sm:text-left",
className,
)}
{...props}
@@ -120,7 +120,7 @@ const DialogFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "dialog-footer sticky bottom-0 z-10 flex flex-shrink-0 flex-col-reverse bg-background p-6 px-6 sm:flex-row sm:justify-end sm:space-x-2",
+ "dialog-footer sticky bottom-0 z-10 flex flex-shrink-0 flex-col-reverse border-t bg-background p-6 px-6 sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
diff --git a/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx b/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
index 5a2202027e..de3e3972d1 100644
--- a/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
+++ b/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
@@ -57,7 +57,7 @@ export const DeleteAnnotationQueueButton = ({
}}
>
<DialogTrigger asChild>{button}</DialogTrigger>
- <DialogContent className="sm:max-w-xl">
+ <DialogContent className="overflow-hidden sm:max-w-xl">
<DialogHeader>
<DialogTitle className="mb-4">Please confirm</DialogTitle>
<DialogDescription className="text-md p-0">
diff --git a/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx b/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
index 933547dd21..0c6451b01f 100644
--- a/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
+++ b/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
@@ -160,7 +160,7 @@ export const CreateOrEditLLMSchemaDialog: React.FC<
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
- className="flex flex-1 flex-col"
+ className="grid max-h-full min-h-0 overflow-hidden"
>
<DialogBody>
<div className="flex-1 space-y-4 overflow-y-auto">
diff --git a/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx b/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
index fcaa79b09c..f1f19f06dc 100644
--- a/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
+++ b/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
@@ -165,7 +165,7 @@ export const CreateOrEditLLMToolDialog: React.FC<CreateOrEditLLMToolDialog> = (
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
- className="flex flex-1 flex-col"
+ className="grid max-h-full min-h-0 overflow-hidden"
>
<DialogBody>
<div className="flex-1 space-y-4 overflow-y-auto">
diff --git a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
index c040727eb8..4cf494f510 100644
--- a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
+++ b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
@@ -228,7 +228,7 @@ export function CreateLLMApiKeyForm({
return (
<Form {...form}>
<form
- className={cn("flex flex-col gap-6 overflow-auto pb-2 pl-1 pr-4")}
+ className={cn("flex flex-col gap-4 overflow-auto")}
onSubmit={form.handleSubmit(onSubmit)}
>
<DialogBody>