import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { AlertDialogOverlay } from '@radix-ui/react-alert-dialog'; import { DialogProps } from '@radix-ui/react-dialog'; import { X } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { RAGFlowAvatar } from './ragflow-avatar'; import { Separator } from './ui/separator'; interface IProps { title?: string; onOk?: (...args: any[]) => any; onCancel?: (...args: any[]) => any; hidden?: boolean; content?: { title?: string; node?: React.ReactNode; }; okButtonText?: string; cancelButtonText?: string; } export function ConfirmDeleteDialog({ children, title, onOk, onCancel, hidden = false, onOpenChange, open, defaultOpen, content, okButtonText, cancelButtonText, }: IProps & DialogProps) { const { t } = useTranslation(); if (hidden) { return children || <>; } return ( {children && {children}} { e.stopPropagation(); }} > e.preventDefault()} onClick={(e) => e.stopPropagation()} className="bg-bg-base " > {title ?? t('common.deleteModalTitle')} {content && ( <>
{content.title || t('common.deleteModalTitle')}
{content.node}
)}
{okButtonText || t('common.cancel')} {cancelButtonText || t('common.delete')}
); } export const ConfirmDeleteDialogNode = ({ avatar, name, warnText, children, }: { avatar?: { avatar?: string; name?: string; isPerson?: boolean }; name?: string; warnText?: string; children?: React.ReactNode; }) => { return (
{avatar && ( )} {name &&
{name}
}
{warnText &&
{warnText}
} {children}
); };