@tuturuuu/ui 0.17.0 → 0.19.0

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.
Files changed (643) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/biome.json +1 -1
  3. package/package.json +111 -152
  4. package/src/components/ui/calendar-app/calendar-client-page.tsx +30 -3
  5. package/src/components/ui/calendar-app/calendar-page-shell.tsx +60 -29
  6. package/src/components/ui/calendar-app/components/calendar-connections-manager-helpers.ts +70 -0
  7. package/src/components/ui/calendar-app/components/calendar-connections-settings-content.tsx +516 -578
  8. package/src/components/ui/calendar-app/components/calendar-connections-unified.tsx +1 -0
  9. package/src/components/ui/calendar-app/components/calendar-sync-settings-panel.tsx +155 -0
  10. package/src/components/ui/calendar-app/components/merge-provider-calendars.test.ts +46 -0
  11. package/src/components/ui/calendar-app/components/merge-provider-calendars.ts +81 -0
  12. package/src/components/ui/calendar-app/components/use-calendar-connections-manager.ts +22 -129
  13. package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +17 -3
  14. package/src/components/ui/chat/chat-agent-details-utils.tsx +2 -0
  15. package/src/components/ui/chat/chat-agent-details-zalo-personal-panel.tsx +17 -6
  16. package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +35 -0
  17. package/src/components/ui/custom/__tests__/workspace-select-helpers.test.ts +17 -0
  18. package/src/components/ui/custom/nav-link.test.tsx +1 -0
  19. package/src/components/ui/custom/nav-link.tsx +4 -1
  20. package/src/components/ui/custom/notification-popover-client.tsx +3 -3
  21. package/src/components/ui/custom/settings-dialog-shell.tsx +23 -14
  22. package/src/components/ui/custom/statistic-card.tsx +3 -5
  23. package/src/components/ui/custom/structure.test.tsx +4 -0
  24. package/src/components/ui/custom/user-filters.tsx +4 -7
  25. package/src/components/ui/custom/workspace-access/workspace-access-page-header.tsx +1 -1
  26. package/src/components/ui/custom/workspace-access/workspace-access-tabs-toolbar.tsx +1 -1
  27. package/src/components/ui/custom/workspace-select.tsx +38 -53
  28. package/src/components/ui/finance/analytics/category-spending-chart.test.tsx +3 -3
  29. package/src/components/ui/finance/budgets/budget-card.test.tsx +3 -3
  30. package/src/components/ui/finance/debts/debt-loan-card.test.tsx +3 -3
  31. package/src/components/ui/finance/debts/debt-loan-detail-cards.test.tsx +3 -3
  32. package/src/components/ui/finance/invoices/charts/invoice-totals-chart.test.tsx +3 -3
  33. package/src/components/ui/finance/invoices/columns.test.tsx +3 -3
  34. package/src/components/ui/finance/invoices/components/invoice-customer-select-card.tsx +1 -1
  35. package/src/components/ui/finance/shared/numbers-visibility-toggle.test.tsx +1 -1
  36. package/src/components/ui/finance/tags/tag-manager.test.tsx +2 -2
  37. package/src/components/ui/finance/transactions/categories/columns.test.tsx +5 -5
  38. package/src/components/ui/finance/transactions/columns.test.tsx +2 -2
  39. package/src/components/ui/finance/transactions/confidential-field.test.tsx +2 -2
  40. package/src/components/ui/finance/transactions/transaction-edit-dialog.test.tsx +2 -2
  41. package/src/components/ui/finance/transactions/transaction-statistics.test.tsx +3 -3
  42. package/src/components/ui/finance/wallets/form.test.tsx +3 -3
  43. package/src/components/ui/finance/wallets/wallets-data-table.test.tsx +10 -0
  44. package/src/components/ui/legacy/calendar/calendar-cell.tsx +1 -1
  45. package/src/components/ui/storefront/accent-button.tsx +4 -1
  46. package/src/components/ui/storefront/browse-panel.tsx +6 -1
  47. package/src/components/ui/storefront/cart-summary-parts.tsx +18 -4
  48. package/src/components/ui/storefront/cart-summary.tsx +22 -6
  49. package/src/components/ui/storefront/hero-panel.tsx +13 -17
  50. package/src/components/ui/storefront/index.ts +2 -0
  51. package/src/components/ui/storefront/listing-card.tsx +6 -4
  52. package/src/components/ui/storefront/product-detail.tsx +51 -21
  53. package/src/components/ui/storefront/product-dialog.tsx +8 -1
  54. package/src/components/ui/storefront/storefront-surface.test.tsx +79 -3
  55. package/src/components/ui/storefront/storefront-surface.tsx +151 -100
  56. package/src/components/ui/storefront/types.ts +3 -0
  57. package/src/components/ui/storefront/utils.ts +5 -1
  58. package/src/components/ui/tasks/progress/activity-heatmap.tsx +256 -0
  59. package/src/components/ui/tasks/progress/breakdown-bars.tsx +79 -0
  60. package/src/components/ui/tasks/progress/cumulative-progress-chart.tsx +185 -0
  61. package/src/components/ui/tasks/progress/daily-bar-chart.tsx +97 -0
  62. package/src/components/ui/tasks/progress/habit-gauge.tsx +92 -0
  63. package/src/components/ui/tasks/progress/mini-sparkline.tsx +56 -0
  64. package/src/components/ui/tasks/progress/weekday-distribution-chart.tsx +72 -0
  65. package/src/components/ui/text-editor/__tests__/task-mention-checkbox.test.ts +23 -6
  66. package/src/components/ui/text-editor/__tests__/upload-placeholder.test.ts +1 -10
  67. package/src/components/ui/text-editor/color-controls.tsx +1 -1
  68. package/src/components/ui/text-editor/editor.tsx +7 -1
  69. package/src/components/ui/text-editor/extensions.ts +4 -1
  70. package/src/components/ui/text-editor/mention-extension.tsx +33 -121
  71. package/src/globals.css +20 -0
  72. package/src/globals.test.ts +75 -0
  73. package/src/hooks/__tests__/use-calendar-sync.test.tsx +103 -1
  74. package/src/hooks/use-calendar-sync.tsx +51 -14
  75. package/src/lib/task-personal-external.ts +1 -1
  76. package/src/lib/workspace-actions.ts +15 -4
  77. package/src/components/ui/calendar-app/components/actions-dropdown.tsx +0 -269
  78. package/src/components/ui/calendar-app/components/auto-schedule-comprehensive-dialog.tsx +0 -220
  79. package/src/components/ui/calendar-app/components/calendar-header-actions.tsx +0 -67
  80. package/src/components/ui/calendar-app/components/experimental-feature-dialog.tsx +0 -56
  81. package/src/components/ui/calendar-app/components/habits-panel.tsx +0 -335
  82. package/src/components/ui/calendar-app/components/load-smart-scheduling-tasks.tsx +0 -143
  83. package/src/components/ui/calendar-app/components/priority-dropdown.tsx +0 -113
  84. package/src/components/ui/calendar-app/components/priority-view.tsx +0 -954
  85. package/src/components/ui/calendar-app/components/quick-task-dialog.tsx +0 -335
  86. package/src/components/ui/calendar-app/components/quick-task-timer.tsx +0 -112
  87. package/src/components/ui/calendar-app/components/scheduling-dialog.tsx +0 -664
  88. package/src/components/ui/calendar-app/components/sidebar/calendar-sidebar.tsx +0 -128
  89. package/src/components/ui/calendar-app/components/sidebar/index.tsx +0 -1
  90. package/src/components/ui/calendar-app/components/smart-schedule-button.tsx +0 -117
  91. package/src/components/ui/calendar-app/components/smart-schedule-preview-dialog.tsx +0 -845
  92. package/src/components/ui/calendar-app/components/smart-schedule-preview-panel.tsx +0 -941
  93. package/src/components/ui/calendar-app/components/task-fetcher.ts +0 -51
  94. package/src/components/ui/calendar-app/components/task-form.tsx +0 -132
  95. package/src/components/ui/calendar-app/components/task-list-form.tsx +0 -84
  96. package/src/components/ui/calendar-app/components/task-scheduler-panel.tsx +0 -494
  97. package/src/components/ui/calendar-app/components/tasks-sidebar-content.tsx +0 -232
  98. package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +0 -31
  99. package/src/components/ui/calendar-app/components/time-tracker/components/active-session-card.tsx +0 -113
  100. package/src/components/ui/calendar-app/components/time-tracker/components/index.ts +0 -3
  101. package/src/components/ui/calendar-app/components/time-tracker/components/session-card.tsx +0 -153
  102. package/src/components/ui/calendar-app/components/time-tracker/components/stats-cards.tsx +0 -58
  103. package/src/components/ui/calendar-app/components/time-tracker/dialogs/create-task-dialog.tsx +0 -190
  104. package/src/components/ui/calendar-app/components/time-tracker/dialogs/delete-session-dialog.tsx +0 -52
  105. package/src/components/ui/calendar-app/components/time-tracker/dialogs/edit-session-dialog.tsx +0 -173
  106. package/src/components/ui/calendar-app/components/time-tracker/dialogs/index.ts +0 -3
  107. package/src/components/ui/calendar-app/components/time-tracker/hooks/index.ts +0 -2
  108. package/src/components/ui/calendar-app/components/time-tracker/hooks/use-sessions.ts +0 -191
  109. package/src/components/ui/calendar-app/components/time-tracker/hooks/use-time-tracker.ts +0 -408
  110. package/src/components/ui/calendar-app/components/time-tracker/index.tsx +0 -907
  111. package/src/components/ui/calendar-app/components/time-tracker/tabs/history-tab.tsx +0 -28
  112. package/src/components/ui/calendar-app/components/time-tracker/tabs/index.ts +0 -2
  113. package/src/components/ui/calendar-app/components/time-tracker/tabs/recent-sessions-tab.tsx +0 -173
  114. package/src/components/ui/calendar-app/components/time-tracker/time-tracker-trigger.tsx +0 -50
  115. package/src/components/ui/calendar-app/components/time-tracker/utils/category-colors.ts +0 -38
  116. package/src/components/ui/calendar-app/components/time-tracker/utils/format-time.ts +0 -26
  117. package/src/components/ui/calendar-app/components/time-tracker/utils/index.ts +0 -2
  118. package/src/components/ui/calendar-app/components/time-tracker.tsx +0 -2040
  119. package/src/components/ui/custom/settings/task-settings.tsx +0 -543
  120. package/src/components/ui/custom/settings/task-sound-settings.test.tsx +0 -146
  121. package/src/components/ui/text-editor/__tests__/task-mention-chip.test.tsx +0 -476
  122. package/src/components/ui/text-editor/task-mention-chip.tsx +0 -1397
  123. package/src/components/ui/text-editor/task-mention-resolution.ts +0 -235
  124. package/src/components/ui/text-editor/task-summary-popover.tsx +0 -360
  125. package/src/components/ui/tu-do/boards/__tests__/board-share-dialog.test.tsx +0 -286
  126. package/src/components/ui/tu-do/boards/__tests__/quick-create-board-dialog.test.tsx +0 -52
  127. package/src/components/ui/tu-do/boards/__tests__/task-board-form.test.tsx +0 -142
  128. package/src/components/ui/tu-do/boards/__tests__/workspace-projects-client-page.test.tsx +0 -169
  129. package/src/components/ui/tu-do/boards/analytics/GanttChart.tsx +0 -419
  130. package/src/components/ui/tu-do/boards/analytics/GanttControls.tsx +0 -123
  131. package/src/components/ui/tu-do/boards/analytics/GanttHeader.tsx +0 -48
  132. package/src/components/ui/tu-do/boards/analytics/GanttTimeline.tsx +0 -355
  133. package/src/components/ui/tu-do/boards/analytics/StatusDistribution.tsx +0 -130
  134. package/src/components/ui/tu-do/boards/analytics/TaskCreationAnalytics.tsx +0 -285
  135. package/src/components/ui/tu-do/boards/analytics/TaskDetailCard.tsx +0 -270
  136. package/src/components/ui/tu-do/boards/analytics/TaskGroup.tsx +0 -282
  137. package/src/components/ui/tu-do/boards/analytics/TaskWorkflowAnalytics.tsx +0 -280
  138. package/src/components/ui/tu-do/boards/board-public-link-section.tsx +0 -231
  139. package/src/components/ui/tu-do/boards/board-selector.tsx +0 -301
  140. package/src/components/ui/tu-do/boards/board-share-dialog.tsx +0 -69
  141. package/src/components/ui/tu-do/boards/board-share-settings-panel.tsx +0 -351
  142. package/src/components/ui/tu-do/boards/boardId/__tests__/list-actions.test.tsx +0 -199
  143. package/src/components/ui/tu-do/boards/boardId/board-column-external-retry.test.tsx +0 -185
  144. package/src/components/ui/tu-do/boards/boardId/board-column-initial-load.test.ts +0 -38
  145. package/src/components/ui/tu-do/boards/boardId/board-column.tsx +0 -922
  146. package/src/components/ui/tu-do/boards/boardId/board-text-utils.test.ts +0 -24
  147. package/src/components/ui/tu-do/boards/boardId/board-text-utils.ts +0 -11
  148. package/src/components/ui/tu-do/boards/boardId/enhanced-task-list.tsx +0 -543
  149. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/__tests__/bulk-mutations-external-workspaces.test.tsx +0 -392
  150. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/__tests__/bulk-mutations-move.test.tsx +0 -252
  151. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-actions-island.test.tsx +0 -57
  152. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-actions-island.tsx +0 -106
  153. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-actions-menu.tsx +0 -689
  154. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-custom-date-dialog.tsx +0 -82
  155. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-delete-dialog.tsx +0 -58
  156. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +0 -418
  157. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +0 -662
  158. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-assignees.ts +0 -375
  159. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-labels.ts +0 -278
  160. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-projects.ts +0 -297
  161. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations.ts +0 -12
  162. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +0 -462
  163. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-i18n.ts +0 -524
  164. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-types.ts +0 -34
  165. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-utils.ts +0 -377
  166. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operations.ts +0 -348
  167. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-personal-external-move.ts +0 -132
  168. package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +0 -90
  169. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-applied-sets.ts +0 -79
  170. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-bulk-resources.ts +0 -112
  171. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-filtered-resources.ts +0 -54
  172. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +0 -80
  173. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/auto-scroll.test.ts +0 -118
  174. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/auto-scroll.ts +0 -160
  175. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +0 -65
  176. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/drag-preview.tsx +0 -117
  177. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/kanban-sort-helpers.ts +0 -76
  178. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +0 -367
  179. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-geometry.test.ts +0 -67
  180. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-geometry.ts +0 -94
  181. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +0 -150
  182. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-pending.test.ts +0 -37
  183. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-pending.ts +0 -42
  184. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-preview.test.ts +0 -318
  185. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-preview.ts +0 -260
  186. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-types.ts +0 -39
  187. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-sort-key.ts +0 -47
  188. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.test.ts +0 -859
  189. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +0 -1659
  190. package/src/components/ui/tu-do/boards/boardId/kanban/kanban-column-collapse.ts +0 -16
  191. package/src/components/ui/tu-do/boards/boardId/kanban/kanban-constants.ts +0 -43
  192. package/src/components/ui/tu-do/boards/boardId/kanban/planner/__tests__/kanban-planner-island.test.tsx +0 -380
  193. package/src/components/ui/tu-do/boards/boardId/kanban/planner/kanban-planner-dialog.tsx +0 -204
  194. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-digest-panel.tsx +0 -61
  195. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-item-strip.tsx +0 -54
  196. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-plan-toolbar.tsx +0 -251
  197. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-scope-badge.tsx +0 -27
  198. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-section.tsx +0 -58
  199. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-share-dialog.tsx +0 -238
  200. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-target-controls.tsx +0 -143
  201. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-utils.ts +0 -65
  202. package/src/components/ui/tu-do/boards/boardId/kanban/planner/use-kanban-planner-state.ts +0 -234
  203. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-column-width.ts +0 -30
  204. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +0 -1077
  205. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +0 -447
  206. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +0 -703
  207. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-tasks.test.ts +0 -267
  208. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-tasks.ts +0 -112
  209. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +0 -113
  210. package/src/components/ui/tu-do/boards/boardId/kanban/selection/use-keyboard-shortcuts.ts +0 -137
  211. package/src/components/ui/tu-do/boards/boardId/kanban/selection/use-multi-select.ts +0 -119
  212. package/src/components/ui/tu-do/boards/boardId/kanban.tsx +0 -631
  213. package/src/components/ui/tu-do/boards/boardId/list-actions.tsx +0 -522
  214. package/src/components/ui/tu-do/boards/boardId/menus/__tests__/task-estimation-menu.test.tsx +0 -261
  215. package/src/components/ui/tu-do/boards/boardId/menus/__tests__/task-menus.test.tsx +0 -708
  216. package/src/components/ui/tu-do/boards/boardId/menus/index.ts +0 -12
  217. package/src/components/ui/tu-do/boards/boardId/menus/task-assignees-menu.tsx +0 -176
  218. package/src/components/ui/tu-do/boards/boardId/menus/task-blocking-menu.tsx +0 -304
  219. package/src/components/ui/tu-do/boards/boardId/menus/task-due-date-menu.tsx +0 -201
  220. package/src/components/ui/tu-do/boards/boardId/menus/task-estimation-menu.tsx +0 -103
  221. package/src/components/ui/tu-do/boards/boardId/menus/task-labels-menu.tsx +0 -134
  222. package/src/components/ui/tu-do/boards/boardId/menus/task-move-menu.tsx +0 -66
  223. package/src/components/ui/tu-do/boards/boardId/menus/task-parent-menu.tsx +0 -228
  224. package/src/components/ui/tu-do/boards/boardId/menus/task-picker-popover.tsx +0 -300
  225. package/src/components/ui/tu-do/boards/boardId/menus/task-priority-menu.tsx +0 -178
  226. package/src/components/ui/tu-do/boards/boardId/menus/task-projects-menu.tsx +0 -143
  227. package/src/components/ui/tu-do/boards/boardId/menus/task-related-menu.tsx +0 -242
  228. package/src/components/ui/tu-do/boards/boardId/menus/task-scheduling-menu.tsx +0 -465
  229. package/src/components/ui/tu-do/boards/boardId/menus/task-scheduling-utils.ts +0 -109
  230. package/src/components/ui/tu-do/boards/boardId/status-grouped-board.tsx +0 -533
  231. package/src/components/ui/tu-do/boards/boardId/status-section.tsx +0 -274
  232. package/src/components/ui/tu-do/boards/boardId/task-actions.tsx +0 -675
  233. package/src/components/ui/tu-do/boards/boardId/task-board-server-page.test.tsx +0 -209
  234. package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +0 -109
  235. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardCheckbox.tsx +0 -50
  236. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardDates.tsx +0 -123
  237. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardHeader.tsx +0 -97
  238. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardMetadata.tsx +0 -152
  239. package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +0 -118
  240. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-archive-visibility.test.ts +0 -44
  241. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-archive-visibility.ts +0 -17
  242. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-checkbox-style.ts +0 -39
  243. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.test.ts +0 -104
  244. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +0 -123
  245. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-completion-checkbox-visibility.test.ts +0 -31
  246. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-completion-checkbox-visibility.ts +0 -9
  247. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-identifier-row.test.tsx +0 -124
  248. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-identifier-row.tsx +0 -88
  249. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-label-options.ts +0 -24
  250. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.test.ts +0 -166
  251. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.ts +0 -148
  252. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-resource-context.test.ts +0 -113
  253. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-resource-context.ts +0 -50
  254. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-visibility.test.ts +0 -41
  255. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-visibility.ts +0 -14
  256. package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +0 -2889
  257. package/src/components/ui/tu-do/boards/boardId/task-card/task-scheduling-badge.tsx +0 -174
  258. package/src/components/ui/tu-do/boards/boardId/task-dialogs/BoardEstimationConfigDialog.tsx +0 -499
  259. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskCustomDateDialog.tsx +0 -109
  260. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskDeleteDialog.tsx +0 -96
  261. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskNewLabelDialog.tsx +0 -178
  262. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskNewProjectDialog.tsx +0 -127
  263. package/src/components/ui/tu-do/boards/boardId/task-filter.test.tsx +0 -152
  264. package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +0 -996
  265. package/src/components/ui/tu-do/boards/boardId/task-form.tsx +0 -498
  266. package/src/components/ui/tu-do/boards/boardId/task-list-drag-preview.test.ts +0 -101
  267. package/src/components/ui/tu-do/boards/boardId/task-list-form.tsx +0 -91
  268. package/src/components/ui/tu-do/boards/boardId/task-list.tsx +0 -535
  269. package/src/components/ui/tu-do/boards/boardId/task-parent-badge-state.test.ts +0 -64
  270. package/src/components/ui/tu-do/boards/boardId/task-parent-badge-state.ts +0 -31
  271. package/src/components/ui/tu-do/boards/boardId/task.tsx +0 -2
  272. package/src/components/ui/tu-do/boards/boardId/timeline/task-edit-dialog.tsx +0 -109
  273. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-display.ts +0 -103
  274. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-grid.tsx +0 -381
  275. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-task-row.tsx +0 -339
  276. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-toolbar.tsx +0 -356
  277. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.test.ts +0 -169
  278. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.ts +0 -517
  279. package/src/components/ui/tu-do/boards/boardId/timeline-board-open-task.test.tsx +0 -164
  280. package/src/components/ui/tu-do/boards/boardId/timeline-board.test.tsx +0 -217
  281. package/src/components/ui/tu-do/boards/boardId/timeline-board.tsx +0 -834
  282. package/src/components/ui/tu-do/boards/boards-list-skeleton.tsx +0 -62
  283. package/src/components/ui/tu-do/boards/columns.tsx +0 -159
  284. package/src/components/ui/tu-do/boards/copy-board-dialog.tsx +0 -156
  285. package/src/components/ui/tu-do/boards/enhanced-boards-view.tsx +0 -347
  286. package/src/components/ui/tu-do/boards/form.tsx +0 -264
  287. package/src/components/ui/tu-do/boards/quick-create-board-dialog.tsx +0 -75
  288. package/src/components/ui/tu-do/boards/row-actions.tsx +0 -397
  289. package/src/components/ui/tu-do/boards/share-section.tsx +0 -100
  290. package/src/components/ui/tu-do/boards/workspace-projects-client-page.tsx +0 -192
  291. package/src/components/ui/tu-do/boards/workspace-projects-page.tsx +0 -155
  292. package/src/components/ui/tu-do/cycles/task-cycles-client.tsx +0 -753
  293. package/src/components/ui/tu-do/cycles/task-cycles-page.tsx +0 -103
  294. package/src/components/ui/tu-do/drafts/draft-card.tsx +0 -204
  295. package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +0 -195
  296. package/src/components/ui/tu-do/drafts/drafts-page.tsx +0 -122
  297. package/src/components/ui/tu-do/drafts/task-drafts-page.tsx +0 -90
  298. package/src/components/ui/tu-do/estimates/client.tsx +0 -292
  299. package/src/components/ui/tu-do/estimates/edit-estimation-dialog.tsx +0 -374
  300. package/src/components/ui/tu-do/estimates/task-estimates-page.tsx +0 -57
  301. package/src/components/ui/tu-do/estimates/use-task-estimates.ts +0 -324
  302. package/src/components/ui/tu-do/habits/client.tsx +0 -263
  303. package/src/components/ui/tu-do/habits/habit-card.tsx +0 -183
  304. package/src/components/ui/tu-do/habits/habit-form-dialog.tsx +0 -701
  305. package/src/components/ui/tu-do/habits/habits-page.tsx +0 -27
  306. package/src/components/ui/tu-do/hooks/__tests__/useDraftPersistence.test.ts +0 -494
  307. package/src/components/ui/tu-do/hooks/__tests__/useTaskDialog.test.tsx +0 -127
  308. package/src/components/ui/tu-do/hooks/__tests__/useTaskDialogState.test.ts +0 -217
  309. package/src/components/ui/tu-do/hooks/__tests__/useTaskLabelManagement.test.tsx +0 -572
  310. package/src/components/ui/tu-do/hooks/__tests__/useTaskProjectManagement.test.tsx +0 -144
  311. package/src/components/ui/tu-do/hooks/useDraftPersistence.ts +0 -199
  312. package/src/components/ui/tu-do/hooks/useTaskCardRelationships.ts +0 -340
  313. package/src/components/ui/tu-do/hooks/useTaskDialog.ts +0 -122
  314. package/src/components/ui/tu-do/hooks/useTaskDialogState.ts +0 -145
  315. package/src/components/ui/tu-do/hooks/useTaskFormState.ts +0 -206
  316. package/src/components/ui/tu-do/hooks/useTaskKeyboardShortcuts.ts +0 -58
  317. package/src/components/ui/tu-do/hooks/useTaskLabelManagement.ts +0 -425
  318. package/src/components/ui/tu-do/hooks/useTaskProjectManagement.ts +0 -454
  319. package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +0 -889
  320. package/src/components/ui/tu-do/initiatives/task-initiatives-page.tsx +0 -116
  321. package/src/components/ui/tu-do/labels/client.tsx +0 -201
  322. package/src/components/ui/tu-do/labels/components/delete-label-dialog.tsx +0 -57
  323. package/src/components/ui/tu-do/labels/components/label-card.tsx +0 -86
  324. package/src/components/ui/tu-do/labels/components/label-dialog.tsx +0 -259
  325. package/src/components/ui/tu-do/labels/components/label-list.tsx +0 -83
  326. package/src/components/ui/tu-do/labels/hooks/use-task-labels.ts +0 -170
  327. package/src/components/ui/tu-do/labels/task-labels-page.tsx +0 -53
  328. package/src/components/ui/tu-do/labels/types.ts +0 -6
  329. package/src/components/ui/tu-do/logs/columns.tsx +0 -755
  330. package/src/components/ui/tu-do/logs/logs-client.tsx +0 -1006
  331. package/src/components/ui/tu-do/logs/logs-timeline.tsx +0 -2483
  332. package/src/components/ui/tu-do/logs/task-logs-page.tsx +0 -59
  333. package/src/components/ui/tu-do/my-tasks/__tests__/my-tasks-content.test.tsx +0 -408
  334. package/src/components/ui/tu-do/my-tasks/__tests__/use-my-tasks-query.test.ts +0 -469
  335. package/src/components/ui/tu-do/my-tasks/__tests__/use-my-tasks-state.test.ts +0 -1017
  336. package/src/components/ui/tu-do/my-tasks/__tests__/use-task-context-actions.test.ts +0 -584
  337. package/src/components/ui/tu-do/my-tasks/ai-credit-indicator.tsx +0 -143
  338. package/src/components/ui/tu-do/my-tasks/board-selector-dialog.tsx +0 -239
  339. package/src/components/ui/tu-do/my-tasks/command-bar.tsx +0 -1351
  340. package/src/components/ui/tu-do/my-tasks/label-project-filter.tsx +0 -194
  341. package/src/components/ui/tu-do/my-tasks/my-task-context-menu.tsx +0 -356
  342. package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +0 -328
  343. package/src/components/ui/tu-do/my-tasks/my-tasks-data-loader.tsx +0 -17
  344. package/src/components/ui/tu-do/my-tasks/my-tasks-filters.tsx +0 -258
  345. package/src/components/ui/tu-do/my-tasks/my-tasks-header.tsx +0 -121
  346. package/src/components/ui/tu-do/my-tasks/my-tasks-page.tsx +0 -40
  347. package/src/components/ui/tu-do/my-tasks/personal-placement-dialog.tsx +0 -188
  348. package/src/components/ui/tu-do/my-tasks/task-filter.tsx +0 -235
  349. package/src/components/ui/tu-do/my-tasks/task-list-with-completion.tsx +0 -832
  350. package/src/components/ui/tu-do/my-tasks/task-list.tsx +0 -258
  351. package/src/components/ui/tu-do/my-tasks/task-preview-dialog.tsx +0 -1597
  352. package/src/components/ui/tu-do/my-tasks/task-section.tsx +0 -261
  353. package/src/components/ui/tu-do/my-tasks/use-my-tasks-query.ts +0 -149
  354. package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +0 -1037
  355. package/src/components/ui/tu-do/my-tasks/use-task-context-actions.ts +0 -474
  356. package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +0 -118
  357. package/src/components/ui/tu-do/notes/note-list.tsx +0 -799
  358. package/src/components/ui/tu-do/notes/notes-content.tsx +0 -178
  359. package/src/components/ui/tu-do/notes/notes-page.tsx +0 -27
  360. package/src/components/ui/tu-do/progress/task-progress-import-panel.tsx +0 -60
  361. package/src/components/ui/tu-do/progress/task-progress-leaderboards-panel.tsx +0 -156
  362. package/src/components/ui/tu-do/progress/task-progress-page.tsx +0 -382
  363. package/src/components/ui/tu-do/progress/task-progress-panels.tsx +0 -303
  364. package/src/components/ui/tu-do/projects/components/index.ts +0 -11
  365. package/src/components/ui/tu-do/projects/components/project-actions-menu.tsx +0 -66
  366. package/src/components/ui/tu-do/projects/components/project-badges.tsx +0 -84
  367. package/src/components/ui/tu-do/projects/components/project-filter-menu.tsx +0 -170
  368. package/src/components/ui/tu-do/projects/components/project-grid-card.tsx +0 -198
  369. package/src/components/ui/tu-do/projects/components/project-list-item.tsx +0 -195
  370. package/src/components/ui/tu-do/projects/components/project-metrics.tsx +0 -87
  371. package/src/components/ui/tu-do/projects/components/project-progress-meter.tsx +0 -33
  372. package/src/components/ui/tu-do/projects/components/project-sort-menu.tsx +0 -71
  373. package/src/components/ui/tu-do/projects/components/projects-empty-state.tsx +0 -38
  374. package/src/components/ui/tu-do/projects/components/projects-loading-state.tsx +0 -26
  375. package/src/components/ui/tu-do/projects/components/projects-toolbar.tsx +0 -179
  376. package/src/components/ui/tu-do/projects/dialogs/create-project-dialog.tsx +0 -117
  377. package/src/components/ui/tu-do/projects/dialogs/edit-project-dialog.tsx +0 -125
  378. package/src/components/ui/tu-do/projects/dialogs/index.ts +0 -3
  379. package/src/components/ui/tu-do/projects/dialogs/manage-tasks-dialog.tsx +0 -205
  380. package/src/components/ui/tu-do/projects/hooks/index.ts +0 -2
  381. package/src/components/ui/tu-do/projects/hooks/use-project-filters.ts +0 -248
  382. package/src/components/ui/tu-do/projects/hooks/use-task-projects.ts +0 -238
  383. package/src/components/ui/tu-do/projects/projectId/components/__tests__/tasks-tab-layout.test.tsx +0 -169
  384. package/src/components/ui/tu-do/projects/projectId/components/documents-tab.tsx +0 -90
  385. package/src/components/ui/tu-do/projects/projectId/components/index.ts +0 -9
  386. package/src/components/ui/tu-do/projects/projectId/components/overview/description-card.tsx +0 -77
  387. package/src/components/ui/tu-do/projects/projectId/components/overview/linked-documents-card.tsx +0 -81
  388. package/src/components/ui/tu-do/projects/projectId/components/overview/linked-tasks-card.tsx +0 -85
  389. package/src/components/ui/tu-do/projects/projectId/components/overview/updates-card.tsx +0 -85
  390. package/src/components/ui/tu-do/projects/projectId/components/overview-tab.tsx +0 -35
  391. package/src/components/ui/tu-do/projects/projectId/components/project-configuration.tsx +0 -229
  392. package/src/components/ui/tu-do/projects/projectId/components/project-header.tsx +0 -115
  393. package/src/components/ui/tu-do/projects/projectId/components/project-lead-selector.tsx +0 -55
  394. package/src/components/ui/tu-do/projects/projectId/components/project-overview-context.tsx +0 -82
  395. package/src/components/ui/tu-do/projects/projectId/components/project-sidebar.tsx +0 -246
  396. package/src/components/ui/tu-do/projects/projectId/components/tasks-tab.tsx +0 -266
  397. package/src/components/ui/tu-do/projects/projectId/components/update-card.tsx +0 -162
  398. package/src/components/ui/tu-do/projects/projectId/components/updates-tab.tsx +0 -129
  399. package/src/components/ui/tu-do/projects/projectId/dialogs/index.ts +0 -1
  400. package/src/components/ui/tu-do/projects/projectId/dialogs/link-task-dialog.tsx +0 -114
  401. package/src/components/ui/tu-do/projects/projectId/hooks/index.ts +0 -4
  402. package/src/components/ui/tu-do/projects/projectId/hooks/use-animation-variants.ts +0 -68
  403. package/src/components/ui/tu-do/projects/projectId/hooks/use-project-form.ts +0 -214
  404. package/src/components/ui/tu-do/projects/projectId/hooks/use-project-updates.ts +0 -209
  405. package/src/components/ui/tu-do/projects/projectId/hooks/use-task-linking.ts +0 -101
  406. package/src/components/ui/tu-do/projects/projectId/task-project-detail-page-client.tsx +0 -93
  407. package/src/components/ui/tu-do/projects/projectId/task-project-detail-page.tsx +0 -78
  408. package/src/components/ui/tu-do/projects/projectId/task-project-detail.tsx +0 -367
  409. package/src/components/ui/tu-do/projects/projectId/types.ts +0 -51
  410. package/src/components/ui/tu-do/projects/task-projects-client.tsx +0 -270
  411. package/src/components/ui/tu-do/projects/task-projects-page.tsx +0 -97
  412. package/src/components/ui/tu-do/projects/types.ts +0 -62
  413. package/src/components/ui/tu-do/providers/__tests__/task-dialog-provider.test.tsx +0 -616
  414. package/src/components/ui/tu-do/providers/task-dialog-provider.tsx +0 -923
  415. package/src/components/ui/tu-do/providers/workspace-presence-provider.tsx +0 -88
  416. package/src/components/ui/tu-do/shared/AccessibleButton.tsx +0 -79
  417. package/src/components/ui/tu-do/shared/__tests__/assignee-select.test.tsx +0 -143
  418. package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +0 -358
  419. package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +0 -598
  420. package/src/components/ui/tu-do/shared/__tests__/board-query-cache.test.ts +0 -219
  421. package/src/components/ui/tu-do/shared/__tests__/board-switcher.test.tsx +0 -374
  422. package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +0 -1288
  423. package/src/components/ui/tu-do/shared/__tests__/create-list-dialog.test.tsx +0 -118
  424. package/src/components/ui/tu-do/shared/__tests__/task-board-loading-state.test.tsx +0 -99
  425. package/src/components/ui/tu-do/shared/__tests__/task-cache-patches.test.ts +0 -147
  426. package/src/components/ui/tu-do/shared/__tests__/task-detail-page.test.tsx +0 -170
  427. package/src/components/ui/tu-do/shared/__tests__/task-dialog-manager.test.tsx +0 -945
  428. package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +0 -101
  429. package/src/components/ui/tu-do/shared/__tests__/use-progressive-board-loader.test.tsx +0 -645
  430. package/src/components/ui/tu-do/shared/assignee-select.tsx +0 -592
  431. package/src/components/ui/tu-do/shared/board-broadcast-context.tsx +0 -45
  432. package/src/components/ui/tu-do/shared/board-client.tsx +0 -283
  433. package/src/components/ui/tu-do/shared/board-config-storage.ts +0 -94
  434. package/src/components/ui/tu-do/shared/board-header.tsx +0 -803
  435. package/src/components/ui/tu-do/shared/board-layout-settings.tsx +0 -1134
  436. package/src/components/ui/tu-do/shared/board-query-cache.ts +0 -157
  437. package/src/components/ui/tu-do/shared/board-switcher.tsx +0 -322
  438. package/src/components/ui/tu-do/shared/board-user-presence-avatars.tsx +0 -578
  439. package/src/components/ui/tu-do/shared/board-views.tsx +0 -1238
  440. package/src/components/ui/tu-do/shared/clear-menu-item.tsx +0 -34
  441. package/src/components/ui/tu-do/shared/create-list-dialog.tsx +0 -401
  442. package/src/components/ui/tu-do/shared/cursor-overlay-multi-wrapper.tsx +0 -245
  443. package/src/components/ui/tu-do/shared/cursor-overlay.tsx +0 -78
  444. package/src/components/ui/tu-do/shared/custom-date-picker/custom-date-picker-dialog.tsx +0 -157
  445. package/src/components/ui/tu-do/shared/description-overflow-warning-dialog.tsx +0 -68
  446. package/src/components/ui/tu-do/shared/edit-list-dialog.tsx +0 -383
  447. package/src/components/ui/tu-do/shared/empty-state-card.tsx +0 -46
  448. package/src/components/ui/tu-do/shared/estimation-mapping.test.ts +0 -32
  449. package/src/components/ui/tu-do/shared/estimation-mapping.ts +0 -74
  450. package/src/components/ui/tu-do/shared/estimation-utils.ts +0 -54
  451. package/src/components/ui/tu-do/shared/fade-setting-initializer.tsx +0 -61
  452. package/src/components/ui/tu-do/shared/label-chip.tsx +0 -46
  453. package/src/components/ui/tu-do/shared/list-view-context-menu.test.tsx +0 -203
  454. package/src/components/ui/tu-do/shared/list-view-sorting.test.ts +0 -50
  455. package/src/components/ui/tu-do/shared/list-view-sorting.ts +0 -108
  456. package/src/components/ui/tu-do/shared/list-view.tsx +0 -1248
  457. package/src/components/ui/tu-do/shared/mention-system/__tests__/mention-system.test.ts +0 -250
  458. package/src/components/ui/tu-do/shared/mention-system/mention-menu.tsx +0 -217
  459. package/src/components/ui/tu-do/shared/mention-system/types.ts +0 -141
  460. package/src/components/ui/tu-do/shared/mention-system/use-mention-suggestions.ts +0 -244
  461. package/src/components/ui/tu-do/shared/progressive-loader-context.tsx +0 -45
  462. package/src/components/ui/tu-do/shared/recent-sidebar-events.ts +0 -58
  463. package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +0 -651
  464. package/src/components/ui/tu-do/shared/relationship-task-identifier.ts +0 -14
  465. package/src/components/ui/tu-do/shared/slash-commands/__tests__/slash-commands.test.ts +0 -315
  466. package/src/components/ui/tu-do/shared/slash-commands/definitions.ts +0 -167
  467. package/src/components/ui/tu-do/shared/slash-commands/slash-command-menu.tsx +0 -114
  468. package/src/components/ui/tu-do/shared/special-task-list-pins.ts +0 -51
  469. package/src/components/ui/tu-do/shared/sync-warning-dialog.tsx +0 -133
  470. package/src/components/ui/tu-do/shared/task-board-errors.ts +0 -19
  471. package/src/components/ui/tu-do/shared/task-board-loading-state.tsx +0 -82
  472. package/src/components/ui/tu-do/shared/task-cache-patches.ts +0 -394
  473. package/src/components/ui/tu-do/shared/task-detail-page.tsx +0 -176
  474. package/src/components/ui/tu-do/shared/task-detail-server-page.tsx +0 -37
  475. package/src/components/ui/tu-do/shared/task-dialog-manager.tsx +0 -596
  476. package/src/components/ui/tu-do/shared/task-dialog-presentation.test.ts +0 -53
  477. package/src/components/ui/tu-do/shared/task-dialog-presentation.ts +0 -30
  478. package/src/components/ui/tu-do/shared/task-dialog-wrapper.tsx +0 -28
  479. package/src/components/ui/tu-do/shared/task-due-date-visibility.test.ts +0 -72
  480. package/src/components/ui/tu-do/shared/task-due-date-visibility.ts +0 -38
  481. package/src/components/ui/tu-do/shared/task-edit-dialog/components/compact-task-create-popover.test.tsx +0 -325
  482. package/src/components/ui/tu-do/shared/task-edit-dialog/components/compact-task-create-popover.tsx +0 -268
  483. package/src/components/ui/tu-do/shared/task-edit-dialog/components/mobile-floating-save-button.tsx +0 -46
  484. package/src/components/ui/tu-do/shared/task-edit-dialog/components/quick-settings-popover.tsx +0 -198
  485. package/src/components/ui/tu-do/shared/task-edit-dialog/components/smart-task-suggestions-panel.test.tsx +0 -129
  486. package/src/components/ui/tu-do/shared/task-edit-dialog/components/smart-task-suggestions-panel.tsx +0 -358
  487. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-description-editor.tsx +0 -496
  488. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-dialog-header.tsx +0 -545
  489. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-picker-panel.tsx +0 -220
  490. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-selector.tsx +0 -165
  491. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-trigger-styles.ts +0 -69
  492. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-name-input.test.tsx +0 -180
  493. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-name-input.tsx +0 -218
  494. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-suggestion-menus.tsx +0 -148
  495. package/src/components/ui/tu-do/shared/task-edit-dialog/constants.ts +0 -18
  496. package/src/components/ui/tu-do/shared/task-edit-dialog/context-menu-guard.test.ts +0 -37
  497. package/src/components/ui/tu-do/shared/task-edit-dialog/description-diff-viewer.tsx +0 -1665
  498. package/src/components/ui/tu-do/shared/task-edit-dialog/description-versions.test.ts +0 -97
  499. package/src/components/ui/tu-do/shared/task-edit-dialog/description-versions.ts +0 -210
  500. package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +0 -716
  501. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-dialog-close.test.ts +0 -218
  502. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-dialog-keyboard-shortcuts.test.ts +0 -140
  503. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-mutations.test.tsx +0 -231
  504. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-overrides.test.ts +0 -412
  505. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-realtime-sync.test.tsx +0 -237
  506. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-yjs-sync.test.ts +0 -190
  507. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-update-shared-task.test.ts +0 -107
  508. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/task-api.test.ts +0 -171
  509. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/task-api.ts +0 -296
  510. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-editor-commands.ts +0 -314
  511. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-suggestion-menus.ts +0 -503
  512. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-change-detection.ts +0 -175
  513. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-data.ts +0 -401
  514. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dependencies.ts +0 -773
  515. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dialog-close.ts +0 -193
  516. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dialog-keyboard-shortcuts.ts +0 -365
  517. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-form-reset.ts +0 -231
  518. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-form-state.ts +0 -307
  519. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-mutations.ts +0 -609
  520. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-overrides.ts +0 -134
  521. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-realtime-sync.ts +0 -270
  522. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.test.tsx +0 -212
  523. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.ts +0 -554
  524. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-revert.ts +0 -140
  525. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-save.test.ts +0 -289
  526. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-save.ts +0 -1473
  527. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-snapshot.ts +0 -59
  528. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-yjs-sync.ts +0 -224
  529. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-update-shared-task.ts +0 -60
  530. package/src/components/ui/tu-do/shared/task-edit-dialog/personal-overrides-section.tsx +0 -368
  531. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/clickable-task-item.tsx +0 -90
  532. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/index.ts +0 -4
  533. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/subtask-action-buttons.tsx +0 -140
  534. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/tab-button.tsx +0 -76
  535. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/task-relationship-action-buttons.tsx +0 -178
  536. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/dependencies-section.tsx +0 -140
  537. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/index.ts +0 -35
  538. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/parent-section.tsx +0 -70
  539. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/related-section.tsx +0 -81
  540. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/subtasks-section.tsx +0 -87
  541. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/task-search-popover.tsx +0 -229
  542. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/types/task-relationships.types.ts +0 -194
  543. package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.test.tsx +0 -91
  544. package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +0 -365
  545. package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +0 -802
  546. package/src/components/ui/tu-do/shared/task-edit-dialog/task-delete-dialog.tsx +0 -104
  547. package/src/components/ui/tu-do/shared/task-edit-dialog/task-description-change-dialog.test.tsx +0 -63
  548. package/src/components/ui/tu-do/shared/task-edit-dialog/task-description-change-dialog.tsx +0 -218
  549. package/src/components/ui/tu-do/shared/task-edit-dialog/task-description-restore-banner.tsx +0 -83
  550. package/src/components/ui/tu-do/shared/task-edit-dialog/task-description-version-restore-dialog.test.tsx +0 -120
  551. package/src/components/ui/tu-do/shared/task-edit-dialog/task-description-version-restore-dialog.tsx +0 -180
  552. package/src/components/ui/tu-do/shared/task-edit-dialog/task-dialog-actions.test.tsx +0 -68
  553. package/src/components/ui/tu-do/shared/task-edit-dialog/task-dialog-actions.tsx +0 -239
  554. package/src/components/ui/tu-do/shared/task-edit-dialog/task-instances-section.tsx +0 -173
  555. package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.test.tsx +0 -303
  556. package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.tsx +0 -2213
  557. package/src/components/ui/tu-do/shared/task-edit-dialog/task-relationships-properties.tsx +0 -315
  558. package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +0 -167
  559. package/src/components/ui/tu-do/shared/task-edit-dialog/types/pending-relationship.test.ts +0 -52
  560. package/src/components/ui/tu-do/shared/task-edit-dialog/types/pending-relationship.ts +0 -134
  561. package/src/components/ui/tu-do/shared/task-edit-dialog/types.ts +0 -64
  562. package/src/components/ui/tu-do/shared/task-edit-dialog/user-display.test.ts +0 -58
  563. package/src/components/ui/tu-do/shared/task-edit-dialog/user-display.ts +0 -45
  564. package/src/components/ui/tu-do/shared/task-edit-dialog/utils/inline-task-target-list.test.ts +0 -98
  565. package/src/components/ui/tu-do/shared/task-edit-dialog/utils/inline-task-target-list.ts +0 -39
  566. package/src/components/ui/tu-do/shared/task-edit-dialog/utils.test.ts +0 -504
  567. package/src/components/ui/tu-do/shared/task-edit-dialog/utils.ts +0 -582
  568. package/src/components/ui/tu-do/shared/task-edit-dialog/yjs-prosemirror-compat.test.ts +0 -65
  569. package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +0 -3196
  570. package/src/components/ui/tu-do/shared/task-estimation-display.tsx +0 -52
  571. package/src/components/ui/tu-do/shared/task-estimation-picker.tsx +0 -226
  572. package/src/components/ui/tu-do/shared/task-filter.types.ts +0 -65
  573. package/src/components/ui/tu-do/shared/task-label-selector.tsx +0 -217
  574. package/src/components/ui/tu-do/shared/task-labels-display.test.tsx +0 -51
  575. package/src/components/ui/tu-do/shared/task-labels-display.tsx +0 -119
  576. package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +0 -65
  577. package/src/components/ui/tu-do/shared/task-projects-display.tsx +0 -80
  578. package/src/components/ui/tu-do/shared/task-quick-create-target-list.ts +0 -20
  579. package/src/components/ui/tu-do/shared/task-resource-search-field.tsx +0 -49
  580. package/src/components/ui/tu-do/shared/task-resource-search-filters.ts +0 -27
  581. package/src/components/ui/tu-do/shared/task-row-actions-menu.test.tsx +0 -138
  582. package/src/components/ui/tu-do/shared/task-row-actions-menu.tsx +0 -402
  583. package/src/components/ui/tu-do/shared/task-share-dialog/components/share-link-settings.tsx +0 -86
  584. package/src/components/ui/tu-do/shared/task-share-dialog/components/shares-list.tsx +0 -85
  585. package/src/components/ui/tu-do/shared/task-share-dialog/hooks/use-task-sharing.ts +0 -296
  586. package/src/components/ui/tu-do/shared/task-share-dialog.tsx +0 -144
  587. package/src/components/ui/tu-do/shared/task-sound-effects.test.ts +0 -189
  588. package/src/components/ui/tu-do/shared/task-sound-effects.tsx +0 -468
  589. package/src/components/ui/tu-do/shared/task-url.ts +0 -56
  590. package/src/components/ui/tu-do/shared/text-diff-viewer.tsx +0 -55
  591. package/src/components/ui/tu-do/shared/types.ts +0 -14
  592. package/src/components/ui/tu-do/shared/unsaved-changes-warning-dialog.tsx +0 -71
  593. package/src/components/ui/tu-do/shared/use-progressive-board-loader.ts +0 -312
  594. package/src/components/ui/tu-do/shared/user-avatar.tsx +0 -46
  595. package/src/components/ui/tu-do/shared/user-presence-avatars.tsx +0 -415
  596. package/src/components/ui/tu-do/shared/utils/translate-task-list-display-name.ts +0 -28
  597. package/src/components/ui/tu-do/tasks-route-context.tsx +0 -50
  598. package/src/components/ui/tu-do/templates/client.tsx +0 -505
  599. package/src/components/ui/tu-do/templates/marketplace/client.tsx +0 -487
  600. package/src/components/ui/tu-do/templates/marketplace/task-marketplace-page.tsx +0 -169
  601. package/src/components/ui/tu-do/templates/save-as-template-dialog.tsx +0 -381
  602. package/src/components/ui/tu-do/templates/task-template-api.ts +0 -142
  603. package/src/components/ui/tu-do/templates/task-template-card.tsx +0 -118
  604. package/src/components/ui/tu-do/templates/task-template-client.test.tsx +0 -52
  605. package/src/components/ui/tu-do/templates/task-template-client.tsx +0 -258
  606. package/src/components/ui/tu-do/templates/task-template-dialogs.test.tsx +0 -167
  607. package/src/components/ui/tu-do/templates/task-template-dialogs.tsx +0 -376
  608. package/src/components/ui/tu-do/templates/task-templates-hub.test.tsx +0 -114
  609. package/src/components/ui/tu-do/templates/task-templates-hub.tsx +0 -53
  610. package/src/components/ui/tu-do/templates/task-templates-page.tsx +0 -157
  611. package/src/components/ui/tu-do/templates/templateId/client.tsx +0 -674
  612. package/src/components/ui/tu-do/templates/templateId/edit-template-dialog.tsx +0 -300
  613. package/src/components/ui/tu-do/templates/templateId/share-template-dialog.tsx +0 -261
  614. package/src/components/ui/tu-do/templates/templateId/task-template-detail-page-client.tsx +0 -127
  615. package/src/components/ui/tu-do/templates/templateId/task-template-detail-page.tsx +0 -89
  616. package/src/components/ui/tu-do/templates/templateId/use-template-dialog.tsx +0 -165
  617. package/src/components/ui/tu-do/templates/types.ts +0 -53
  618. package/src/components/ui/tu-do/utils/__tests__/label-colors.test.ts +0 -43
  619. package/src/components/ui/tu-do/utils/__tests__/taskColorUtils.test.ts +0 -267
  620. package/src/components/ui/tu-do/utils/__tests__/taskConstants.test.ts +0 -178
  621. package/src/components/ui/tu-do/utils/__tests__/taskDateUtils.test.ts +0 -226
  622. package/src/components/ui/tu-do/utils/__tests__/weekDateUtils.test.ts +0 -182
  623. package/src/components/ui/tu-do/utils/label-colors.test.ts +0 -15
  624. package/src/components/ui/tu-do/utils/label-colors.ts +0 -59
  625. package/src/components/ui/tu-do/utils/taskColorUtils.ts +0 -116
  626. package/src/components/ui/tu-do/utils/taskConstants.ts +0 -102
  627. package/src/components/ui/tu-do/utils/taskDateUtils.ts +0 -81
  628. package/src/components/ui/tu-do/utils/taskPriorityUtils.tsx +0 -80
  629. package/src/components/ui/tu-do/utils/weekDateUtils.ts +0 -64
  630. package/src/hooks/__tests__/use-task-actions.test.tsx +0 -2098
  631. package/src/hooks/__tests__/useBoardPresence.test.tsx +0 -191
  632. package/src/hooks/__tests__/useBoardRealtime.test.tsx +0 -1036
  633. package/src/hooks/__tests__/useCursorTracking.test.tsx +0 -212
  634. package/src/hooks/task-actions-personal-external.ts +0 -313
  635. package/src/hooks/use-task-actions.ts +0 -1910
  636. package/src/hooks/useBoardPresence.ts +0 -364
  637. package/src/hooks/useBoardRealtime.ts +0 -428
  638. package/src/hooks/useBoardRealtime.types.ts +0 -56
  639. package/src/hooks/useBoardRealtimeEventHandler.ts +0 -452
  640. package/src/hooks/useCursorTracking.ts +0 -402
  641. package/src/hooks/usePresence.ts +0 -272
  642. package/src/hooks/useTaskUserRealtime.ts +0 -340
  643. /package/src/{components/ui/tu-do/shared → lib}/task-open-events.ts +0 -0
@@ -1,1659 +0,0 @@
1
- 'use client';
2
-
3
- import type {
4
- DragEndEvent,
5
- DragMoveEvent,
6
- DragOverEvent,
7
- DragStartEvent,
8
- } from '@dnd-kit/core';
9
- import { useQueryClient } from '@tanstack/react-query';
10
- import {
11
- removeCurrentUserTaskPersonalPlacement,
12
- upsertCurrentUserTaskPersonalPlacement,
13
- } from '@tuturuuu/internal-api/tasks';
14
- import type { Task } from '@tuturuuu/types/primitives/Task';
15
- import type { TaskList } from '@tuturuuu/types/primitives/TaskList';
16
- import { toast } from '@tuturuuu/ui/sonner';
17
- import {
18
- getPersonalExternalStagingBoardId,
19
- getPersonalExternalStagingListId,
20
- isPersonalExternalStagingListId,
21
- } from '@tuturuuu/utils/task-helper';
22
- import { hasDraggableData } from '@tuturuuu/utils/task-helpers';
23
- import { useCallback, useRef, useState } from 'react';
24
- import { isPersonalExternalOverlayTask } from '../../../../../../../lib/task-personal-external';
25
- import { useBoardBroadcast } from '../../../../shared/board-broadcast-context';
26
- import { invalidateKanbanDeadlineTasks } from '../data/kanban-deadline-query';
27
- import { MAX_SAFE_INTEGER_SORT } from '../kanban-constants';
28
- import { getKanbanDragAutoScrollPointerX, useAutoScroll } from './auto-scroll';
29
- import { getColumnReorderUpdates } from './column-reorder';
30
- import { calculateSortKeyWithRetry as createCalculateSortKeyWithRetry } from './kanban-sort-helpers';
31
- import {
32
- applyTaskDropPreviewToCache,
33
- hasTaskLocalMutationAt,
34
- mergePersonalPlacementMutationTask,
35
- setBoardTaskCache,
36
- } from './task-drag-cache';
37
- import {
38
- getFrozenActiveRectFromDelta,
39
- getTaskDropPositionFromRects,
40
- } from './task-drag-geometry';
41
- import {
42
- getNeighborTaskIds,
43
- getProjectedTaskDropOrderFromPreview,
44
- getTaskInsertionIndex,
45
- insertTaskAtDropPosition,
46
- insertTaskAtInsertionIndex,
47
- sortTasksForList,
48
- } from './task-drag-order';
49
- import {
50
- addPendingTaskIds,
51
- getPendingTaskIdsForDrop,
52
- removePendingTaskIds,
53
- } from './task-drag-pending';
54
- import {
55
- dragPreviewPositionsEqual,
56
- getTaskDropEndPreviewFromRects,
57
- getTaskDropPreviewFromListSurface,
58
- getTaskDropPreviewFromRects,
59
- } from './task-drag-preview';
60
- import type {
61
- DragCacheSnapshot,
62
- DragPreviewPosition,
63
- DragSessionMetrics,
64
- TaskRect,
65
- VerticalRect,
66
- } from './task-drag-types';
67
- import {
68
- compareTasksByEffectiveSortKey,
69
- getEffectiveTaskSortKey,
70
- } from './task-sort-key';
71
-
72
- export {
73
- applyTaskDropPreviewToCache,
74
- getTaskDropPreviewCacheTasks,
75
- hasTaskLocalMutationAt,
76
- mergePersonalPlacementMutationTask,
77
- mergeTaskIntoBoardTaskCache,
78
- } from './task-drag-cache';
79
- export {
80
- getFrozenActiveRectFromDelta,
81
- getTaskDropPositionFromRects,
82
- } from './task-drag-geometry';
83
- export {
84
- getProjectedTaskDropOrderFromPreview,
85
- getTaskInsertionIndex,
86
- insertTaskAtDropPosition,
87
- insertTaskAtInsertionIndex,
88
- sortTasksForList,
89
- } from './task-drag-order';
90
- export {
91
- dragPreviewPositionsEqual,
92
- getTaskDropEndPreviewFromRects,
93
- getTaskDropPreviewFromListSurface,
94
- getTaskDropPreviewFromRects,
95
- } from './task-drag-preview';
96
- export type {
97
- DragCacheSnapshot,
98
- DragPreviewPosition,
99
- DragSessionMetrics,
100
- TaskDropPosition,
101
- TaskRect,
102
- VerticalRect,
103
- } from './task-drag-types';
104
-
105
- interface UseKanbanDndProps {
106
- wsId?: string | null;
107
- boardId: string | null;
108
- columns: TaskList[];
109
- tasks: Task[];
110
- disableSort: boolean;
111
- selectedTasks: Set<string>;
112
- isMultiSelectMode: boolean;
113
- clearSelection: () => void;
114
- persistListPositions: (
115
- updates: Array<{ listId: string; newPosition: number }>
116
- ) => Promise<void>;
117
- invalidColumnMoveMessage?: string;
118
- invalidExternalStagingMoveMessage?: string;
119
- personalPlacementUpdateFailedMessage?: string;
120
- reorderTaskMutation: any;
121
- taskHeightsRef: React.RefObject<Map<string, number>>;
122
- scrollContainerRef: React.RefObject<HTMLDivElement | null>;
123
- }
124
-
125
- export function usesPersonalPlacement(task: Task) {
126
- return isPersonalExternalOverlayTask(task);
127
- }
128
-
129
- export function getPersonalPlacementTargetBoardId({
130
- boardId,
131
- columns,
132
- targetListId,
133
- }: {
134
- boardId: string | null;
135
- columns: Pick<TaskList, 'board_id' | 'id'>[];
136
- targetListId: string;
137
- }) {
138
- const stagingBoardId = getPersonalExternalStagingBoardId(targetListId);
139
- if (stagingBoardId) return stagingBoardId;
140
-
141
- return (
142
- columns.find((column) => column.id === targetListId)?.board_id ?? boardId
143
- );
144
- }
145
-
146
- function getTaskDropPosition(
147
- event: DragMoveEvent | DragEndEvent,
148
- pointerY?: number | null,
149
- dragSession?: DragSessionMetrics | null
150
- ) {
151
- return getTaskDropPositionFromRects({
152
- activeRect: getActiveDragRect(event, dragSession),
153
- overRect: event.over?.rect,
154
- pointerY,
155
- });
156
- }
157
-
158
- function getActiveDragRect(
159
- event: DragMoveEvent | DragEndEvent,
160
- dragSession?: DragSessionMetrics | null
161
- ) {
162
- const translatedRect = event.active.rect.current.translated;
163
- const fallbackRect = translatedRect ?? event.active.rect.current.initial;
164
-
165
- return getFrozenActiveRectFromDelta({
166
- deltaY: event.delta?.y,
167
- dragSession,
168
- fallbackRect: fallbackRect
169
- ? {
170
- height: fallbackRect.height,
171
- top: fallbackRect.top,
172
- }
173
- : null,
174
- translatedRect: translatedRect
175
- ? {
176
- height: translatedRect.height,
177
- top: translatedRect.top,
178
- }
179
- : null,
180
- });
181
- }
182
-
183
- function getVisibleTaskRectsForList(
184
- listId: string,
185
- originalIndexesByTaskId?: Map<string, number>
186
- ) {
187
- if (typeof document === 'undefined') {
188
- return [];
189
- }
190
-
191
- const selector =
192
- typeof CSS !== 'undefined' && typeof CSS.escape === 'function'
193
- ? `[data-task-card-id][data-task-list-id="${CSS.escape(listId)}"]`
194
- : '[data-task-card-id][data-task-list-id]';
195
-
196
- return Array.from(document.querySelectorAll<HTMLElement>(selector))
197
- .filter((element) => element.dataset.taskListId === listId)
198
- .map((element) => {
199
- const rect = element.getBoundingClientRect();
200
-
201
- return {
202
- taskId: element.dataset.taskCardId ?? '',
203
- originalIndex:
204
- originalIndexesByTaskId?.get(element.dataset.taskCardId ?? '') ??
205
- Number.MAX_SAFE_INTEGER,
206
- top: rect.top,
207
- height: rect.height,
208
- width: rect.width,
209
- };
210
- })
211
- .filter((rect) => rect.taskId && rect.height > 0 && rect.width > 0)
212
- .sort((a, b) => {
213
- const indexA = a.originalIndex ?? Number.MAX_SAFE_INTEGER;
214
- const indexB = b.originalIndex ?? Number.MAX_SAFE_INTEGER;
215
-
216
- if (indexA !== indexB) {
217
- return indexA - indexB;
218
- }
219
-
220
- return a.top - b.top;
221
- });
222
- }
223
-
224
- function getProjectedTaskDropOrder({
225
- activeTask,
226
- event,
227
- isCompletionList,
228
- latestDragPreviewPosition,
229
- overId,
230
- overType,
231
- pointerY,
232
- targetListTasks,
233
- dragSession,
234
- }: {
235
- activeTask: Task;
236
- dragSession?: DragSessionMetrics | null;
237
- event: DragMoveEvent | DragEndEvent;
238
- isCompletionList: boolean;
239
- latestDragPreviewPosition: DragPreviewPosition | null;
240
- overId: string;
241
- overType: unknown;
242
- pointerY?: number | null;
243
- targetListTasks: Task[];
244
- }) {
245
- const targetListTasksWithoutActive = targetListTasks.filter(
246
- (task) => task.id !== activeTask.id
247
- );
248
-
249
- if (isCompletionList || overType === 'Column') {
250
- return [activeTask, ...targetListTasksWithoutActive];
251
- }
252
-
253
- if (latestDragPreviewPosition) {
254
- return insertTaskAtInsertionIndex({
255
- activeTask,
256
- insertionIndex: latestDragPreviewPosition.insertionIndex,
257
- targetListTasks,
258
- });
259
- }
260
-
261
- const overIndex = targetListTasksWithoutActive.findIndex(
262
- (task) => task.id === overId
263
- );
264
-
265
- if (overIndex === -1) {
266
- return [...targetListTasksWithoutActive, activeTask];
267
- }
268
-
269
- return insertTaskAtDropPosition({
270
- activeTask,
271
- overTaskId: overId,
272
- position: getTaskDropPosition(event, pointerY, dragSession),
273
- targetListTasks,
274
- });
275
- }
276
-
277
- export function useKanbanDnd({
278
- wsId,
279
- boardId,
280
- columns,
281
- tasks,
282
- disableSort,
283
- selectedTasks,
284
- isMultiSelectMode,
285
- clearSelection,
286
- persistListPositions,
287
- invalidColumnMoveMessage,
288
- invalidExternalStagingMoveMessage,
289
- personalPlacementUpdateFailedMessage,
290
- reorderTaskMutation,
291
- taskHeightsRef,
292
- scrollContainerRef,
293
- }: UseKanbanDndProps) {
294
- const broadcast = useBoardBroadcast();
295
- const [activeColumn, setActiveColumn] = useState<TaskList | null>(null);
296
- const [activeTask, setActiveTask] = useState<Task | null>(null);
297
- const [hoverTargetListId, setHoverTargetListId] = useState<string | null>(
298
- null
299
- );
300
- const [dragPreviewPosition, setDragPreviewPositionState] =
301
- useState<DragPreviewPosition | null>(null);
302
- const [optimisticUpdateInProgress, setOptimisticUpdateInProgress] = useState<
303
- Set<string>
304
- >(new Set());
305
-
306
- // Refs for drag state
307
- const pickedUpTaskColumn = useRef<string | null>(null);
308
- const isDraggingRef = useRef(false);
309
- const lastTargetListIdRef = useRef<string | null>(null);
310
- const dragPreviewPositionRef = useRef<DragPreviewPosition | null>(null);
311
- const dragStartCacheRef = useRef<DragCacheSnapshot | null>(null);
312
- const taskRectsCacheRef = useRef<Map<string, TaskRect[]>>(new Map());
313
- const dragSessionMetricsRef = useRef<DragSessionMetrics | null>(null);
314
- const dragStartTaskIndexesByListRef = useRef<
315
- Map<string, Map<string, number>>
316
- >(new Map());
317
-
318
- const setDragPreviewPosition = useCallback(
319
- (position: DragPreviewPosition | null) => {
320
- if (dragPreviewPositionsEqual(dragPreviewPositionRef.current, position)) {
321
- return;
322
- }
323
-
324
- dragPreviewPositionRef.current = position;
325
- setDragPreviewPositionState(position);
326
- },
327
- []
328
- );
329
-
330
- const queryClient = useQueryClient();
331
- const getCachedVisibleTaskRects = useCallback((listId: string) => {
332
- const cached = taskRectsCacheRef.current.get(listId);
333
- if (cached) return cached;
334
-
335
- const rects = getVisibleTaskRectsForList(
336
- listId,
337
- dragStartTaskIndexesByListRef.current.get(listId)
338
- );
339
- taskRectsCacheRef.current.set(listId, rects);
340
-
341
- return rects;
342
- }, []);
343
-
344
- const getDragPreviewForList = useCallback(
345
- ({
346
- activeRect,
347
- activeTask,
348
- listId,
349
- preferEnd,
350
- }: {
351
- activeRect: VerticalRect | null;
352
- activeTask: Task;
353
- listId: string;
354
- preferEnd?: boolean;
355
- }) => {
356
- const dragSession = dragSessionMetricsRef.current;
357
- const height =
358
- dragSession?.activeTaskId === activeTask.id
359
- ? dragSession.height
360
- : (taskHeightsRef.current.get(activeTask.id) ?? 96);
361
- const visibleTaskRects = getCachedVisibleTaskRects(listId);
362
- const preview = preferEnd
363
- ? getTaskDropEndPreviewFromRects({
364
- activeTask,
365
- height,
366
- listId,
367
- rects: visibleTaskRects,
368
- })
369
- : getTaskDropPreviewFromRects({
370
- activeRect,
371
- activeTask,
372
- dragSession,
373
- height,
374
- listId,
375
- rects: visibleTaskRects,
376
- });
377
-
378
- if (
379
- dragSession?.activeTaskId === activeTask.id &&
380
- dragSession.sourceListId === preview.listId &&
381
- dragSession.sourceInsertionIndex === preview.insertionIndex
382
- ) {
383
- return null;
384
- }
385
-
386
- return preview;
387
- },
388
- [getCachedVisibleTaskRects, taskHeightsRef]
389
- );
390
-
391
- const getDragPreviewForListSurface = useCallback(
392
- ({
393
- activeRect,
394
- activeTask,
395
- listId,
396
- }: {
397
- activeRect: VerticalRect | null;
398
- activeTask: Task;
399
- listId: string;
400
- }) => {
401
- const dragSession = dragSessionMetricsRef.current;
402
- const height =
403
- dragSession?.activeTaskId === activeTask.id
404
- ? dragSession.height
405
- : (taskHeightsRef.current.get(activeTask.id) ?? 96);
406
- const visibleTaskRects = getCachedVisibleTaskRects(listId);
407
- const preview = getTaskDropPreviewFromListSurface({
408
- activeRect,
409
- activeTask,
410
- dragSession,
411
- height,
412
- listId,
413
- rects: visibleTaskRects,
414
- });
415
-
416
- if (
417
- dragSession?.activeTaskId === activeTask.id &&
418
- dragSession.sourceListId === preview.listId &&
419
- dragSession.sourceInsertionIndex === preview.insertionIndex
420
- ) {
421
- return null;
422
- }
423
-
424
- return preview;
425
- },
426
- [getCachedVisibleTaskRects, taskHeightsRef]
427
- );
428
-
429
- const restoreDragStartCache = useCallback(() => {
430
- if (!boardId || !dragStartCacheRef.current) return;
431
-
432
- if (dragStartCacheRef.current.tasks) {
433
- queryClient.setQueryData(
434
- ['tasks', boardId],
435
- dragStartCacheRef.current.tasks
436
- );
437
- }
438
-
439
- if (dragStartCacheRef.current.fullTasks) {
440
- queryClient.setQueryData(
441
- ['tasks-full', boardId],
442
- dragStartCacheRef.current.fullTasks
443
- );
444
- }
445
- }, [boardId, queryClient]);
446
-
447
- const movePersonalPlacementTask = useCallback(
448
- async (
449
- task: Task,
450
- targetListId: string,
451
- newSortKey: number | null,
452
- order?: {
453
- previousTaskId?: string | null;
454
- nextTaskId?: string | null;
455
- }
456
- ): Promise<Task> => {
457
- if (!boardId) {
458
- throw new Error('Board ID is required');
459
- }
460
-
461
- const stagingBoardId = getPersonalExternalStagingBoardId(targetListId);
462
- const targetBoardId = getPersonalPlacementTargetBoardId({
463
- boardId,
464
- columns,
465
- targetListId,
466
- });
467
- if (!targetBoardId) {
468
- throw new Error('Board ID is required');
469
- }
470
- const isStagingTarget = stagingBoardId !== null;
471
- const targetList = columns.find((column) => column.id === targetListId);
472
- const terminalStatus =
473
- targetList?.status === 'done' || targetList?.status === 'closed'
474
- ? targetList.status
475
- : undefined;
476
- const nextTask = {
477
- ...task,
478
- list_id: isStagingTarget
479
- ? getPersonalExternalStagingListId(targetBoardId)
480
- : targetListId,
481
- sort_key: isStagingTarget ? null : newSortKey,
482
- personal_board_id: targetBoardId,
483
- personal_list_id: isStagingTarget ? null : targetListId,
484
- personal_sort_key: isStagingTarget ? null : newSortKey,
485
- personal_placed_at: isStagingTarget ? null : new Date().toISOString(),
486
- is_personal_external: true,
487
- is_personal_external_default: isStagingTarget,
488
- _localMutationAt: Date.now(),
489
- } as Task & { _localMutationAt: number };
490
-
491
- const previousTasks = queryClient.getQueryData<Task[]>([
492
- 'tasks',
493
- boardId,
494
- ]);
495
- const previousFullTasks = queryClient.getQueryData<Task[]>([
496
- 'tasks-full',
497
- boardId,
498
- ]);
499
- const previousTask = previousTasks?.find((item) => item.id === task.id);
500
- const previousFullTask = previousFullTasks?.find(
501
- (item) => item.id === task.id
502
- );
503
-
504
- setBoardTaskCache(queryClient, boardId, nextTask);
505
-
506
- try {
507
- const response = isStagingTarget
508
- ? null
509
- : await upsertCurrentUserTaskPersonalPlacement(task.id, {
510
- personal_board_id: targetBoardId,
511
- personal_list_id: targetListId,
512
- personal_sort_key: newSortKey,
513
- previous_task_id: order?.previousTaskId ?? null,
514
- next_task_id: order?.nextTaskId ?? null,
515
- terminal_status: terminalStatus,
516
- });
517
-
518
- if (isStagingTarget) {
519
- await removeCurrentUserTaskPersonalPlacement(task.id);
520
- }
521
-
522
- const savedTask = mergePersonalPlacementMutationTask(
523
- task,
524
- nextTask,
525
- response?.task,
526
- isStagingTarget
527
- );
528
-
529
- setBoardTaskCache(queryClient, boardId, savedTask);
530
-
531
- return savedTask;
532
- } catch (error) {
533
- const restoreTaskInCache = (
534
- queryKey: unknown[],
535
- previousTaskValue: Task | undefined,
536
- previousCache: Task[] | undefined
537
- ) => {
538
- queryClient.setQueryData<Task[]>(queryKey, (currentTasks) => {
539
- if (!currentTasks) return previousCache;
540
-
541
- if (
542
- !hasTaskLocalMutationAt(
543
- currentTasks,
544
- task.id,
545
- nextTask._localMutationAt
546
- )
547
- ) {
548
- return currentTasks;
549
- }
550
-
551
- if (!previousTaskValue) {
552
- return currentTasks.filter((item) => item.id !== task.id);
553
- }
554
-
555
- const hasTask = currentTasks.some((item) => item.id === task.id);
556
- if (!hasTask) return [...currentTasks, previousTaskValue];
557
-
558
- return currentTasks.map((item) =>
559
- item.id === task.id ? previousTaskValue : item
560
- );
561
- });
562
- };
563
-
564
- restoreTaskInCache(['tasks', boardId], previousTask, previousTasks);
565
- restoreTaskInCache(
566
- ['tasks-full', boardId],
567
- previousFullTask,
568
- previousFullTasks
569
- );
570
- throw error;
571
- }
572
- },
573
- [boardId, columns, queryClient]
574
- );
575
-
576
- // Use the extracted calculateSortKeyWithRetry helper
577
- const calculateSortKeyWithRetry = useCallback(
578
- (
579
- prevSortKey: number | null | undefined,
580
- nextSortKey: number | null | undefined,
581
- listId: string,
582
- visualOrderTasks?: Pick<Task, 'id' | 'sort_key' | 'created_at'>[]
583
- ) => {
584
- if (!wsId) {
585
- return Promise.reject(new Error('Workspace ID is required'));
586
- }
587
-
588
- return createCalculateSortKeyWithRetry(
589
- wsId,
590
- prevSortKey,
591
- nextSortKey,
592
- listId,
593
- visualOrderTasks
594
- );
595
- },
596
- [wsId]
597
- );
598
-
599
- const { startAutoScroll, stopAutoScroll, updateAutoScrollPointerX } =
600
- useAutoScroll(scrollContainerRef);
601
-
602
- const updateAutoScrollFromDragEvent = useCallback(
603
- (event: DragMoveEvent | DragOverEvent | DragStartEvent) => {
604
- updateAutoScrollPointerX(getKanbanDragAutoScrollPointerX(event));
605
- },
606
- [updateAutoScrollPointerX]
607
- );
608
-
609
- const resetDragState = useCallback(
610
- (clearOptimisticUpdates = false) => {
611
- setActiveColumn(null);
612
- setActiveTask(null);
613
- setHoverTargetListId(null);
614
- setDragPreviewPosition(null);
615
- pickedUpTaskColumn.current = null;
616
- lastTargetListIdRef.current = null;
617
- dragStartCacheRef.current = null;
618
- taskRectsCacheRef.current.clear();
619
- dragSessionMetricsRef.current = null;
620
- dragStartTaskIndexesByListRef.current.clear();
621
- isDraggingRef.current = false;
622
- stopAutoScroll();
623
-
624
- if (clearOptimisticUpdates) {
625
- setOptimisticUpdateInProgress(new Set());
626
- }
627
- },
628
- [setDragPreviewPosition, stopAutoScroll]
629
- );
630
-
631
- const markTaskIdsPending = useCallback((taskIds: string[]) => {
632
- if (taskIds.length === 0) return;
633
-
634
- setOptimisticUpdateInProgress((prev) => addPendingTaskIds(prev, taskIds));
635
- }, []);
636
-
637
- const clearPendingTaskIds = useCallback((taskIds: string[]) => {
638
- if (taskIds.length === 0) return;
639
-
640
- setOptimisticUpdateInProgress((prev) =>
641
- removePendingTaskIds(prev, taskIds)
642
- );
643
- }, []);
644
-
645
- const processTaskDragPreview = useCallback(
646
- (event: DragMoveEvent) => {
647
- updateAutoScrollFromDragEvent(event);
648
-
649
- const { active, over } = event;
650
- const activeType = active.data?.current?.type;
651
- if (!activeType) return;
652
-
653
- if (activeType === 'Task') {
654
- if (!wsId) {
655
- setHoverTargetListId(null);
656
- setDragPreviewPosition(null);
657
- return;
658
- }
659
-
660
- const activeTask = active.data?.current?.task;
661
- if (!activeTask) return;
662
-
663
- if (!over) {
664
- const targetListId = String(
665
- dragPreviewPositionRef.current?.listId ??
666
- lastTargetListIdRef.current ??
667
- pickedUpTaskColumn.current ??
668
- activeTask.list_id
669
- );
670
- const targetListExists = columns.some(
671
- (col) => String(col.id) === targetListId
672
- );
673
-
674
- if (!targetListExists) {
675
- setHoverTargetListId(null);
676
- setDragPreviewPosition(null);
677
- return;
678
- }
679
-
680
- const nextPreviewPosition = getDragPreviewForListSurface({
681
- activeRect: getActiveDragRect(event, dragSessionMetricsRef.current),
682
- activeTask,
683
- listId: targetListId,
684
- });
685
-
686
- setDragPreviewPosition(nextPreviewPosition);
687
- setHoverTargetListId((current) =>
688
- current === targetListId ? current : targetListId
689
- );
690
- lastTargetListIdRef.current = targetListId;
691
- return;
692
- }
693
-
694
- let targetListId: string;
695
- const overType = over.data?.current?.type;
696
- let nextPreviewPosition: DragPreviewPosition | null = null;
697
- const dragSession = dragSessionMetricsRef.current;
698
- const activeRect = getActiveDragRect(event, dragSession);
699
-
700
- if (overType === 'Column') {
701
- targetListId = String(over.id);
702
- nextPreviewPosition = getDragPreviewForListSurface({
703
- activeRect,
704
- activeTask,
705
- listId: targetListId,
706
- });
707
- setDragPreviewPosition(nextPreviewPosition);
708
- } else if (overType === 'Task') {
709
- if (String(over.id) === String(active.id)) {
710
- const overTask = over.data?.current?.task as Task | undefined;
711
- const currentPreview = dragPreviewPositionRef.current;
712
- targetListId = String(
713
- overTask?.list_id ?? currentPreview?.listId ?? activeTask.list_id
714
- );
715
- nextPreviewPosition = getDragPreviewForList({
716
- activeRect,
717
- activeTask,
718
- listId: targetListId,
719
- });
720
- setDragPreviewPosition(nextPreviewPosition);
721
- } else {
722
- const overTask = over.data?.current?.task as Task | undefined;
723
- if (!overTask) return;
724
- targetListId = String(overTask.list_id);
725
- nextPreviewPosition = getDragPreviewForList({
726
- activeRect,
727
- activeTask,
728
- listId: targetListId,
729
- });
730
- setDragPreviewPosition(nextPreviewPosition);
731
- }
732
- } else if (overType === 'ColumnSurface') {
733
- const columnId = over.data?.current?.columnId || over.id;
734
- if (!columnId) return;
735
- targetListId = String(columnId);
736
- nextPreviewPosition = getDragPreviewForListSurface({
737
- activeRect,
738
- activeTask,
739
- listId: targetListId,
740
- });
741
- setDragPreviewPosition(nextPreviewPosition);
742
- } else {
743
- return;
744
- }
745
-
746
- const originalListId = pickedUpTaskColumn.current;
747
- if (!originalListId) return;
748
-
749
- const sourceListExists = columns.some(
750
- (col) => String(col.id) === originalListId
751
- );
752
- const targetListExists = columns.some(
753
- (col) => String(col.id) === targetListId
754
- );
755
-
756
- if (!sourceListExists || !targetListExists) return;
757
-
758
- // Skip if target list unchanged for current drag set to avoid redundant cache writes
759
- if (lastTargetListIdRef.current === targetListId) {
760
- return;
761
- }
762
- lastTargetListIdRef.current = targetListId;
763
- setHoverTargetListId((current) =>
764
- current === targetListId ? current : targetListId
765
- );
766
- }
767
- },
768
- [
769
- columns,
770
- getDragPreviewForList,
771
- getDragPreviewForListSurface,
772
- setDragPreviewPosition,
773
- updateAutoScrollFromDragEvent,
774
- wsId,
775
- ]
776
- );
777
-
778
- // Capture drag start card left position
779
- function onDragStart(event: DragStartEvent) {
780
- if (!hasDraggableData(event.active)) return;
781
- const { active } = event;
782
- if (!active.data?.current) return;
783
-
784
- // Enable auto-scroll
785
- isDraggingRef.current = true;
786
- updateAutoScrollFromDragEvent(event);
787
- startAutoScroll();
788
-
789
- const { type } = active.data.current;
790
- if (type === 'Column') {
791
- setActiveColumn(active.data.current.column);
792
- return;
793
- }
794
- if (type === 'Task') {
795
- if (!wsId) {
796
- resetDragState(true);
797
- return;
798
- }
799
-
800
- const task = active.data.current.task;
801
-
802
- if (boardId) {
803
- dragStartCacheRef.current = {
804
- tasks: queryClient.getQueryData<Task[]>(['tasks', boardId]),
805
- fullTasks: queryClient.getQueryData<Task[]>(['tasks-full', boardId]),
806
- };
807
- } else {
808
- dragStartCacheRef.current = null;
809
- }
810
- taskRectsCacheRef.current.clear();
811
- dragStartTaskIndexesByListRef.current.clear();
812
-
813
- const dragStartTasks = dragStartCacheRef.current?.tasks ?? tasks;
814
- for (const column of columns) {
815
- const orderedListTasks = sortTasksForList({
816
- disableSort,
817
- targetList: column,
818
- tasks: dragStartTasks.filter(
819
- (item) => String(item.list_id) === String(column.id)
820
- ),
821
- });
822
- dragStartTaskIndexesByListRef.current.set(
823
- String(column.id),
824
- new Map(orderedListTasks.map((item, index) => [item.id, index]))
825
- );
826
- }
827
-
828
- const sourceListId = String(task.list_id);
829
- const sourceList = columns.find(
830
- (column) => String(column.id) === sourceListId
831
- );
832
- const sourceTasks = sortTasksForList({
833
- disableSort,
834
- targetList: sourceList,
835
- tasks: dragStartTasks.filter(
836
- (item) => String(item.list_id) === sourceListId
837
- ),
838
- });
839
- const sourceInsertionIndex = Math.max(
840
- 0,
841
- sourceTasks.findIndex((item) => item.id === task.id)
842
- );
843
- const initialRect = event.active.rect.current.initial
844
- ? {
845
- height: event.active.rect.current.initial.height,
846
- top: event.active.rect.current.initial.top,
847
- }
848
- : null;
849
- const activeHeight =
850
- initialRect?.height || taskHeightsRef.current.get(task.id) || 96;
851
- dragSessionMetricsRef.current = {
852
- activeInitialRect: initialRect,
853
- activeTaskId: task.id,
854
- height: Math.max(1, Math.round(activeHeight)),
855
- sourceInsertionIndex,
856
- sourceListId,
857
- };
858
-
859
- // If this is a multi-select drag, include all selected tasks
860
- if (isMultiSelectMode && selectedTasks.has(task.id)) {
861
- setActiveTask(task); // Set the dragged task as active for overlay
862
- } else {
863
- setActiveTask(task);
864
- }
865
-
866
- pickedUpTaskColumn.current = sourceListId;
867
- lastTargetListIdRef.current = sourceListId;
868
- setHoverTargetListId(sourceListId);
869
- return;
870
- }
871
- }
872
-
873
- function onDragOver(event: DragOverEvent) {
874
- processTaskDragPreview(event);
875
- }
876
-
877
- function onDragMove(event: DragMoveEvent) {
878
- processTaskDragPreview(event);
879
- }
880
-
881
- async function onDragEnd(event: DragEndEvent) {
882
- const { active, over } = event;
883
-
884
- // Store the original list ID before resetting drag state
885
- const originalListId = pickedUpTaskColumn.current;
886
- const activeType = active.data?.current?.type;
887
-
888
- if (!over) {
889
- // Reset drag state only on invalid drop
890
- if (activeType === 'Task') {
891
- restoreDragStartCache();
892
- }
893
- resetDragState(true);
894
- return;
895
- }
896
-
897
- if (!activeType) {
898
- resetDragState(true);
899
- return;
900
- }
901
-
902
- if (activeType === 'Task' && !wsId) {
903
- restoreDragStartCache();
904
- resetDragState(true);
905
- return;
906
- }
907
-
908
- // Handle column reordering
909
- if (activeType === 'Column') {
910
- const activeColumn = active.data?.current?.column;
911
- const overColumn = over.data?.current?.column;
912
-
913
- if (activeColumn && overColumn && activeColumn.id !== overColumn.id) {
914
- if (
915
- activeColumn.is_external_staging ||
916
- overColumn.is_external_staging
917
- ) {
918
- resetDragState(true);
919
- return;
920
- }
921
-
922
- if (activeColumn.status !== overColumn.status) {
923
- toast.warning(
924
- invalidColumnMoveMessage ??
925
- 'Task lists can only be reordered within the same status group'
926
- );
927
- }
928
-
929
- const updates = getColumnReorderUpdates(
930
- columns,
931
- String(activeColumn.id),
932
- String(overColumn.id)
933
- );
934
-
935
- if (updates) {
936
- const previousLists = queryClient.getQueryData<TaskList[]>([
937
- 'task_lists',
938
- boardId,
939
- ]);
940
-
941
- queryClient.setQueryData(
942
- ['task_lists', boardId],
943
- (oldData: TaskList[] | undefined) => {
944
- if (!oldData) return oldData;
945
- return oldData.map((list) => {
946
- const update = updates.find((item) => item.listId === list.id);
947
- return update
948
- ? { ...list, position: update.newPosition }
949
- : list;
950
- });
951
- }
952
- );
953
-
954
- try {
955
- await persistListPositions(updates);
956
- } catch (error) {
957
- console.error('Failed to reorder list:', error);
958
- toast.error('Failed to reorder list');
959
-
960
- if (previousLists) {
961
- queryClient.setQueryData(['task_lists', boardId], previousLists);
962
- } else {
963
- queryClient.invalidateQueries({
964
- queryKey: ['task_lists', boardId],
965
- });
966
- }
967
- }
968
- }
969
- }
970
- setActiveColumn(null);
971
- setActiveTask(null);
972
- setHoverTargetListId(null);
973
- setDragPreviewPosition(null);
974
- pickedUpTaskColumn.current = null;
975
- lastTargetListIdRef.current = null;
976
- setOptimisticUpdateInProgress(new Set());
977
- return;
978
- }
979
-
980
- if (activeType === 'Task') {
981
- const activeTask = active.data?.current?.task;
982
- const resetTaskDragAfterInvalidDrop = () => {
983
- restoreDragStartCache();
984
- resetDragState(true);
985
- };
986
-
987
- if (!activeTask) {
988
- resetTaskDragAfterInvalidDrop();
989
- return;
990
- }
991
-
992
- const dragStartSnapshot = dragStartCacheRef.current ?? {
993
- tasks: boardId
994
- ? queryClient.getQueryData<Task[]>(['tasks', boardId])
995
- : undefined,
996
- fullTasks: boardId
997
- ? queryClient.getQueryData<Task[]>(['tasks-full', boardId])
998
- : undefined,
999
- };
1000
- const baseTasks = dragStartSnapshot.tasks ?? tasks;
1001
- const activeTaskForDrop =
1002
- baseTasks.find((task) => task.id === activeTask.id) ?? activeTask;
1003
-
1004
- let targetListId: string;
1005
- const overType = over.data?.current?.type;
1006
- const latestDragPreviewPosition = dragPreviewPositionRef.current;
1007
- const latestPreviewForActive =
1008
- latestDragPreviewPosition?.task.id === activeTask.id
1009
- ? latestDragPreviewPosition
1010
- : null;
1011
-
1012
- if (
1013
- !latestPreviewForActive &&
1014
- overType === 'Task' &&
1015
- String(over.id) === String(active.id)
1016
- ) {
1017
- restoreDragStartCache();
1018
- resetDragState(true);
1019
- return;
1020
- }
1021
-
1022
- if (latestPreviewForActive) {
1023
- targetListId = latestPreviewForActive.listId;
1024
- } else if (overType === 'Column') {
1025
- targetListId = String(over.id);
1026
- } else if (overType === 'Task') {
1027
- const targetTask = over.data?.current?.task;
1028
- if (!targetTask) {
1029
- resetTaskDragAfterInvalidDrop();
1030
- return;
1031
- }
1032
- targetListId = String(targetTask.list_id);
1033
- } else if (overType === 'ColumnSurface') {
1034
- const columnId = over.data?.current?.columnId || over.id;
1035
- if (!columnId) {
1036
- resetTaskDragAfterInvalidDrop();
1037
- return;
1038
- }
1039
- targetListId = String(columnId);
1040
- } else {
1041
- resetTaskDragAfterInvalidDrop();
1042
- return;
1043
- }
1044
-
1045
- if (!originalListId) {
1046
- resetTaskDragAfterInvalidDrop();
1047
- return;
1048
- }
1049
-
1050
- const sourceListExists = columns.some(
1051
- (col) => String(col.id) === originalListId
1052
- );
1053
- const targetListExists = columns.some(
1054
- (col) => String(col.id) === targetListId
1055
- );
1056
-
1057
- if (!sourceListExists || !targetListExists) {
1058
- resetTaskDragAfterInvalidDrop();
1059
- return;
1060
- }
1061
-
1062
- // Calculate target position based on drop location
1063
- // Get all tasks in the target list (INCLUDE the dragged task if it's in the same list)
1064
- let targetListTasks = baseTasks.filter((t) => t.list_id === targetListId);
1065
-
1066
- // Find the target list to check its status
1067
- const targetList = columns.find((col) => String(col.id) === targetListId);
1068
- const targetIsExternalStaging =
1069
- isPersonalExternalStagingListId(targetListId) ||
1070
- targetList?.is_external_staging === true;
1071
- const activeUsesPersonalPlacement =
1072
- usesPersonalPlacement(activeTaskForDrop);
1073
-
1074
- if (targetIsExternalStaging && !activeUsesPersonalPlacement) {
1075
- toast.warning(
1076
- invalidExternalStagingMoveMessage ??
1077
- 'Only external tasks can use the staging lane'
1078
- );
1079
- resetTaskDragAfterInvalidDrop();
1080
- return;
1081
- }
1082
-
1083
- // IMPORTANT: For "done" and "closed" lists, always place at first position (top)
1084
- const isCompletionList =
1085
- targetList?.status === 'done' || targetList?.status === 'closed';
1086
-
1087
- // Sort tasks from the drag-start snapshot so release persists exactly
1088
- // the same order shown in the live preview.
1089
- targetListTasks = sortTasksForList({
1090
- disableSort,
1091
- targetList,
1092
- tasks: targetListTasks,
1093
- });
1094
-
1095
- const isBulkTaskDrag = isMultiSelectMode && selectedTasks.size > 1;
1096
- const projectedDropOrder =
1097
- latestPreviewForActive && !isBulkTaskDrag
1098
- ? getProjectedTaskDropOrderFromPreview({
1099
- activeTask: activeTaskForDrop,
1100
- isCompletionList,
1101
- preview: latestPreviewForActive,
1102
- targetListTasks,
1103
- })
1104
- : getProjectedTaskDropOrder({
1105
- activeTask: activeTaskForDrop,
1106
- dragSession: dragSessionMetricsRef.current,
1107
- event,
1108
- isCompletionList,
1109
- latestDragPreviewPosition: latestPreviewForActive,
1110
- overId: String(over.id),
1111
- overType,
1112
- targetListTasks,
1113
- });
1114
- const currentTaskIndex = targetListTasks.findIndex(
1115
- (task) => task.id === activeTask.id
1116
- );
1117
- const projectedTaskIndex = projectedDropOrder.findIndex(
1118
- (task) => task.id === activeTaskForDrop.id
1119
- );
1120
- const dropChangesVisualOrder =
1121
- targetListId !== originalListId ||
1122
- (currentTaskIndex !== -1 && currentTaskIndex !== projectedTaskIndex);
1123
- const optimisticDropPreview =
1124
- dropChangesVisualOrder && !isBulkTaskDrag
1125
- ? applyTaskDropPreviewToCache({
1126
- activeTask: activeTaskForDrop,
1127
- boardId,
1128
- orderedTasks: projectedDropOrder,
1129
- queryClient,
1130
- snapshot: dragStartSnapshot,
1131
- targetList,
1132
- targetListId,
1133
- })
1134
- : null;
1135
-
1136
- const rollbackOptimisticDropPreview = () => {
1137
- if (!boardId || !optimisticDropPreview) return;
1138
-
1139
- if (optimisticDropPreview.previousTasks) {
1140
- const currentTasks = queryClient.getQueryData<Task[]>([
1141
- 'tasks',
1142
- boardId,
1143
- ]);
1144
-
1145
- if (
1146
- hasTaskLocalMutationAt(
1147
- currentTasks,
1148
- activeTaskForDrop.id,
1149
- optimisticDropPreview.localMutationAt
1150
- )
1151
- ) {
1152
- queryClient.setQueryData(
1153
- ['tasks', boardId],
1154
- optimisticDropPreview.previousTasks
1155
- );
1156
- }
1157
- }
1158
-
1159
- if (optimisticDropPreview.previousFullTasks) {
1160
- const currentFullTasks = queryClient.getQueryData<Task[]>([
1161
- 'tasks-full',
1162
- boardId,
1163
- ]);
1164
-
1165
- if (
1166
- hasTaskLocalMutationAt(
1167
- currentFullTasks,
1168
- activeTaskForDrop.id,
1169
- optimisticDropPreview.localMutationAt
1170
- )
1171
- ) {
1172
- queryClient.setQueryData(
1173
- ['tasks-full', boardId],
1174
- optimisticDropPreview.previousFullTasks
1175
- );
1176
- }
1177
- }
1178
- };
1179
-
1180
- let newSortKey: number | null;
1181
- let personalPlacementOrder:
1182
- | {
1183
- previousTaskId: string | null;
1184
- nextTaskId: string | null;
1185
- }
1186
- | undefined;
1187
- personalPlacementOrder = getNeighborTaskIds(
1188
- projectedDropOrder,
1189
- activeTaskForDrop.id
1190
- );
1191
-
1192
- if (targetIsExternalStaging) {
1193
- newSortKey = null;
1194
- } else if (typeof optimisticDropPreview?.previewSortKey === 'number') {
1195
- newSortKey = optimisticDropPreview.previewSortKey;
1196
- } else {
1197
- const newIndex = projectedTaskIndex;
1198
-
1199
- try {
1200
- if (projectedDropOrder.length === 1) {
1201
- newSortKey = await calculateSortKeyWithRetry(
1202
- null,
1203
- null,
1204
- targetListId,
1205
- projectedDropOrder
1206
- );
1207
- } else if (newIndex === 0) {
1208
- const nextTask = projectedDropOrder[1];
1209
- newSortKey = await calculateSortKeyWithRetry(
1210
- null,
1211
- nextTask ? getEffectiveTaskSortKey(nextTask) : null,
1212
- targetListId,
1213
- projectedDropOrder
1214
- );
1215
- } else if (newIndex === projectedDropOrder.length - 1) {
1216
- const prevTask = projectedDropOrder[projectedDropOrder.length - 2];
1217
- newSortKey = await calculateSortKeyWithRetry(
1218
- prevTask ? getEffectiveTaskSortKey(prevTask) : null,
1219
- null,
1220
- targetListId,
1221
- projectedDropOrder
1222
- );
1223
- } else {
1224
- const prevTask = projectedDropOrder[newIndex - 1];
1225
- const nextTask = projectedDropOrder[newIndex + 1];
1226
- newSortKey = await calculateSortKeyWithRetry(
1227
- prevTask ? getEffectiveTaskSortKey(prevTask) : null,
1228
- nextTask ? getEffectiveTaskSortKey(nextTask) : null,
1229
- targetListId,
1230
- projectedDropOrder
1231
- );
1232
- }
1233
- } catch (error) {
1234
- console.error('Failed to calculate sort key:', error);
1235
- rollbackOptimisticDropPreview();
1236
- resetDragState(true);
1237
- return;
1238
- }
1239
- }
1240
-
1241
- const needsUpdate =
1242
- dropChangesVisualOrder ||
1243
- (newSortKey !== null &&
1244
- (getEffectiveTaskSortKey(activeTaskForDrop) ??
1245
- MAX_SAFE_INTEGER_SORT) !== newSortKey);
1246
-
1247
- let shouldPreservePendingAfterDragReset = false;
1248
- const persistPersonalPlacementMove = (
1249
- task: Task,
1250
- sortKey: number | null,
1251
- order?: {
1252
- previousTaskId?: string | null;
1253
- nextTaskId?: string | null;
1254
- }
1255
- ) => {
1256
- const pendingTaskIds = [task.id];
1257
- markTaskIdsPending(pendingTaskIds);
1258
- shouldPreservePendingAfterDragReset = true;
1259
-
1260
- void movePersonalPlacementTask(task, targetListId, sortKey, order)
1261
- .then((updatedTask) => {
1262
- broadcast?.('task:upsert', {
1263
- task: {
1264
- id: updatedTask.id,
1265
- list_id: updatedTask.list_id,
1266
- sort_key: updatedTask.sort_key,
1267
- personal_sort_key: updatedTask.personal_sort_key,
1268
- completed_at: updatedTask.completed_at,
1269
- closed_at: updatedTask.closed_at,
1270
- },
1271
- });
1272
- void invalidateKanbanDeadlineTasks(queryClient, boardId);
1273
- })
1274
- .catch((error) => {
1275
- console.error('Failed to update personal task placement:', error);
1276
- rollbackOptimisticDropPreview();
1277
- toast.error(
1278
- personalPlacementUpdateFailedMessage ??
1279
- 'Failed to update personal task placement'
1280
- );
1281
- })
1282
- .finally(() => {
1283
- clearPendingTaskIds(pendingTaskIds);
1284
- });
1285
- };
1286
-
1287
- if (needsUpdate) {
1288
- if (isMultiSelectMode && selectedTasks.size > 1) {
1289
- const selectedTaskIds = Array.from(selectedTasks);
1290
- const selectedTaskObjects = selectedTaskIds
1291
- .map((taskId) => baseTasks.find((t) => t.id === taskId))
1292
- .filter((t): t is Task => t !== undefined);
1293
-
1294
- const sortedTasksToMove = selectedTaskObjects.sort(
1295
- compareTasksByEffectiveSortKey
1296
- );
1297
-
1298
- if (
1299
- targetIsExternalStaging &&
1300
- sortedTasksToMove.some((task) => !usesPersonalPlacement(task))
1301
- ) {
1302
- toast.warning(
1303
- invalidExternalStagingMoveMessage ??
1304
- 'Only external tasks can use the staging lane'
1305
- );
1306
- resetTaskDragAfterInvalidDrop();
1307
- return;
1308
- }
1309
-
1310
- const targetListTasksExcludingMoved = targetListTasks.filter(
1311
- (t) => !selectedTasks.has(t.id)
1312
- );
1313
-
1314
- let insertionIndex: number;
1315
- if (isCompletionList) {
1316
- insertionIndex = 0;
1317
- } else if (latestPreviewForActive?.listId === targetListId) {
1318
- insertionIndex = latestPreviewForActive.insertionIndex;
1319
- } else if (overType === 'Task') {
1320
- insertionIndex = getTaskInsertionIndex({
1321
- overTaskId: String(over.id),
1322
- position: getTaskDropPosition(
1323
- event,
1324
- undefined,
1325
- dragSessionMetricsRef.current
1326
- ),
1327
- tasks: targetListTasksExcludingMoved,
1328
- });
1329
- } else {
1330
- insertionIndex = targetListTasksExcludingMoved.length;
1331
- }
1332
-
1333
- const simulatedTargetList: Task[] = [
1334
- ...targetListTasksExcludingMoved.slice(0, insertionIndex),
1335
- ...sortedTasksToMove,
1336
- ...targetListTasksExcludingMoved.slice(insertionIndex),
1337
- ];
1338
-
1339
- try {
1340
- for (const task of sortedTasksToMove) {
1341
- if (targetIsExternalStaging) {
1342
- persistPersonalPlacementMove(task, null);
1343
- continue;
1344
- }
1345
-
1346
- let batchSortKey: number;
1347
- const positionInSimulated = simulatedTargetList.findIndex(
1348
- (t) => t.id === task.id
1349
- );
1350
-
1351
- if (simulatedTargetList.length === 1) {
1352
- batchSortKey = await calculateSortKeyWithRetry(
1353
- null,
1354
- null,
1355
- targetListId,
1356
- targetListTasks
1357
- );
1358
- } else if (positionInSimulated === 0) {
1359
- const nextTask = simulatedTargetList[1];
1360
- batchSortKey = await calculateSortKeyWithRetry(
1361
- null,
1362
- nextTask ? getEffectiveTaskSortKey(nextTask) : null,
1363
- targetListId,
1364
- targetListTasks
1365
- );
1366
- } else if (
1367
- positionInSimulated ===
1368
- simulatedTargetList.length - 1
1369
- ) {
1370
- const prevTask = simulatedTargetList[positionInSimulated - 1];
1371
- batchSortKey = await calculateSortKeyWithRetry(
1372
- prevTask ? getEffectiveTaskSortKey(prevTask) : null,
1373
- null,
1374
- targetListId,
1375
- targetListTasks
1376
- );
1377
- } else {
1378
- const prevTask = simulatedTargetList[positionInSimulated - 1];
1379
- const nextTask = simulatedTargetList[positionInSimulated + 1];
1380
-
1381
- const prevIsMoving = prevTask
1382
- ? selectedTasks.has(prevTask.id)
1383
- : false;
1384
- const nextIsMoving = nextTask
1385
- ? selectedTasks.has(nextTask.id)
1386
- : false;
1387
-
1388
- if (!prevIsMoving && !nextIsMoving) {
1389
- batchSortKey = await calculateSortKeyWithRetry(
1390
- prevTask ? getEffectiveTaskSortKey(prevTask) : null,
1391
- nextTask ? getEffectiveTaskSortKey(nextTask) : null,
1392
- targetListId,
1393
- targetListTasks
1394
- );
1395
- } else if (prevIsMoving && !nextIsMoving) {
1396
- let stationaryPrev: Task | undefined;
1397
- for (let i = positionInSimulated - 1; i >= 0; i--) {
1398
- const currentTask = simulatedTargetList[i];
1399
- if (currentTask && !selectedTasks.has(currentTask.id)) {
1400
- stationaryPrev = currentTask;
1401
- break;
1402
- }
1403
- }
1404
- batchSortKey = await calculateSortKeyWithRetry(
1405
- stationaryPrev
1406
- ? getEffectiveTaskSortKey(stationaryPrev)
1407
- : null,
1408
- nextTask ? getEffectiveTaskSortKey(nextTask) : null,
1409
- targetListId,
1410
- targetListTasks
1411
- );
1412
- } else if (!prevIsMoving && nextIsMoving) {
1413
- let stationaryNext: Task | undefined;
1414
- for (
1415
- let i = positionInSimulated + 1;
1416
- i < simulatedTargetList.length;
1417
- i++
1418
- ) {
1419
- const currentTask = simulatedTargetList[i];
1420
- if (currentTask && !selectedTasks.has(currentTask.id)) {
1421
- stationaryNext = currentTask;
1422
- break;
1423
- }
1424
- }
1425
- batchSortKey = await calculateSortKeyWithRetry(
1426
- prevTask ? getEffectiveTaskSortKey(prevTask) : null,
1427
- stationaryNext
1428
- ? getEffectiveTaskSortKey(stationaryNext)
1429
- : null,
1430
- targetListId,
1431
- targetListTasks
1432
- );
1433
- } else {
1434
- let boundaryPrev: Task | undefined;
1435
- let boundaryNext: Task | undefined;
1436
-
1437
- for (let i = positionInSimulated - 1; i >= 0; i--) {
1438
- const currentTask = simulatedTargetList[i];
1439
- if (currentTask && !selectedTasks.has(currentTask.id)) {
1440
- boundaryPrev = currentTask;
1441
- break;
1442
- }
1443
- }
1444
-
1445
- for (
1446
- let i = positionInSimulated + 1;
1447
- i < simulatedTargetList.length;
1448
- i++
1449
- ) {
1450
- const currentTask = simulatedTargetList[i];
1451
- if (currentTask && !selectedTasks.has(currentTask.id)) {
1452
- boundaryNext = currentTask;
1453
- break;
1454
- }
1455
- }
1456
-
1457
- batchSortKey = await calculateSortKeyWithRetry(
1458
- boundaryPrev ? getEffectiveTaskSortKey(boundaryPrev) : null,
1459
- boundaryNext ? getEffectiveTaskSortKey(boundaryNext) : null,
1460
- targetListId,
1461
- targetListTasks
1462
- );
1463
- }
1464
- }
1465
-
1466
- if (usesPersonalPlacement(task)) {
1467
- persistPersonalPlacementMove(task, batchSortKey);
1468
- } else {
1469
- const pendingTaskIds = [task.id];
1470
- markTaskIdsPending(pendingTaskIds);
1471
- shouldPreservePendingAfterDragReset = true;
1472
-
1473
- reorderTaskMutation.mutate(
1474
- {
1475
- taskId: task.id,
1476
- newListId: targetListId,
1477
- newSortKey: batchSortKey,
1478
- },
1479
- {
1480
- onSuccess: (updatedTask: Task) => {
1481
- broadcast?.('task:upsert', {
1482
- task: {
1483
- id: updatedTask.id,
1484
- list_id: updatedTask.list_id,
1485
- sort_key: updatedTask.sort_key,
1486
- completed_at: updatedTask.completed_at,
1487
- closed_at: updatedTask.closed_at,
1488
- },
1489
- });
1490
- void invalidateKanbanDeadlineTasks(queryClient, boardId);
1491
- },
1492
- onSettled: () => {
1493
- clearPendingTaskIds(pendingTaskIds);
1494
- },
1495
- }
1496
- );
1497
- }
1498
- }
1499
- } catch (error) {
1500
- console.error(
1501
- 'Failed to calculate sort keys for batch move:',
1502
- error
1503
- );
1504
- resetTaskDragAfterInvalidDrop();
1505
- return;
1506
- }
1507
-
1508
- clearSelection();
1509
- } else {
1510
- if (activeUsesPersonalPlacement || targetIsExternalStaging) {
1511
- persistPersonalPlacementMove(
1512
- activeTaskForDrop,
1513
- newSortKey,
1514
- personalPlacementOrder
1515
- );
1516
- } else {
1517
- const repairedTaskSortKeys =
1518
- optimisticDropPreview?.repairedTaskSortKeys ?? [];
1519
- const pendingTaskIds = getPendingTaskIdsForDrop({
1520
- activeTaskId: activeTaskForDrop.id,
1521
- repairedTaskSortKeys,
1522
- });
1523
- markTaskIdsPending(pendingTaskIds);
1524
- shouldPreservePendingAfterDragReset = true;
1525
-
1526
- const handleReorderSuccess = (updatedTask: Task) => {
1527
- broadcast?.('task:upsert', {
1528
- task: {
1529
- id: updatedTask.id,
1530
- list_id: updatedTask.list_id,
1531
- sort_key: updatedTask.sort_key,
1532
- completed_at: updatedTask.completed_at,
1533
- closed_at: updatedTask.closed_at,
1534
- },
1535
- });
1536
- void invalidateKanbanDeadlineTasks(queryClient, boardId);
1537
- };
1538
-
1539
- if (repairedTaskSortKeys.length > 0) {
1540
- void (async () => {
1541
- try {
1542
- const repairTaskById = new Map<string, Task>();
1543
- for (const task of [
1544
- ...baseTasks,
1545
- ...(optimisticDropPreview?.previousTasks ?? []),
1546
- ...(optimisticDropPreview?.previousFullTasks ?? []),
1547
- ]) {
1548
- repairTaskById.set(task.id, task);
1549
- }
1550
-
1551
- const results = await Promise.allSettled(
1552
- repairedTaskSortKeys.map(async (repair) => {
1553
- const repairTask = repairTaskById.get(repair.taskId);
1554
-
1555
- if (repairTask && usesPersonalPlacement(repairTask)) {
1556
- const updatedTask = await movePersonalPlacementTask(
1557
- repairTask,
1558
- repair.listId,
1559
- repair.sortKey
1560
- );
1561
- broadcast?.('task:upsert', {
1562
- task: {
1563
- id: updatedTask.id,
1564
- list_id: updatedTask.list_id,
1565
- sort_key: updatedTask.sort_key,
1566
- personal_sort_key: updatedTask.personal_sort_key,
1567
- completed_at: updatedTask.completed_at,
1568
- closed_at: updatedTask.closed_at,
1569
- },
1570
- });
1571
- return updatedTask;
1572
- }
1573
-
1574
- return reorderTaskMutation.mutateAsync(
1575
- {
1576
- taskId: repair.taskId,
1577
- newListId: repair.listId,
1578
- newSortKey: repair.sortKey,
1579
- optimisticPreviousFullTasks:
1580
- optimisticDropPreview?.previousFullTasks,
1581
- optimisticPreviousTasks:
1582
- optimisticDropPreview?.previousTasks,
1583
- },
1584
- {
1585
- onSuccess: handleReorderSuccess,
1586
- }
1587
- );
1588
- })
1589
- );
1590
- const failedResults = results.filter(
1591
- (result) => result.status === 'rejected'
1592
- );
1593
-
1594
- if (failedResults.length === 0) {
1595
- void invalidateKanbanDeadlineTasks(queryClient, boardId);
1596
- return;
1597
- }
1598
-
1599
- console.error(
1600
- 'Failed to persist repaired task sort keys:',
1601
- failedResults
1602
- );
1603
- rollbackOptimisticDropPreview();
1604
- if (boardId) {
1605
- void queryClient.invalidateQueries({
1606
- queryKey: ['tasks', boardId],
1607
- });
1608
- void queryClient.invalidateQueries({
1609
- queryKey: ['tasks-full', boardId],
1610
- });
1611
- }
1612
- toast.error('Failed to reorder task');
1613
- } finally {
1614
- clearPendingTaskIds(pendingTaskIds);
1615
- }
1616
- })();
1617
- } else {
1618
- reorderTaskMutation.mutate(
1619
- {
1620
- taskId: activeTaskForDrop.id,
1621
- newListId: targetListId,
1622
- newSortKey: newSortKey ?? MAX_SAFE_INTEGER_SORT,
1623
- optimisticPreviousFullTasks:
1624
- optimisticDropPreview?.previousFullTasks,
1625
- optimisticPreviousTasks: optimisticDropPreview?.previousTasks,
1626
- },
1627
- {
1628
- onSuccess: handleReorderSuccess,
1629
- onSettled: () => {
1630
- clearPendingTaskIds(pendingTaskIds);
1631
- },
1632
- }
1633
- );
1634
- }
1635
- }
1636
- }
1637
-
1638
- requestAnimationFrame(() => {
1639
- resetDragState(!shouldPreservePendingAfterDragReset);
1640
- });
1641
- } else {
1642
- restoreDragStartCache();
1643
- resetDragState(true);
1644
- }
1645
- }
1646
- }
1647
-
1648
- return {
1649
- activeColumn,
1650
- activeTask,
1651
- hoverTargetListId,
1652
- dragPreviewPosition,
1653
- optimisticUpdateInProgress,
1654
- onDragStart,
1655
- onDragMove,
1656
- onDragOver,
1657
- onDragEnd,
1658
- };
1659
- }