Add delete status confirmation modal with localization support
- Implemented a confirmation modal for deleting statuses in the Kanban board. - Integrated localized messages for delete status prompts in multiple languages, enhancing user experience. - Removed the previous portal-based confirmation approach in favor of Ant Design's Modal component for better consistency and usability.
This commit is contained in:
@@ -15,6 +15,9 @@
|
|||||||
"deleteTaskConfirm": "Fshi",
|
"deleteTaskConfirm": "Fshi",
|
||||||
"deleteTaskCancel": "Anulo",
|
"deleteTaskCancel": "Anulo",
|
||||||
|
|
||||||
|
"deleteStatusTitle": "Fshi Statusin",
|
||||||
|
"deleteStatusContent": "Jeni i sigurt që doni të fshini këtë status? Kjo veprim nuk mund të zhbëhet.",
|
||||||
|
|
||||||
"dueDate": "Data e përfundimit",
|
"dueDate": "Data e përfundimit",
|
||||||
"cancel": "Anulo",
|
"cancel": "Anulo",
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
"deleteTaskConfirm": "Löschen",
|
"deleteTaskConfirm": "Löschen",
|
||||||
"deleteTaskCancel": "Abbrechen",
|
"deleteTaskCancel": "Abbrechen",
|
||||||
|
|
||||||
|
"deleteStatusTitle": "Status löschen",
|
||||||
|
"deleteStatusContent": "Sind Sie sicher, dass Sie diesen Status löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
|
||||||
|
|
||||||
"dueDate": "Fälligkeitsdatum",
|
"dueDate": "Fälligkeitsdatum",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
"deleteTaskConfirm": "Delete",
|
"deleteTaskConfirm": "Delete",
|
||||||
"deleteTaskCancel": "Cancel",
|
"deleteTaskCancel": "Cancel",
|
||||||
|
|
||||||
|
"deleteStatusTitle": "Delete Status",
|
||||||
|
"deleteStatusContent": "Are you sure you want to delete this status? This action cannot be undone.",
|
||||||
|
|
||||||
"dueDate": "Due date",
|
"dueDate": "Due date",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
"deleteTaskConfirm": "Eliminar",
|
"deleteTaskConfirm": "Eliminar",
|
||||||
"deleteTaskCancel": "Cancelar",
|
"deleteTaskCancel": "Cancelar",
|
||||||
|
|
||||||
|
"deleteStatusTitle": "Eliminar estado",
|
||||||
|
"deleteStatusContent": "¿Estás seguro de que deseas eliminar este estado? Esta acción no se puede deshacer.",
|
||||||
|
|
||||||
"dueDate": "Fecha de vencimiento",
|
"dueDate": "Fecha de vencimiento",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
"deleteTaskConfirm": "Excluir",
|
"deleteTaskConfirm": "Excluir",
|
||||||
"deleteTaskCancel": "Cancelar",
|
"deleteTaskCancel": "Cancelar",
|
||||||
|
|
||||||
|
"deleteStatusTitle": "Excluir Status",
|
||||||
|
"deleteStatusContent": "Tem certeza de que deseja excluir este status? Esta ação não pode ser desfeita.",
|
||||||
|
|
||||||
"dueDate": "Data de vencimento",
|
"dueDate": "Data de vencimento",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
|
|
||||||
|
|||||||
@@ -19,5 +19,7 @@
|
|||||||
"deleteTaskTitle": "删除任务",
|
"deleteTaskTitle": "删除任务",
|
||||||
"deleteTaskContent": "您确定要删除此任务吗?此操作无法撤销。",
|
"deleteTaskContent": "您确定要删除此任务吗?此操作无法撤销。",
|
||||||
"deleteTaskConfirm": "删除",
|
"deleteTaskConfirm": "删除",
|
||||||
"deleteTaskCancel": "取消"
|
"deleteTaskCancel": "取消",
|
||||||
|
"deleteStatusTitle": "删除状态",
|
||||||
|
"deleteStatusContent": "您确定要删除此状态吗?此操作无法撤销。"
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
IGroupBy,
|
IGroupBy,
|
||||||
} from '@/features/enhanced-kanban/enhanced-kanban.slice';
|
} from '@/features/enhanced-kanban/enhanced-kanban.slice';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
|
||||||
// Simple Portal component
|
// Simple Portal component
|
||||||
const Portal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
const Portal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||||
@@ -218,7 +219,30 @@ const KanbanGroup: React.FC<KanbanGroupProps> = memo(({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
setShowDeleteConfirm(true);
|
if (groupBy === IGroupBy.STATUS) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('deleteStatusTitle'),
|
||||||
|
content: t('deleteStatusContent'),
|
||||||
|
okText: t('deleteTaskConfirm'),
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: t('deleteTaskCancel'),
|
||||||
|
centered: true,
|
||||||
|
onOk: async () => {
|
||||||
|
await handleDeleteSection();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('deleteConfirmationTitle'),
|
||||||
|
okText: t('deleteTaskConfirm'),
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: t('deleteTaskCancel'),
|
||||||
|
centered: true,
|
||||||
|
onOk: async () => {
|
||||||
|
await handleDeleteSection();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
setShowDropdown(false);
|
setShowDropdown(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -419,56 +443,7 @@ const KanbanGroup: React.FC<KanbanGroupProps> = memo(({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Simple Delete Confirmation */}
|
{/* Simple Delete Confirmation */}
|
||||||
{showDeleteConfirm && (
|
{/* Portal-based confirmation removed, now handled by Modal.confirm */}
|
||||||
<Portal>
|
|
||||||
<div
|
|
||||||
className="fixed inset-0 bg-black bg-opacity-25 flex items-center justify-center z-[99999]"
|
|
||||||
onClick={() => setShowDeleteConfirm(false)}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 max-w-sm w-full mx-4"
|
|
||||||
onClick={e => e.stopPropagation()}
|
|
||||||
>
|
|
||||||
<div className="p-4">
|
|
||||||
<div className="flex items-center gap-3 mb-3">
|
|
||||||
<div className="flex-shrink-0">
|
|
||||||
<svg className="w-5 h-5 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 className={`text-base font-medium ${themeMode === 'dark' ? 'text-white' : 'text-gray-900'}`}>
|
|
||||||
{t('deleteConfirmationTitle')}
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-end gap-2">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`px-3 py-1.5 text-sm font-medium rounded border transition-colors ${themeMode === 'dark'
|
|
||||||
? 'border-gray-600 text-gray-300 hover:bg-gray-600'
|
|
||||||
: 'border-gray-300 text-gray-700 hover:bg-gray-50'
|
|
||||||
}`}
|
|
||||||
onClick={() => setShowDeleteConfirm(false)}
|
|
||||||
>
|
|
||||||
{t('deleteConfirmationCancel')}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="px-3 py-1.5 text-sm font-medium text-white bg-red-600 border border-transparent rounded hover:bg-red-700 transition-colors"
|
|
||||||
onClick={() => {
|
|
||||||
handleDeleteSection();
|
|
||||||
setShowDeleteConfirm(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t('deleteConfirmationOk')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Portal>
|
|
||||||
)}
|
|
||||||
<div className="enhanced-kanban-group-tasks">
|
<div className="enhanced-kanban-group-tasks">
|
||||||
{/* Create card at top */}
|
{/* Create card at top */}
|
||||||
{showNewCardTop && (
|
{showNewCardTop && (
|
||||||
|
|||||||
Reference in New Issue
Block a user