@haiiro/docuflow 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { Button } from 'twenty-ui/primitives/input';
5
5
  import { Tag } from 'twenty-ui/primitives/data-display';
6
6
  import { useTheme } from 'twenty-ui/theme';
7
7
 
8
- import { createRecord, getErrorMessage, listRecords } from 'src/front/api';
8
+ import { createRecord, deleteRecord, getErrorMessage, listRecords } from 'src/front/api';
9
9
  import { formatDate, formatMemberName, isOverdue, TASK_STATUS_LABELS } from 'src/front/format';
10
10
  import { useAsync, useDebouncedValue } from 'src/front/hooks/use-async';
11
11
  import { useWorkspaceMembers } from 'src/front/hooks/use-workspace-members';
@@ -199,6 +199,17 @@ const DocflowTasks = () => {
199
199
  }),
200
200
  [taskFilter, searchQuery, currentMember?.id, sort, pages, now],
201
201
  );
202
+
203
+ const handleDeleteTask = async (taskId: string) => {
204
+ try {
205
+ await deleteRecord('tasks', taskId);
206
+ setPanel((current) => (current.kind === 'task' && current.taskId === taskId ? { kind: 'closed' } : current));
207
+ await enqueueSnackbar({ message: 'Задание удалено: оно в фильтре «Архив»', variant: 'success' });
208
+ await reload();
209
+ } catch (deleteError) {
210
+ await enqueueSnackbar({ message: getErrorMessage(deleteError, 'Не удалось удалить задание'), variant: 'error' });
211
+ }
212
+ };
202
213
  const tasks = data?.records ?? [];
203
214
 
204
215
  return (
@@ -273,12 +284,13 @@ const DocflowTasks = () => {
273
284
  {tasks.length > 0 && (
274
285
  <DataTable
275
286
  columns={[
276
- { key: 'title', label: 'Задание', width: '40%' },
277
- { key: 'assignee', label: 'Исполнитель', width: '24%' },
278
- { key: 'dueAt', label: 'Срок', width: '16%' },
287
+ { key: 'title', label: 'Задание', width: '34%' },
288
+ { key: 'assignee', label: 'Исполнитель', width: '20%' },
289
+ { key: 'dueAt', label: 'Срок', width: '14%' },
279
290
  { key: 'status', label: 'Статус' },
280
291
  ]}
281
292
  selectedRowId={panel.kind === 'task' ? panel.taskId : undefined}
293
+ onDeleteRow={taskFilter === 'archived' ? undefined : handleDeleteTask}
282
294
  onRowClick={(taskId) =>
283
295
  taskFilter === 'archived'
284
296
  ? void openArchivedTask(taskId)