refactor(web): add knowledge/moreDropdown/tablePageLayout components

This commit is contained in:
zhaoying
2026-04-22 11:33:37 +08:00
parent a106f4e3cd
commit 5304117ae2
10 changed files with 781 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
import { App } from 'antd';
import { useTranslation } from 'react-i18next';
interface DeleteConfirmOptions {
name: string;
onOk: () => Promise<unknown> | void;
}
/**
* Hook for standardized delete confirmation dialog.
* Extracts the repeated modal.confirm pattern used across all management views.
*/
const useDeleteConfirm = () => {
const { t } = useTranslation();
const { modal, message } = App.useApp();
const confirm = ({ name, onOk }: DeleteConfirmOptions) => {
modal.confirm({
title: t('common.confirmDeleteDesc', { name }),
okText: t('common.delete'),
cancelText: t('common.cancel'),
okType: 'danger',
onOk: async () => {
await onOk();
message.success(t('common.deleteSuccess'));
},
});
};
return confirm;
};
export default useDeleteConfirm;