2024-12-31 19:17:09 +08:00
|
|
|
import {
|
|
|
|
Dialog,
|
|
|
|
DialogContent,
|
|
|
|
DialogFooter,
|
|
|
|
DialogHeader,
|
|
|
|
DialogTitle,
|
|
|
|
} from '@/components/ui/dialog';
|
2025-01-20 16:49:45 +08:00
|
|
|
import { LoadingButton } from '@/components/ui/loading-button';
|
|
|
|
import { IModalProps } from '@/interfaces/common';
|
|
|
|
import { TagRenameId } from '@/pages/add-knowledge/constant';
|
2025-04-27 16:12:10 +08:00
|
|
|
import { ReactNode } from 'react';
|
2025-01-20 16:49:45 +08:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { RenameForm } from './rename-form';
|
|
|
|
|
|
|
|
export function RenameDialog({
|
|
|
|
hideModal,
|
|
|
|
initialName,
|
|
|
|
onOk,
|
|
|
|
loading,
|
2025-04-27 16:12:10 +08:00
|
|
|
title,
|
|
|
|
}: IModalProps<any> & { initialName?: string; title?: ReactNode }) {
|
2025-01-20 16:49:45 +08:00
|
|
|
const { t } = useTranslation();
|
2024-12-31 19:17:09 +08:00
|
|
|
|
|
|
|
return (
|
2025-01-20 16:49:45 +08:00
|
|
|
<Dialog open onOpenChange={hideModal}>
|
2024-12-31 19:17:09 +08:00
|
|
|
<DialogContent className="sm:max-w-[425px]">
|
|
|
|
<DialogHeader>
|
2025-04-27 16:12:10 +08:00
|
|
|
<DialogTitle>{title || t('common.rename')}</DialogTitle>
|
2024-12-31 19:17:09 +08:00
|
|
|
</DialogHeader>
|
2025-01-20 16:49:45 +08:00
|
|
|
<RenameForm
|
|
|
|
initialName={initialName}
|
|
|
|
hideModal={hideModal}
|
|
|
|
onOk={onOk}
|
|
|
|
></RenameForm>
|
2024-12-31 19:17:09 +08:00
|
|
|
<DialogFooter>
|
2025-01-20 16:49:45 +08:00
|
|
|
<LoadingButton type="submit" form={TagRenameId} loading={loading}>
|
|
|
|
{t('common.save')}
|
|
|
|
</LoadingButton>
|
2024-12-31 19:17:09 +08:00
|
|
|
</DialogFooter>
|
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
|
|
|
);
|
|
|
|
}
|