From e70cb84369a74f891f8a7ddee14349beb14bf47c Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Fri, 5 Sep 2025 13:31:36 +0800 Subject: [PATCH] chore: replace dialog --- .../components/ai-writer/confirm-discard.tsx | 2 +- .../chat-input/prompt-modal/index.tsx | 2 +- .../prompt-modal/prompt-database/index.tsx | 2 +- .../invalid-database-dialog.tsx | 2 +- src/components/chat/components/ui/dialog.tsx | 213 ------------------ 5 files changed, 4 insertions(+), 217 deletions(-) delete mode 100644 src/components/chat/components/ui/dialog.tsx diff --git a/src/components/chat/components/ai-writer/confirm-discard.tsx b/src/components/chat/components/ai-writer/confirm-discard.tsx index 6c909507..e88e6e53 100644 --- a/src/components/chat/components/ai-writer/confirm-discard.tsx +++ b/src/components/chat/components/ai-writer/confirm-discard.tsx @@ -5,7 +5,7 @@ import { DialogDescription, DialogFooter, DialogHeader, DialogTitle, -} from '@/components/chat/components/ui/dialog'; +} from '@/components/ui/dialog'; import { useTranslation } from '@/components/chat/i18n'; import { useWriterContext } from '@/components/chat/writer/context'; import React from 'react'; diff --git a/src/components/chat/components/chat-input/prompt-modal/index.tsx b/src/components/chat/components/chat-input/prompt-modal/index.tsx index ad438754..f6dba3f8 100644 --- a/src/components/chat/components/chat-input/prompt-modal/index.tsx +++ b/src/components/chat/components/chat-input/prompt-modal/index.tsx @@ -1,4 +1,4 @@ -import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/chat/components/ui/dialog'; +import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/ui/dialog'; import { useTranslation } from '@/components/chat/i18n'; import { usePromptModal } from '@/components/chat/provider/prompt-modal-provider'; import { motion } from 'framer-motion'; diff --git a/src/components/chat/components/chat-input/prompt-modal/prompt-database/index.tsx b/src/components/chat/components/chat-input/prompt-modal/prompt-database/index.tsx index afff3505..fa7011ed 100644 --- a/src/components/chat/components/chat-input/prompt-modal/prompt-database/index.tsx +++ b/src/components/chat/components/chat-input/prompt-modal/prompt-database/index.tsx @@ -1,5 +1,5 @@ import { Button } from '@/components/ui/button'; -import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/chat/components/ui/dialog'; +import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/ui/dialog'; import { DropdownMenu, DropdownMenuContent, diff --git a/src/components/chat/components/chat-input/prompt-modal/prompt-database/invalid-database-dialog.tsx b/src/components/chat/components/chat-input/prompt-modal/prompt-database/invalid-database-dialog.tsx index 58d8d5b6..90ab8bff 100644 --- a/src/components/chat/components/chat-input/prompt-modal/prompt-database/invalid-database-dialog.tsx +++ b/src/components/chat/components/chat-input/prompt-modal/prompt-database/invalid-database-dialog.tsx @@ -6,7 +6,7 @@ import { DialogFooter, DialogHeader, DialogTitle, -} from '@/components/chat/components/ui/dialog'; +} from '@/components/ui/dialog'; import { useTranslation } from '@/components/chat/i18n'; export function InvalidDatabaseDialog({ diff --git a/src/components/chat/components/ui/dialog.tsx b/src/components/chat/components/ui/dialog.tsx deleted file mode 100644 index 2422254c..00000000 --- a/src/components/chat/components/ui/dialog.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import * as DialogPrimitive from '@radix-ui/react-dialog'; -import { cva } from 'class-variance-authority'; -import * as React from 'react'; -import { forwardRef } from 'react'; - -import { ReactComponent as Close } from '@/components/chat/assets/icons/close.svg'; -import { buttonVariants } from '@/components/ui/button'; -import { cn } from '@/components/chat/lib/utils'; - -function Dialog({ - ...props -}: React.ComponentProps) { - return ; -} - -function DialogTrigger({ - ...props -}: React.ComponentProps) { - return ; -} - -function DialogPortal({ - ...props -}: React.ComponentProps) { - return ; -} - -function DialogClose({ - ...props -}: React.ComponentProps) { - return ; -} - -const DialogOverlay = forwardRef( - ( - { - className, - ...props - }: React.ComponentProps, - ref, - ) => { - return ( - - ); - }, -); - -const dialogVariants = cva( - cn( - // Base appearance - 'bg-background-primary rounded-500 shadow-dialog', - - // Positioning and sizing - 'fixed top-[50%] left-[50%] z-50', - 'translate-x-[-50%] translate-y-[-50%]', // Center perfectly - 'max-w-[calc(100%-2rem)] sm:max-w-lg', // Responsive width - 'max-h-[85vh]', - 'focus:outline-hidde focus-visible:outline-none', - - // Internal layout - 'grid px-5 py-4', - - // Animation settings - 'duration-200', - - // Animation states for opening/closing - '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', - ), - { - variants: { - size: { - xs: 'w-[300px]', - sm: 'w-[400px]', - md: 'w-[560px]', - }, - }, - defaultVariants: { - size: 'md', - }, - }, -); - -function DialogContent({ - className, - children, - size, - showCloseButton = true, - ...props -}: React.ComponentProps & { - size?: 'xs' | 'sm' | 'md'; - showCloseButton?: boolean; -}) { - return ( - - - - {children} - -
- -
-
-
-
- ); -} - -function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ); -} - -function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ); -} - -function DialogTitle({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function DialogDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -export { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogOverlay, - DialogPortal, - DialogTitle, - DialogTrigger, -};