mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Fixed the issue where the chat page would jump after entering the homepage #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
AlertDialogTrigger,
|
|
} from '@/components/ui/alert-dialog';
|
|
import { PropsWithChildren } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
interface IProps {
|
|
title?: string;
|
|
onOk?: (...args: any[]) => any;
|
|
onCancel?: (...args: any[]) => any;
|
|
hidden?: boolean;
|
|
}
|
|
|
|
export function ConfirmDeleteDialog({
|
|
children,
|
|
title,
|
|
onOk,
|
|
onCancel,
|
|
hidden = false,
|
|
}: IProps & PropsWithChildren) {
|
|
const { t } = useTranslation();
|
|
|
|
if (hidden) {
|
|
return children;
|
|
}
|
|
|
|
return (
|
|
<AlertDialog>
|
|
<AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
|
|
<AlertDialogContent
|
|
onSelect={(e) => e.preventDefault()}
|
|
onClick={(e) => e.stopPropagation()}
|
|
>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>
|
|
{title ?? t('common.deleteModalTitle')}
|
|
</AlertDialogTitle>
|
|
{/* <AlertDialogDescription>
|
|
This action cannot be undone. This will permanently delete your
|
|
account and remove your data from our servers.
|
|
</AlertDialogDescription> */}
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel onClick={onCancel}>
|
|
{t('common.cancel')}
|
|
</AlertDialogCancel>
|
|
<AlertDialogAction
|
|
className="bg-text-delete-red text-text-title"
|
|
onClick={onOk}
|
|
>
|
|
{t('common.ok')}
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
);
|
|
}
|