diff --git a/src/components/Document/list.tsx b/src/components/Document/list.tsx index 285efd2..d960651 100644 --- a/src/components/Document/list.tsx +++ b/src/components/Document/list.tsx @@ -1,4 +1,4 @@ -import { openConfirmModal } from '@mantine/modals'; +import { modals } from '@mantine/modals'; import { useMeiliClient } from '@/src/hooks/useMeiliClient'; import { showTaskErrorNotification, showTaskSubmitNotification } from '@/src/utils/text'; import { toast } from '@/src/utils/toast'; @@ -62,24 +62,43 @@ export const DocumentList = ({ docs = [], showIndex = false, refetchDocs }: Prop const pk = doc.primaryKey; console.debug('onClickDocumentDel', 'pk', pk); if (pk) { - openConfirmModal({ + const modalId = 'deleteDocumentModal'; + modals.open({ + modalId, title: t('delete_document'), centered: true, children: ( -
- {t('delete.tip') + ' '} - - {/* @ts-ignore */} - document ({pk}: {doc.content[pk]}) in index {doc.indexId} - - ? -
++ {t('delete.tip') + ' '} + + {/* @ts-ignore */} + document ({pk}: {doc.content[pk]}) in index {doc.indexId} + + ? +
+{t('instance:dump.dialog.tip', { name: currentInstance.name })}
, - labels: { confirm: t('confirm'), cancel: t('cancel') }, - confirmProps: { color: 'orange' }, - onConfirm: () => { - client.createDump().then((value) => { - showTaskSubmitNotification(value); - }); - }, + children: ( +{t('instance:dump.dialog.tip', { name: currentInstance.name })}
+{t('setting.index.config.are_you_sure_you_want_to_remove_item', { item: array[index] })}
, - labels: { confirm: t('confirm'), cancel: t('cancel') }, - confirmProps: { color: 'red' }, - onConfirm: async () => { - const updated = _.without(array, array[index]); - setArray(updated); - onMutation(updated); - }, + children: ( +{t('setting.index.config.are_you_sure_you_want_to_remove_item', { item: array[index] })}
{' '} +{t('setting.index.config.are_you_sure_you_want_to_remove_item', { item: key })}
, - labels: { confirm: t('confirm'), cancel: t('cancel') }, - confirmProps: { color: 'red' }, - onConfirm: async () => { - const updated = _.omit(query.data, [key]); - mutation.mutate(updated); - }, + children: ( +{t('setting.index.config.are_you_sure_you_want_to_remove_item', { item: key })}
{' '} +- {t('instance.remove.tip')} ({ins.name})? -
++ {t('instance.remove.tip')} ({ins.name})? +
+{t('delete.tip')}
, - labels: { confirm: t('confirm'), cancel: t('cancel') }, - confirmProps: { color: 'red' }, - onConfirm: () => { - client.deleteKey(key.uid).finally(() => { - refreshKeys(); - }); - }, + children: ( +{t('delete.tip')}
+