@tuturuuu/ui 0.0.4 → 0.2.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 (1210) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +2 -2
  3. package/biome.json +5 -0
  4. package/components.json +1 -1
  5. package/jsr.json +9 -9
  6. package/package.json +422 -92
  7. package/postcss.config.mjs +1 -1
  8. package/src/components/ui/__tests__/avatar.test.tsx +53 -0
  9. package/src/components/ui/accordion.tsx +4 -4
  10. package/src/components/ui/alert-dialog.tsx +8 -6
  11. package/src/components/ui/alert.tsx +2 -2
  12. package/src/components/ui/avatar.tsx +6 -3
  13. package/src/components/ui/badge.tsx +6 -4
  14. package/src/components/ui/breadcrumb.tsx +3 -4
  15. package/src/components/ui/button.tsx +3 -3
  16. package/src/components/ui/calendar-app/calendar-client-page.tsx +69 -0
  17. package/src/components/ui/calendar-app/calendar-page-shell.tsx +59 -0
  18. package/src/components/ui/calendar-app/components/actions-dropdown.tsx +269 -0
  19. package/src/components/ui/calendar-app/components/auto-schedule-comprehensive-dialog.tsx +220 -0
  20. package/src/components/ui/calendar-app/components/calendar-connections-manager.tsx +2 -0
  21. package/src/components/ui/calendar-app/components/calendar-connections-unified.tsx +1433 -0
  22. package/src/components/ui/calendar-app/components/calendar-connections.tsx +843 -0
  23. package/src/components/ui/calendar-app/components/calendar-header-actions.tsx +67 -0
  24. package/src/components/ui/calendar-app/components/calendar-types.ts +46 -0
  25. package/src/components/ui/calendar-app/components/connected-accounts-dialog.tsx +353 -0
  26. package/src/components/ui/calendar-app/components/e2ee-status-badge.tsx +237 -0
  27. package/src/components/ui/calendar-app/components/experimental-feature-dialog.tsx +56 -0
  28. package/src/components/ui/calendar-app/components/habits-panel.tsx +332 -0
  29. package/src/components/ui/calendar-app/components/priority-dropdown.tsx +113 -0
  30. package/src/components/ui/calendar-app/components/priority-view.tsx +939 -0
  31. package/src/components/ui/calendar-app/components/quick-calendar-toggle.tsx +1 -0
  32. package/src/components/ui/calendar-app/components/quick-task-dialog.tsx +335 -0
  33. package/src/components/ui/calendar-app/components/quick-task-timer.tsx +112 -0
  34. package/src/components/ui/calendar-app/components/require-workspace-timezone-dialog.tsx +415 -0
  35. package/src/components/ui/calendar-app/components/scheduling-dialog.tsx +660 -0
  36. package/src/components/ui/calendar-app/components/sidebar/calendar-sidebar.tsx +128 -0
  37. package/src/components/ui/calendar-app/components/sidebar/index.tsx +1 -0
  38. package/src/components/ui/calendar-app/components/smart-schedule-button.tsx +117 -0
  39. package/src/components/ui/calendar-app/components/smart-schedule-preview-dialog.tsx +845 -0
  40. package/src/components/ui/calendar-app/components/smart-schedule-preview-panel.tsx +941 -0
  41. package/src/components/ui/calendar-app/components/sync-debug-panel.tsx +708 -0
  42. package/src/components/ui/calendar-app/components/task-fetcher.ts +51 -0
  43. package/src/components/ui/calendar-app/components/task-form.tsx +132 -0
  44. package/src/components/ui/calendar-app/components/task-list-form.tsx +84 -0
  45. package/src/components/ui/calendar-app/components/task-scheduler-panel.tsx +490 -0
  46. package/src/components/ui/calendar-app/components/tasks-sidebar-content.tsx +232 -0
  47. package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +143 -0
  48. package/src/components/ui/calendar-app/components/test-event-generator-button.tsx +94 -0
  49. package/src/components/ui/calendar-app/components/time-tracker/components/active-session-card.tsx +113 -0
  50. package/src/components/ui/calendar-app/components/time-tracker/components/index.ts +3 -0
  51. package/src/components/ui/calendar-app/components/time-tracker/components/session-card.tsx +153 -0
  52. package/src/components/ui/calendar-app/components/time-tracker/components/stats-cards.tsx +58 -0
  53. package/src/components/ui/calendar-app/components/time-tracker/dialogs/create-task-dialog.tsx +190 -0
  54. package/src/components/ui/calendar-app/components/time-tracker/dialogs/delete-session-dialog.tsx +52 -0
  55. package/src/components/ui/calendar-app/components/time-tracker/dialogs/edit-session-dialog.tsx +173 -0
  56. package/src/components/ui/calendar-app/components/time-tracker/dialogs/index.ts +3 -0
  57. package/src/components/ui/calendar-app/components/time-tracker/hooks/index.ts +2 -0
  58. package/src/components/ui/calendar-app/components/time-tracker/hooks/use-sessions.ts +191 -0
  59. package/src/components/ui/calendar-app/components/time-tracker/hooks/use-time-tracker.ts +408 -0
  60. package/src/components/ui/calendar-app/components/time-tracker/index.tsx +902 -0
  61. package/src/components/ui/calendar-app/components/time-tracker/tabs/history-tab.tsx +28 -0
  62. package/src/components/ui/calendar-app/components/time-tracker/tabs/index.ts +2 -0
  63. package/src/components/ui/calendar-app/components/time-tracker/tabs/recent-sessions-tab.tsx +173 -0
  64. package/src/components/ui/calendar-app/components/time-tracker/time-tracker-trigger.tsx +50 -0
  65. package/src/components/ui/calendar-app/components/time-tracker/utils/category-colors.ts +38 -0
  66. package/src/components/ui/calendar-app/components/time-tracker/utils/format-time.ts +26 -0
  67. package/src/components/ui/calendar-app/components/time-tracker/utils/index.ts +2 -0
  68. package/src/components/ui/calendar-app/components/time-tracker.tsx +2040 -0
  69. package/src/components/ui/calendar-app/hooks/index.ts +9 -0
  70. package/src/components/ui/calendar-app/hooks/use-calendar-settings.ts +130 -0
  71. package/src/components/ui/calendar-app/hooks/use-e2ee.ts +283 -0
  72. package/src/components/ui/calendar.tsx +212 -64
  73. package/src/components/ui/card.tsx +3 -3
  74. package/src/components/ui/carousel.tsx +6 -5
  75. package/src/components/ui/chart.tsx +76 -24
  76. package/src/components/ui/chat/ai-message-markdown.tsx +59 -0
  77. package/src/components/ui/chat/ai-message-parts.tsx +176 -0
  78. package/src/components/ui/chat/ai-message-render-registry.tsx +203 -0
  79. package/src/components/ui/chat/ai-message-render-utils.ts +220 -0
  80. package/src/components/ui/chat/ai-message-tool-part.tsx +433 -0
  81. package/src/components/ui/chat/ai-message-tool-utils.ts +138 -0
  82. package/src/components/ui/chat/chat-agent-details-external-thread-panel.test.tsx +164 -0
  83. package/src/components/ui/chat/chat-agent-details-external-thread-panel.tsx +268 -0
  84. package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +70 -0
  85. package/src/components/ui/chat/chat-agent-details-operations-panel.tsx +246 -0
  86. package/src/components/ui/chat/chat-agent-details-setup-panel.tsx +297 -0
  87. package/src/components/ui/chat/chat-agent-details-sidebar.test.tsx +136 -0
  88. package/src/components/ui/chat/chat-agent-details-sidebar.tsx +335 -0
  89. package/src/components/ui/chat/chat-agent-details-utils.test.ts +161 -0
  90. package/src/components/ui/chat/chat-agent-details-utils.tsx +280 -0
  91. package/src/components/ui/chat/chat-ai-credit-source-picker.tsx +210 -0
  92. package/src/components/ui/chat/chat-ai-details-panels.tsx +421 -0
  93. package/src/components/ui/chat/chat-ai-details-sidebar.tsx +206 -0
  94. package/src/components/ui/chat/chat-ai-models.test.ts +37 -0
  95. package/src/components/ui/chat/chat-ai-models.ts +23 -0
  96. package/src/components/ui/chat/chat-shared-content-sidebar.tsx +209 -0
  97. package/src/components/ui/chat/chat-sidebar-groups.test.ts +64 -0
  98. package/src/components/ui/chat/chat-sidebar-items.tsx +195 -0
  99. package/src/components/ui/chat/chat-sidebar-panel.test.tsx +110 -0
  100. package/src/components/ui/chat/chat-sidebar-panel.tsx +193 -0
  101. package/src/components/ui/chat/chat-sidebar.tsx +505 -0
  102. package/src/components/ui/chat/chat-utils.test.ts +280 -0
  103. package/src/components/ui/chat/chat-workspace-header.tsx +429 -0
  104. package/src/components/ui/chat/chat-workspace.tsx +575 -0
  105. package/src/components/ui/chat/conversation-type-selector.tsx +51 -0
  106. package/src/components/ui/chat/create-conversation-dialog.test.tsx +89 -0
  107. package/src/components/ui/chat/create-conversation-dialog.tsx +377 -0
  108. package/src/components/ui/chat/directory-user-picker.tsx +160 -0
  109. package/src/components/ui/chat/friend-request-items.tsx +124 -0
  110. package/src/components/ui/chat/friend-requests-button.tsx +243 -0
  111. package/src/components/ui/chat/friend-requests-panel.tsx +116 -0
  112. package/src/components/ui/chat/hooks-ai.ts +73 -0
  113. package/src/components/ui/chat/hooks-attachments.ts +83 -0
  114. package/src/components/ui/chat/hooks-conversations.ts +205 -0
  115. package/src/components/ui/chat/hooks-directory.ts +45 -0
  116. package/src/components/ui/chat/hooks-friends.ts +74 -0
  117. package/src/components/ui/chat/hooks-messages.test.tsx +67 -0
  118. package/src/components/ui/chat/hooks-messages.ts +707 -0
  119. package/src/components/ui/chat/hooks-realtime.ts +157 -0
  120. package/src/components/ui/chat/hooks-shared-content.ts +56 -0
  121. package/src/components/ui/chat/hooks.ts +9 -0
  122. package/src/components/ui/chat/message-attachment-button.tsx +188 -0
  123. package/src/components/ui/chat/message-attachment-preview-dialog.tsx +141 -0
  124. package/src/components/ui/chat/message-bubble.tsx +372 -0
  125. package/src/components/ui/chat/message-composer.tsx +213 -0
  126. package/src/components/ui/chat/message-links.tsx +193 -0
  127. package/src/components/ui/chat/message-list.tsx +318 -0
  128. package/src/components/ui/chat/message-markdown.tsx +112 -0
  129. package/src/components/ui/chat/message-youtube.ts +48 -0
  130. package/src/components/ui/chat/query-keys.ts +48 -0
  131. package/src/components/ui/chat/utils.ts +284 -0
  132. package/src/components/ui/checkbox.tsx +24 -8
  133. package/src/components/ui/codeblock.tsx +7 -7
  134. package/src/components/ui/color-picker.tsx +9 -8
  135. package/src/components/ui/command.tsx +19 -11
  136. package/src/components/ui/context-menu.tsx +10 -10
  137. package/src/components/ui/currency-input.tsx +464 -0
  138. package/src/components/ui/custom/__tests__/facebook-mockup.test.tsx +291 -0
  139. package/src/components/ui/custom/__tests__/report-preview-pagination.test.ts +189 -0
  140. package/src/components/ui/custom/__tests__/report-preview.test.tsx +201 -0
  141. package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +144 -0
  142. package/src/components/ui/custom/__tests__/tuturuuu-logo.test.ts +10 -0
  143. package/src/components/ui/custom/autosize-textarea.tsx +3 -2
  144. package/src/components/ui/custom/calendar/core.tsx +11 -3
  145. package/src/components/ui/custom/calendar/day-cell.tsx +58 -44
  146. package/src/components/ui/custom/calendar/month-header.tsx +5 -7
  147. package/src/components/ui/custom/calendar/month-view.tsx +21 -9
  148. package/src/components/ui/custom/calendar/year-calendar.tsx +51 -10
  149. package/src/components/ui/custom/calendar/year-view.tsx +9 -5
  150. package/src/components/ui/custom/combobox.tsx +357 -89
  151. package/src/components/ui/custom/common-footer.tsx +89 -39
  152. package/src/components/ui/custom/compared-date-range-picker.tsx +478 -261
  153. package/src/components/ui/custom/data-pagination.tsx +446 -0
  154. package/src/components/ui/custom/date-input.tsx +4 -7
  155. package/src/components/ui/custom/education/certificates/certificate-viewer.tsx +98 -0
  156. package/src/components/ui/custom/education/certificates/download-button-pdf.tsx +82 -0
  157. package/src/components/ui/custom/education/certificates/types.ts +25 -0
  158. package/src/components/ui/custom/education/courses/course-card-view.tsx +252 -0
  159. package/src/components/ui/custom/education/courses/course-form.tsx +248 -0
  160. package/src/components/ui/custom/education/courses/course-header.tsx +38 -0
  161. package/src/components/ui/custom/education/courses/course-pagination.tsx +62 -0
  162. package/src/components/ui/custom/education/courses/course-row-actions.tsx +130 -0
  163. package/src/components/ui/custom/education/modules/content-section.tsx +73 -0
  164. package/src/components/ui/custom/education/modules/course-module-form.tsx +234 -0
  165. package/src/components/ui/custom/education/modules/course-module-row-actions.tsx +126 -0
  166. package/src/components/ui/custom/education/modules/link-button.tsx +66 -0
  167. package/src/components/ui/custom/education/modules/module-toggle.tsx +115 -0
  168. package/src/components/ui/custom/education/modules/resources/delete-resource.tsx +46 -0
  169. package/src/components/ui/custom/education/modules/resources/file-display.tsx +84 -0
  170. package/src/components/ui/custom/education/modules/resources/file-upload-form.tsx +544 -0
  171. package/src/components/ui/custom/education/modules/resources/pdf-viewer.tsx +119 -0
  172. package/src/components/ui/custom/education/modules/youtube/delete-link-button.tsx +62 -0
  173. package/src/components/ui/custom/education/modules/youtube/embed.tsx +20 -0
  174. package/src/components/ui/custom/education/modules/youtube/form.tsx +112 -0
  175. package/src/components/ui/custom/education/shell/education-content-surface.tsx +31 -0
  176. package/src/components/ui/custom/education/shell/education-kpi-strip.tsx +48 -0
  177. package/src/components/ui/custom/education/shell/education-page-header.tsx +56 -0
  178. package/src/components/ui/custom/empty-card.tsx +2 -2
  179. package/src/components/ui/custom/facebook-mockup/defaults.ts +81 -0
  180. package/src/components/ui/custom/facebook-mockup/facebook-mockup.tsx +313 -0
  181. package/src/components/ui/custom/facebook-mockup/form.tsx +629 -0
  182. package/src/components/ui/custom/facebook-mockup/image-upload-field.tsx +111 -0
  183. package/src/components/ui/custom/facebook-mockup/preview.tsx +760 -0
  184. package/src/components/ui/custom/facebook-mockup/types.ts +44 -0
  185. package/src/components/ui/custom/feature-summary.tsx +61 -7
  186. package/src/components/ui/custom/file-uploader.tsx +18 -15
  187. package/src/components/ui/custom/get-started-button.tsx +33 -0
  188. package/src/components/ui/custom/get-started-gradient-button.tsx +23 -0
  189. package/src/components/ui/custom/gradient-headline.tsx +25 -0
  190. package/src/components/ui/custom/icon-picker/icon-options.ts +24240 -0
  191. package/src/components/ui/custom/icon-picker/icon-picker.tsx +608 -0
  192. package/src/components/ui/custom/icon-picker/index.ts +45 -0
  193. package/src/components/ui/custom/icon-picker/types.ts +133 -0
  194. package/src/components/ui/custom/input-field.tsx +3 -1
  195. package/src/components/ui/custom/language-dropdown-item.tsx +55 -0
  196. package/src/components/ui/custom/language-dropdown-wrapper.tsx +34 -0
  197. package/src/components/ui/custom/language-toggle.tsx +43 -0
  198. package/src/components/ui/custom/language-wrapper.tsx +23 -0
  199. package/src/components/ui/custom/lead-generation-preview.tsx +310 -0
  200. package/src/components/ui/custom/loading-indicator.tsx +3 -0
  201. package/src/components/ui/custom/loading.tsx +8 -0
  202. package/src/components/ui/custom/logo-title.tsx +20 -0
  203. package/src/components/ui/custom/missed-entry/image-upload-section.tsx +192 -0
  204. package/src/components/ui/custom/modifiable-dialog-trigger.tsx +13 -7
  205. package/src/components/ui/custom/month-picker.tsx +8 -8
  206. package/src/components/ui/custom/nav-link.tsx +474 -0
  207. package/src/components/ui/custom/nav.tsx +86 -0
  208. package/src/components/ui/custom/navigation.tsx +192 -0
  209. package/src/components/ui/custom/notification-popover-client.tsx +758 -0
  210. package/src/components/ui/custom/production-indicator.tsx +22 -0
  211. package/src/components/ui/custom/qr/color.tsx +36 -0
  212. package/src/components/ui/custom/qr/display.tsx +82 -0
  213. package/src/components/ui/custom/qr/formats.tsx +52 -0
  214. package/src/components/ui/custom/qr/image-upload.tsx +440 -0
  215. package/src/components/ui/custom/qr/qr.tsx +170 -0
  216. package/src/components/ui/custom/qr/styles.tsx +133 -0
  217. package/src/components/ui/custom/qr/workspace-title.tsx +47 -0
  218. package/src/components/ui/custom/report-preview-pagination.ts +579 -0
  219. package/src/components/ui/custom/report-preview.tsx +745 -126
  220. package/src/components/ui/custom/search-bar.tsx +8 -12
  221. package/src/components/ui/custom/select-field.tsx +5 -3
  222. package/src/components/ui/custom/settings/appearance-settings.tsx +129 -0
  223. package/src/components/ui/custom/settings/lunar-calendar-settings.tsx +36 -0
  224. package/src/components/ui/custom/settings/sidebar-settings.tsx +135 -0
  225. package/src/components/ui/custom/settings/task-settings.tsx +236 -0
  226. package/src/components/ui/custom/settings-dialog-shell.tsx +481 -0
  227. package/src/components/ui/custom/settings-item-tab.tsx +29 -0
  228. package/src/components/ui/custom/sidebar-context.tsx +148 -0
  229. package/src/components/ui/custom/sidebar-footer-actions.tsx +337 -0
  230. package/src/components/ui/custom/staff-toolbar.tsx +16 -0
  231. package/src/components/ui/custom/structure.tsx +213 -0
  232. package/src/components/ui/custom/system-language-dropdown-item.tsx +46 -0
  233. package/src/components/ui/custom/system-language-wrapper.tsx +15 -0
  234. package/src/components/ui/custom/tables/custom-data-table.tsx +130 -0
  235. package/src/components/ui/custom/tables/data-table-column-header.tsx +9 -7
  236. package/src/components/ui/custom/tables/data-table-create-button.tsx +2 -2
  237. package/src/components/ui/custom/tables/data-table-faceted-filter.tsx +5 -5
  238. package/src/components/ui/custom/tables/data-table-pagination.tsx +69 -91
  239. package/src/components/ui/custom/tables/data-table-refresh-button.tsx +2 -2
  240. package/src/components/ui/custom/tables/data-table-toolbar.tsx +42 -19
  241. package/src/components/ui/custom/tables/data-table-view-options.tsx +27 -15
  242. package/src/components/ui/custom/tables/data-table.tsx +150 -56
  243. package/src/components/ui/custom/tailwind-indicator.tsx +14 -0
  244. package/src/components/ui/custom/theme-dropdown-items.tsx +90 -0
  245. package/src/components/ui/custom/theme-toggle.tsx +35 -0
  246. package/src/components/ui/custom/tuturuuu-logo.tsx +16 -0
  247. package/src/components/ui/custom/uploaded-files-card.tsx +1 -0
  248. package/src/components/ui/custom/user-filters.tsx +487 -0
  249. package/src/components/ui/custom/version-badge.test.tsx +102 -0
  250. package/src/components/ui/custom/version-badge.tsx +169 -0
  251. package/src/components/ui/custom/view-toggle.tsx +63 -0
  252. package/src/components/ui/custom/workspace-access/adapters.test.ts +31 -0
  253. package/src/components/ui/custom/workspace-access/adapters.ts +169 -0
  254. package/src/components/ui/custom/workspace-access/index.ts +32 -0
  255. package/src/components/ui/custom/workspace-access/member-filter-utils.test.ts +175 -0
  256. package/src/components/ui/custom/workspace-access/member-filter-utils.ts +190 -0
  257. package/src/components/ui/custom/workspace-access/types.ts +150 -0
  258. package/src/components/ui/custom/workspace-access/workspace-access-client-pages.tsx +26 -0
  259. package/src/components/ui/custom/workspace-access/workspace-access-default-role-card.tsx +92 -0
  260. package/src/components/ui/custom/workspace-access/workspace-access-invite-dialog.tsx +102 -0
  261. package/src/components/ui/custom/workspace-access/workspace-access-labels.ts +53 -0
  262. package/src/components/ui/custom/workspace-access/workspace-access-member-row.tsx +249 -0
  263. package/src/components/ui/custom/workspace-access/workspace-access-members.tsx +84 -0
  264. package/src/components/ui/custom/workspace-access/workspace-access-page-header.tsx +72 -0
  265. package/src/components/ui/custom/workspace-access/workspace-access-page.tsx +388 -0
  266. package/src/components/ui/custom/workspace-access/workspace-access-people-filters.tsx +200 -0
  267. package/src/components/ui/custom/workspace-access/workspace-access-permission-checklist.tsx +87 -0
  268. package/src/components/ui/custom/workspace-access/workspace-access-permission-preview.tsx +35 -0
  269. package/src/components/ui/custom/workspace-access/workspace-access-role-editor-dialog.tsx +180 -0
  270. package/src/components/ui/custom/workspace-access/workspace-access-role-editor-labels.ts +33 -0
  271. package/src/components/ui/custom/workspace-access/workspace-access-roles.tsx +171 -0
  272. package/src/components/ui/custom/workspace-access/workspace-access-tabs-toolbar.tsx +71 -0
  273. package/src/components/ui/custom/workspace-select.tsx +849 -0
  274. package/src/components/ui/custom/workspace-wrapper.tsx +142 -0
  275. package/src/components/ui/date-time-picker.tsx +706 -0
  276. package/src/components/ui/dialog.tsx +23 -14
  277. package/src/components/ui/diff-viewer.tsx +921 -0
  278. package/src/components/ui/drawer.tsx +5 -5
  279. package/src/components/ui/dropdown-menu.tsx +18 -10
  280. package/src/components/ui/finance/analytics/analytics-date-controls.tsx +173 -0
  281. package/src/components/ui/finance/analytics/analytics-page.test.tsx +182 -0
  282. package/src/components/ui/finance/analytics/analytics-page.tsx +296 -0
  283. package/src/components/ui/finance/analytics/balance-trend-chart.tsx +288 -0
  284. package/src/components/ui/finance/analytics/category-spending-chart.test.tsx +75 -0
  285. package/src/components/ui/finance/analytics/category-spending-chart.tsx +213 -0
  286. package/src/components/ui/finance/analytics/income-expense-chart-utils.ts +52 -0
  287. package/src/components/ui/finance/analytics/income-expense-chart.tsx +242 -0
  288. package/src/components/ui/finance/analytics/income-expense-view-mode-control.tsx +37 -0
  289. package/src/components/ui/finance/analytics/spending-trends-chart.tsx +156 -0
  290. package/src/components/ui/finance/budgets/budget-alerts.test.tsx +133 -0
  291. package/src/components/ui/finance/budgets/budget-alerts.tsx +111 -0
  292. package/src/components/ui/finance/budgets/budget-card.test.tsx +72 -0
  293. package/src/components/ui/finance/budgets/budget-card.tsx +233 -0
  294. package/src/components/ui/finance/budgets/budgets-page.test.tsx +56 -0
  295. package/src/components/ui/finance/budgets/budgets-page.tsx +179 -0
  296. package/src/components/ui/finance/budgets/form-fields.tsx +304 -0
  297. package/src/components/ui/finance/budgets/form-schema.ts +39 -0
  298. package/src/components/ui/finance/budgets/form.tsx +141 -0
  299. package/src/components/ui/finance/categories-tags-tabs.tsx +80 -0
  300. package/src/components/ui/finance/debts/debt-loan-card.test.tsx +75 -0
  301. package/src/components/ui/finance/debts/debt-loan-card.tsx +212 -0
  302. package/src/components/ui/finance/debts/debt-loan-detail-cards.test.tsx +89 -0
  303. package/src/components/ui/finance/debts/debt-loan-detail-cards.tsx +207 -0
  304. package/src/components/ui/finance/debts/debt-loan-detail-page.tsx +301 -0
  305. package/src/components/ui/finance/debts/debt-loan-form-schema.ts +30 -0
  306. package/src/components/ui/finance/debts/debt-loan-form.tsx +394 -0
  307. package/src/components/ui/finance/debts/debt-loan-list.tsx +58 -0
  308. package/src/components/ui/finance/debts/debt-loan-summary.tsx +94 -0
  309. package/src/components/ui/finance/debts/debts-page.test.tsx +97 -0
  310. package/src/components/ui/finance/debts/debts-page.tsx +230 -0
  311. package/src/components/ui/finance/debts/index.ts +6 -0
  312. package/src/components/ui/finance/debts/query-invalidation.test.ts +62 -0
  313. package/src/components/ui/finance/debts/query-invalidation.ts +44 -0
  314. package/src/components/ui/finance/finance-layout.tsx +98 -0
  315. package/src/components/ui/finance/finance-overview-metrics.tsx +120 -0
  316. package/src/components/ui/finance/finance-page.tsx +169 -0
  317. package/src/components/ui/finance/finance-route-context.tsx +50 -0
  318. package/src/components/ui/finance/invoices/attendance-calendar.tsx +247 -0
  319. package/src/components/ui/finance/invoices/charts/invoice-totals-chart.test.tsx +67 -0
  320. package/src/components/ui/finance/invoices/charts/invoice-totals-chart.tsx +868 -0
  321. package/src/components/ui/finance/invoices/columns.test.tsx +66 -0
  322. package/src/components/ui/finance/invoices/columns.tsx +365 -0
  323. package/src/components/ui/finance/invoices/components/invoice-blocked-state.tsx +30 -0
  324. package/src/components/ui/finance/invoices/components/invoice-checkout-summary.tsx +120 -0
  325. package/src/components/ui/finance/invoices/components/invoice-content-editor.tsx +71 -0
  326. package/src/components/ui/finance/invoices/components/invoice-customer-select-card.tsx +342 -0
  327. package/src/components/ui/finance/invoices/components/invoice-payment-settings.tsx +216 -0
  328. package/src/components/ui/finance/invoices/components/invoice-user-history-accordion.tsx +219 -0
  329. package/src/components/ui/finance/invoices/components/subscription-attendance-summary.tsx +272 -0
  330. package/src/components/ui/finance/invoices/components/subscription-group-selector.tsx +346 -0
  331. package/src/components/ui/finance/invoices/create-promotion-dialog.tsx +67 -0
  332. package/src/components/ui/finance/invoices/export-dialog-content.tsx +492 -0
  333. package/src/components/ui/finance/invoices/hooks/use-best-promotion-selection.ts +119 -0
  334. package/src/components/ui/finance/invoices/hooks/use-invoice-analytics.ts +79 -0
  335. package/src/components/ui/finance/invoices/hooks/use-invoice-rounding.ts +33 -0
  336. package/src/components/ui/finance/invoices/hooks/use-invoice-subtotal.ts +13 -0
  337. package/src/components/ui/finance/invoices/hooks/use-subscription-auto-selection.ts +412 -0
  338. package/src/components/ui/finance/invoices/hooks/use-subscription-invoice-content.ts +191 -0
  339. package/src/components/ui/finance/invoices/hooks.ts +878 -0
  340. package/src/components/ui/finance/invoices/internal-api.ts +466 -0
  341. package/src/components/ui/finance/invoices/invoice-analytics.tsx +167 -0
  342. package/src/components/ui/finance/invoices/invoice-page.tsx +468 -0
  343. package/src/components/ui/finance/invoices/invoice-visibility-format.test.ts +90 -0
  344. package/src/components/ui/finance/invoices/invoice-visibility-format.ts +67 -0
  345. package/src/components/ui/finance/invoices/invoiceId/compact-invoice-template.tsx +172 -0
  346. package/src/components/ui/finance/invoices/invoiceId/full-invoice-template.tsx +349 -0
  347. package/src/components/ui/finance/invoices/invoiceId/invoice-card.tsx +360 -0
  348. package/src/components/ui/finance/invoices/invoiceId/invoice-details-page.test.tsx +227 -0
  349. package/src/components/ui/finance/invoices/invoiceId/invoice-details-page.tsx +409 -0
  350. package/src/components/ui/finance/invoices/invoiceId/invoice-edit-form.tsx +161 -0
  351. package/src/components/ui/finance/invoices/invoiceId/product-card.tsx +90 -0
  352. package/src/components/ui/finance/invoices/invoiceId/promotion-card.tsx +76 -0
  353. package/src/components/ui/finance/invoices/invoices-table.tsx +284 -0
  354. package/src/components/ui/finance/invoices/new-invoice-page.tsx +215 -0
  355. package/src/components/ui/finance/invoices/pending-columns.tsx +308 -0
  356. package/src/components/ui/finance/invoices/pending-invoices-tab.tsx +43 -0
  357. package/src/components/ui/finance/invoices/pending-invoices-table.tsx +258 -0
  358. package/src/components/ui/finance/invoices/product-selection.test.tsx +78 -0
  359. package/src/components/ui/finance/invoices/product-selection.tsx +345 -0
  360. package/src/components/ui/finance/invoices/promotion-form.tsx +352 -0
  361. package/src/components/ui/finance/invoices/query-invalidation.ts +65 -0
  362. package/src/components/ui/finance/invoices/row-actions.tsx +148 -0
  363. package/src/components/ui/finance/invoices/standard-invoice.tsx +595 -0
  364. package/src/components/ui/finance/invoices/subscription-invoice.tsx +1009 -0
  365. package/src/components/ui/finance/invoices/types.ts +93 -0
  366. package/src/components/ui/finance/invoices/user-filter-wrapper.tsx +59 -0
  367. package/src/components/ui/finance/invoices/utils.test.ts +165 -0
  368. package/src/components/ui/finance/invoices/utils.ts +484 -0
  369. package/src/components/ui/finance/invoices/wallet-filter-wrapper.tsx +47 -0
  370. package/src/components/ui/finance/recurring/form-fields.tsx +142 -0
  371. package/src/components/ui/finance/recurring/form-schedule-fields.tsx +112 -0
  372. package/src/components/ui/finance/recurring/form-schema.ts +32 -0
  373. package/src/components/ui/finance/recurring/form.tsx +130 -0
  374. package/src/components/ui/finance/recurring/recurring-sections.tsx +141 -0
  375. package/src/components/ui/finance/recurring/recurring-transaction-card.tsx +152 -0
  376. package/src/components/ui/finance/recurring/recurring-transactions-page.test.tsx +87 -0
  377. package/src/components/ui/finance/recurring/recurring-transactions-page.tsx +154 -0
  378. package/src/components/ui/finance/recurring/upcoming-transaction-card.tsx +84 -0
  379. package/src/components/ui/finance/shared/charts/category-breakdown-chart-body.tsx +118 -0
  380. package/src/components/ui/finance/shared/charts/category-breakdown-chart-controls.tsx +146 -0
  381. package/src/components/ui/finance/shared/charts/category-breakdown-chart-legend.tsx +49 -0
  382. package/src/components/ui/finance/shared/charts/category-breakdown-chart-tooltip.tsx +109 -0
  383. package/src/components/ui/finance/shared/charts/category-breakdown-chart-types.ts +24 -0
  384. package/src/components/ui/finance/shared/charts/category-breakdown-chart-utils.ts +207 -0
  385. package/src/components/ui/finance/shared/charts/category-breakdown-chart.tsx +263 -0
  386. package/src/components/ui/finance/shared/charts/daily-total-chart-client.tsx +384 -0
  387. package/src/components/ui/finance/shared/charts/daily-total-chart.tsx +299 -0
  388. package/src/components/ui/finance/shared/charts/monthly-total-chart-client.tsx +391 -0
  389. package/src/components/ui/finance/shared/charts/monthly-total-chart.tsx +296 -0
  390. package/src/components/ui/finance/shared/charts/use-finance-confidential-visibility.ts +5 -0
  391. package/src/components/ui/finance/shared/confidential-toggle.tsx +78 -0
  392. package/src/components/ui/finance/shared/create-dialog-feature-summary.tsx +23 -0
  393. package/src/components/ui/finance/shared/dashboard-header.tsx +19 -0
  394. package/src/components/ui/finance/shared/date-picker.tsx +74 -0
  395. package/src/components/ui/finance/shared/date-range-filter-wrapper.tsx +86 -0
  396. package/src/components/ui/finance/shared/date-range-picker.tsx +42 -0
  397. package/src/components/ui/finance/shared/empty-state.tsx +41 -0
  398. package/src/components/ui/finance/shared/filter.tsx +267 -0
  399. package/src/components/ui/finance/shared/finance-display-amount.tsx +25 -0
  400. package/src/components/ui/finance/shared/loaders/statistics.tsx +18 -0
  401. package/src/components/ui/finance/shared/loaders/table-skeleton.tsx +5 -0
  402. package/src/components/ui/finance/shared/metrics.tsx +69 -0
  403. package/src/components/ui/finance/shared/month-picker.tsx +177 -0
  404. package/src/components/ui/finance/shared/month-range-picker.tsx +50 -0
  405. package/src/components/ui/finance/shared/next-charts.tsx +77 -0
  406. package/src/components/ui/finance/shared/numbers-visibility-toggle.test.tsx +38 -0
  407. package/src/components/ui/finance/shared/numbers-visibility-toggle.tsx +43 -0
  408. package/src/components/ui/finance/shared/quick-actions.tsx +143 -0
  409. package/src/components/ui/finance/shared/use-finance-confidential-visibility.ts +68 -0
  410. package/src/components/ui/finance/shared/year-picker.tsx +178 -0
  411. package/src/components/ui/finance/shared/year-range-picker.tsx +50 -0
  412. package/src/components/ui/finance/statistics/card.tsx +195 -0
  413. package/src/components/ui/finance/statistics/expense.tsx +63 -0
  414. package/src/components/ui/finance/statistics/income.tsx +63 -0
  415. package/src/components/ui/finance/statistics/invoices.tsx +77 -0
  416. package/src/components/ui/finance/statistics/monthly-expense.tsx +63 -0
  417. package/src/components/ui/finance/statistics/monthly-income.tsx +63 -0
  418. package/src/components/ui/finance/statistics/total-balance.test.tsx +79 -0
  419. package/src/components/ui/finance/statistics/total-balance.tsx +64 -0
  420. package/src/components/ui/finance/statistics/transaction-categories.tsx +59 -0
  421. package/src/components/ui/finance/statistics/transactions.tsx +90 -0
  422. package/src/components/ui/finance/statistics/wallets.tsx +55 -0
  423. package/src/components/ui/finance/tags/tag-badge.tsx +36 -0
  424. package/src/components/ui/finance/tags/tag-manager.test.tsx +128 -0
  425. package/src/components/ui/finance/tags/tag-manager.tsx +646 -0
  426. package/src/components/ui/finance/transactions/TRANSACTIONS_UI_REVAMP.md +328 -0
  427. package/src/components/ui/finance/transactions/UI_IMPROVEMENTS.md +444 -0
  428. package/src/components/ui/finance/transactions/__tests__/export-utils.test.ts +167 -0
  429. package/src/components/ui/finance/transactions/categories/amount-filter-wrapper.tsx +55 -0
  430. package/src/components/ui/finance/transactions/categories/amount-filter.tsx +135 -0
  431. package/src/components/ui/finance/transactions/categories/categories-data-table.tsx +274 -0
  432. package/src/components/ui/finance/transactions/categories/columns.test.tsx +113 -0
  433. package/src/components/ui/finance/transactions/categories/columns.tsx +253 -0
  434. package/src/components/ui/finance/transactions/categories/form.tsx +388 -0
  435. package/src/components/ui/finance/transactions/categories/hooks.test.tsx +72 -0
  436. package/src/components/ui/finance/transactions/categories/hooks.ts +95 -0
  437. package/src/components/ui/finance/transactions/categories/row-actions.tsx +132 -0
  438. package/src/components/ui/finance/transactions/categories/transactions-categories-page.tsx +96 -0
  439. package/src/components/ui/finance/transactions/categories/type-filter-wrapper.tsx +39 -0
  440. package/src/components/ui/finance/transactions/categories/type-filter.tsx +148 -0
  441. package/src/components/ui/finance/transactions/category-filter-wrapper.tsx +41 -0
  442. package/src/components/ui/finance/transactions/category-filter.tsx +252 -0
  443. package/src/components/ui/finance/transactions/columns.test.tsx +119 -0
  444. package/src/components/ui/finance/transactions/columns.tsx +313 -0
  445. package/src/components/ui/finance/transactions/confidential-field.test.tsx +32 -0
  446. package/src/components/ui/finance/transactions/confidential-field.tsx +289 -0
  447. package/src/components/ui/finance/transactions/export-dialog-content.tsx +393 -0
  448. package/src/components/ui/finance/transactions/export-utils.ts +99 -0
  449. package/src/components/ui/finance/transactions/form-basic-tab.tsx +360 -0
  450. package/src/components/ui/finance/transactions/form-content-dialog.tsx +163 -0
  451. package/src/components/ui/finance/transactions/form-more-tab.tsx +203 -0
  452. package/src/components/ui/finance/transactions/form-schema.ts +52 -0
  453. package/src/components/ui/finance/transactions/form-types.ts +39 -0
  454. package/src/components/ui/finance/transactions/form-utils.tsx +60 -0
  455. package/src/components/ui/finance/transactions/form.test.tsx +151 -0
  456. package/src/components/ui/finance/transactions/form.tsx +942 -0
  457. package/src/components/ui/finance/transactions/hooks/use-filter-reset.ts +27 -0
  458. package/src/components/ui/finance/transactions/infinite-transactions-list.tsx +1127 -0
  459. package/src/components/ui/finance/transactions/internal-api.ts +148 -0
  460. package/src/components/ui/finance/transactions/money-lover-import-dialog-utils.test.ts +16 -0
  461. package/src/components/ui/finance/transactions/money-lover-import-dialog-utils.ts +17 -0
  462. package/src/components/ui/finance/transactions/money-lover-import-dialog.tsx +908 -0
  463. package/src/components/ui/finance/transactions/period-charts/activity-distribution-chart.tsx +315 -0
  464. package/src/components/ui/finance/transactions/period-charts/category-breakdown-dialog.tsx +820 -0
  465. package/src/components/ui/finance/transactions/period-charts/category-donut-chart.tsx +609 -0
  466. package/src/components/ui/finance/transactions/period-charts/index.ts +4 -0
  467. package/src/components/ui/finance/transactions/period-charts/period-breakdown-panel.tsx +492 -0
  468. package/src/components/ui/finance/transactions/query-invalidation.test.ts +91 -0
  469. package/src/components/ui/finance/transactions/query-invalidation.ts +116 -0
  470. package/src/components/ui/finance/transactions/row-actions.tsx +145 -0
  471. package/src/components/ui/finance/transactions/tag-filter-wrapper.tsx +40 -0
  472. package/src/components/ui/finance/transactions/tag-filter.test.tsx +49 -0
  473. package/src/components/ui/finance/transactions/tag-filter.tsx +171 -0
  474. package/src/components/ui/finance/transactions/transaction-attachments-field.tsx +787 -0
  475. package/src/components/ui/finance/transactions/transaction-card.tsx +576 -0
  476. package/src/components/ui/finance/transactions/transaction-edit-dialog.test.tsx +101 -0
  477. package/src/components/ui/finance/transactions/transaction-edit-dialog.tsx +947 -0
  478. package/src/components/ui/finance/transactions/transaction-statistics.test.tsx +58 -0
  479. package/src/components/ui/finance/transactions/transaction-statistics.tsx +280 -0
  480. package/src/components/ui/finance/transactions/transaction-type-filter-wrapper.tsx +40 -0
  481. package/src/components/ui/finance/transactions/transaction-type-filter.tsx +95 -0
  482. package/src/components/ui/finance/transactions/transactionId/bill.tsx +307 -0
  483. package/src/components/ui/finance/transactions/transactionId/objects.tsx +149 -0
  484. package/src/components/ui/finance/transactions/transactionId/row-actions.tsx +263 -0
  485. package/src/components/ui/finance/transactions/transactionId/transaction-details-client-page.tsx +334 -0
  486. package/src/components/ui/finance/transactions/transactionId/transaction-details-page.tsx +76 -0
  487. package/src/components/ui/finance/transactions/transactions-create-summary.tsx +56 -0
  488. package/src/components/ui/finance/transactions/transactions-infinite-page.tsx +213 -0
  489. package/src/components/ui/finance/transactions/transactions-page.tsx +116 -0
  490. package/src/components/ui/finance/transactions/transfer-fields.tsx +194 -0
  491. package/src/components/ui/finance/transactions/user-filter-wrapper.tsx +42 -0
  492. package/src/components/ui/finance/transactions/user-filter.test.tsx +66 -0
  493. package/src/components/ui/finance/transactions/user-filter.tsx +282 -0
  494. package/src/components/ui/finance/transactions/view-mode-toggle.tsx +124 -0
  495. package/src/components/ui/finance/transactions/wallet-filter-wrapper.tsx +41 -0
  496. package/src/components/ui/finance/transactions/wallet-filter.test.tsx +52 -0
  497. package/src/components/ui/finance/transactions/wallet-filter.tsx +204 -0
  498. package/src/components/ui/finance/wallets/columns.tsx +324 -0
  499. package/src/components/ui/finance/wallets/form.test.tsx +78 -0
  500. package/src/components/ui/finance/wallets/form.tsx +491 -0
  501. package/src/components/ui/finance/wallets/query-invalidation.ts +58 -0
  502. package/src/components/ui/finance/wallets/row-actions.tsx +166 -0
  503. package/src/components/ui/finance/wallets/wallet-form-schema.ts +63 -0
  504. package/src/components/ui/finance/wallets/wallet-icon-display.tsx +71 -0
  505. package/src/components/ui/finance/wallets/wallet-icon-image-picker.tsx +369 -0
  506. package/src/components/ui/finance/wallets/wallet-images.ts +180 -0
  507. package/src/components/ui/finance/wallets/walletId/credit-wallet-summary.tsx +265 -0
  508. package/src/components/ui/finance/wallets/walletId/interest/index.ts +18 -0
  509. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-chart.tsx +296 -0
  510. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-detection-banner.tsx +77 -0
  511. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-disable-dialog.tsx +55 -0
  512. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-hero.tsx +149 -0
  513. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-pending-deposits.tsx +185 -0
  514. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-projections.tsx +259 -0
  515. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-rate-dialog.tsx +89 -0
  516. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-rate-history.tsx +116 -0
  517. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-section.tsx +260 -0
  518. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-settings.tsx +427 -0
  519. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-setup-dialog.tsx +206 -0
  520. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-summary.tsx +244 -0
  521. package/src/components/ui/finance/wallets/walletId/interest/wallet-interest-transparency.tsx +176 -0
  522. package/src/components/ui/finance/wallets/walletId/wallet-delete-button.test.tsx +78 -0
  523. package/src/components/ui/finance/wallets/walletId/wallet-delete-button.tsx +99 -0
  524. package/src/components/ui/finance/wallets/walletId/wallet-details-actions.tsx +119 -0
  525. package/src/components/ui/finance/wallets/walletId/wallet-details-amount.tsx +36 -0
  526. package/src/components/ui/finance/wallets/walletId/wallet-details-page.test.tsx +161 -0
  527. package/src/components/ui/finance/wallets/walletId/wallet-details-page.tsx +365 -0
  528. package/src/components/ui/finance/wallets/walletId/wallet-role-access-dialog.tsx +45 -0
  529. package/src/components/ui/finance/wallets/walletId/wallet-role-access.tsx +538 -0
  530. package/src/components/ui/finance/wallets/wallets-data-table.tsx +137 -0
  531. package/src/components/ui/finance/wallets/wallets-page.test.tsx +107 -0
  532. package/src/components/ui/finance/wallets/wallets-page.tsx +136 -0
  533. package/src/components/ui/form-required-indicator.tsx +31 -0
  534. package/src/components/ui/form.tsx +36 -13
  535. package/src/components/ui/hover-card.tsx +2 -2
  536. package/src/components/ui/input-otp.tsx +4 -4
  537. package/src/components/ui/input.tsx +2 -2
  538. package/src/components/ui/kbd.tsx +28 -0
  539. package/src/components/ui/label.tsx +2 -2
  540. package/src/components/ui/legacy/calendar/__tests__/event-utils.test.ts +247 -0
  541. package/src/components/ui/legacy/calendar/agenda-view.tsx +398 -0
  542. package/src/components/ui/legacy/calendar/all-day-event-bar.tsx +1033 -0
  543. package/src/components/ui/legacy/calendar/calendar-cell.tsx +1018 -0
  544. package/src/components/ui/legacy/calendar/calendar-column.tsx +31 -0
  545. package/src/components/ui/legacy/calendar/calendar-content.tsx +670 -0
  546. package/src/components/ui/legacy/calendar/calendar-header.tsx +195 -0
  547. package/src/components/ui/legacy/calendar/calendar-matrix.tsx +328 -0
  548. package/src/components/ui/legacy/calendar/calendar-settings-dialog.tsx +340 -0
  549. package/src/components/ui/legacy/calendar/calendar-view-with-trail.tsx +48 -0
  550. package/src/components/ui/legacy/calendar/calendar-view.tsx +28 -0
  551. package/src/components/ui/legacy/calendar/color-highlights.ts +55 -0
  552. package/src/components/ui/legacy/calendar/config.ts +8 -0
  553. package/src/components/ui/legacy/calendar/create-event-button.tsx +155 -0
  554. package/src/components/ui/legacy/calendar/day-title.tsx +68 -0
  555. package/src/components/ui/legacy/calendar/dynamic-island.tsx +245 -0
  556. package/src/components/ui/legacy/calendar/event-card.tsx +1430 -0
  557. package/src/components/ui/legacy/calendar/event-form-components.tsx +593 -0
  558. package/src/components/ui/legacy/calendar/event-modal.tsx +1544 -0
  559. package/src/components/ui/legacy/calendar/event-utils.ts +149 -0
  560. package/src/components/ui/legacy/calendar/location-timeline.tsx +1482 -0
  561. package/src/components/ui/legacy/calendar/month-calendar.tsx +986 -0
  562. package/src/components/ui/legacy/calendar/month-cell.tsx +33 -0
  563. package/src/components/ui/legacy/calendar/month-grid.tsx +105 -0
  564. package/src/components/ui/legacy/calendar/settings/analytics-charts.tsx +414 -0
  565. package/src/components/ui/legacy/calendar/settings/appearance-settings.tsx +218 -0
  566. package/src/components/ui/legacy/calendar/settings/calendar-sync-dashboard.tsx +217 -0
  567. package/src/components/ui/legacy/calendar/settings/category-color-settings.tsx +475 -0
  568. package/src/components/ui/legacy/calendar/settings/color-picker.tsx +177 -0
  569. package/src/components/ui/legacy/calendar/settings/google-calendar-settings.tsx +562 -0
  570. package/src/components/ui/legacy/calendar/settings/hour-settings.tsx +292 -0
  571. package/src/components/ui/legacy/calendar/settings/notification-settings.tsx +254 -0
  572. package/src/components/ui/legacy/calendar/settings/settings-context.tsx +257 -0
  573. package/src/components/ui/legacy/calendar/settings/smart-scheduling-settings.tsx +325 -0
  574. package/src/components/ui/legacy/calendar/settings/summary-cards.tsx +93 -0
  575. package/src/components/ui/legacy/calendar/settings/sync-logs-table.tsx +392 -0
  576. package/src/components/ui/legacy/calendar/settings/task-settings.tsx +330 -0
  577. package/src/components/ui/legacy/calendar/settings/time-range-picker.tsx +666 -0
  578. package/src/components/ui/legacy/calendar/settings/timezone-settings.tsx +580 -0
  579. package/src/components/ui/legacy/calendar/settings/types.ts +119 -0
  580. package/src/components/ui/legacy/calendar/settings-button.tsx +41 -0
  581. package/src/components/ui/legacy/calendar/smart-calendar.tsx +82 -0
  582. package/src/components/ui/legacy/calendar/time-indicator-line.tsx +61 -0
  583. package/src/components/ui/legacy/calendar/time-indicator-text.tsx +61 -0
  584. package/src/components/ui/legacy/calendar/time-indicator.tsx +19 -0
  585. package/src/components/ui/legacy/calendar/time-trail.tsx +52 -0
  586. package/src/components/ui/legacy/calendar/weekday-bar.tsx +78 -0
  587. package/src/components/ui/legacy/calendar/year-calendar.tsx +345 -0
  588. package/src/components/ui/legacy/meet/client-wrapper.tsx +74 -0
  589. package/src/components/ui/legacy/meet/create-plan-dialog.tsx +404 -0
  590. package/src/components/ui/legacy/meet/date-selector.tsx +46 -0
  591. package/src/components/ui/legacy/meet/edit-plan-dialog.tsx +501 -0
  592. package/src/components/ui/legacy/meet/experimental-notice.tsx +39 -0
  593. package/src/components/ui/legacy/meet/form.tsx +94 -0
  594. package/src/components/ui/legacy/meet/multiple-choice-vote.tsx +556 -0
  595. package/src/components/ui/legacy/meet/page.tsx +331 -0
  596. package/src/components/ui/legacy/meet/pagination.tsx +87 -0
  597. package/src/components/ui/legacy/meet/planId/account-badge.tsx +21 -0
  598. package/src/components/ui/legacy/meet/planId/agenda-details.tsx +131 -0
  599. package/src/components/ui/legacy/meet/planId/all-availabilities.tsx +105 -0
  600. package/src/components/ui/legacy/meet/planId/availability-planner.tsx +51 -0
  601. package/src/components/ui/legacy/meet/planId/confirm-button.tsx +53 -0
  602. package/src/components/ui/legacy/meet/planId/copy-link-button.tsx +218 -0
  603. package/src/components/ui/legacy/meet/planId/date-planner.tsx +243 -0
  604. package/src/components/ui/legacy/meet/planId/day-planner.tsx +78 -0
  605. package/src/components/ui/legacy/meet/planId/day-planners.tsx +151 -0
  606. package/src/components/ui/legacy/meet/planId/day-time.tsx +32 -0
  607. package/src/components/ui/legacy/meet/planId/download-as-png.tsx +16 -0
  608. package/src/components/ui/legacy/meet/planId/email-button.tsx +32 -0
  609. package/src/components/ui/legacy/meet/planId/logged-in-as-button.tsx +56 -0
  610. package/src/components/ui/legacy/meet/planId/page.tsx +242 -0
  611. package/src/components/ui/legacy/meet/planId/plan-details-client.tsx +205 -0
  612. package/src/components/ui/legacy/meet/planId/plan-login.tsx +342 -0
  613. package/src/components/ui/legacy/meet/planId/plan-user-filter-accordion.tsx +227 -0
  614. package/src/components/ui/legacy/meet/planId/plan-user-filter.tsx +68 -0
  615. package/src/components/ui/legacy/meet/planId/preview-day-time.tsx +303 -0
  616. package/src/components/ui/legacy/meet/planId/selectable-day-time.tsx +247 -0
  617. package/src/components/ui/legacy/meet/planId/show-qr-button.tsx +53 -0
  618. package/src/components/ui/legacy/meet/planId/sidebar-display.tsx +68 -0
  619. package/src/components/ui/legacy/meet/planId/sticky-bottom-indicator.tsx +28 -0
  620. package/src/components/ui/legacy/meet/planId/time-column.tsx +57 -0
  621. package/src/components/ui/legacy/meet/planId/unified-availability.tsx +93 -0
  622. package/src/components/ui/legacy/meet/planId/utility-buttons.tsx +54 -0
  623. package/src/components/ui/legacy/meet/plans-grid.tsx +192 -0
  624. package/src/components/ui/legacy/meet/plans-list-view.tsx +148 -0
  625. package/src/components/ui/legacy/meet/plans-loading-skeleton.tsx +61 -0
  626. package/src/components/ui/legacy/meet/time-selector.tsx +67 -0
  627. package/src/components/ui/legacy/meet/timezone-selector.tsx +72 -0
  628. package/src/components/ui/legacy/meet/user-time.tsx +7 -0
  629. package/src/components/ui/legacy/meet/view-toggle.tsx +44 -0
  630. package/src/components/ui/legacy/polls/poll-display.tsx +388 -0
  631. package/src/components/ui/legacy/polls/where-tu-meet.tsx +80 -0
  632. package/src/components/ui/markdown.tsx +2 -2
  633. package/src/components/ui/menubar.tsx +11 -11
  634. package/src/components/ui/navbar.tsx +150 -0
  635. package/src/components/ui/navigation-menu.tsx +9 -9
  636. package/src/components/ui/pagination.tsx +4 -5
  637. package/src/components/ui/popover.tsx +2 -2
  638. package/src/components/ui/progress.tsx +15 -4
  639. package/src/components/ui/radio-group.tsx +3 -3
  640. package/src/components/ui/report-problem-dialog.tsx +980 -0
  641. package/src/components/ui/resizable.tsx +35 -13
  642. package/src/components/ui/scroll-area.tsx +3 -3
  643. package/src/components/ui/select.tsx +9 -8
  644. package/src/components/ui/separator.tsx +2 -2
  645. package/src/components/ui/sheet.tsx +13 -11
  646. package/src/components/ui/sidebar.tsx +18 -17
  647. package/src/components/ui/slider.tsx +3 -3
  648. package/src/components/ui/sonner.tsx +2 -2
  649. package/src/components/ui/sticky-bottom-bar.tsx +51 -0
  650. package/src/components/ui/switch.tsx +2 -2
  651. package/src/components/ui/table.tsx +2 -2
  652. package/src/components/ui/tabs.tsx +3 -3
  653. package/src/components/ui/text-editor/__tests__/content-migration.test.ts +757 -0
  654. package/src/components/ui/text-editor/__tests__/extensions-integration.test.ts +131 -0
  655. package/src/components/ui/text-editor/__tests__/extensions.test.ts +69 -0
  656. package/src/components/ui/text-editor/__tests__/image-extension.test.ts +799 -0
  657. package/src/components/ui/text-editor/__tests__/inline-task-conversion.test.tsx +46 -0
  658. package/src/components/ui/text-editor/__tests__/keyboard.test.ts +176 -0
  659. package/src/components/ui/text-editor/__tests__/list-converter-extension.test.ts +51 -0
  660. package/src/components/ui/text-editor/__tests__/markdown-paste-extension.test.ts +266 -0
  661. package/src/components/ui/text-editor/__tests__/media-utils.test.ts +425 -0
  662. package/src/components/ui/text-editor/__tests__/task-mention-checkbox.test.ts +251 -0
  663. package/src/components/ui/text-editor/__tests__/task-mention-chip.test.tsx +476 -0
  664. package/src/components/ui/text-editor/__tests__/text-replacements.test.ts +39 -0
  665. package/src/components/ui/text-editor/__tests__/upload-placeholder.test.ts +279 -0
  666. package/src/components/ui/text-editor/__tests__/video-extension.test.ts +711 -0
  667. package/src/components/ui/text-editor/content-migration.ts +199 -0
  668. package/src/components/ui/text-editor/draggable-node-container.tsx +164 -0
  669. package/src/components/ui/text-editor/editor.tsx +707 -0
  670. package/src/components/ui/text-editor/extensions.ts +232 -0
  671. package/src/components/ui/text-editor/image-extension.ts +907 -0
  672. package/src/components/ui/text-editor/keyboard.ts +58 -0
  673. package/src/components/ui/text-editor/list-converter-extension.ts +55 -0
  674. package/src/components/ui/text-editor/list-item-extension.ts +13 -0
  675. package/src/components/ui/text-editor/list-item-view.tsx +17 -0
  676. package/src/components/ui/text-editor/markdown-paste-extension.ts +610 -0
  677. package/src/components/ui/text-editor/media-utils.ts +198 -0
  678. package/src/components/ui/text-editor/mention-extension.tsx +604 -0
  679. package/src/components/ui/text-editor/node-drag-extension.ts +300 -0
  680. package/src/components/ui/text-editor/task-item-checkbox-extension.ts +32 -0
  681. package/src/components/ui/text-editor/task-item-checkbox-view.tsx +227 -0
  682. package/src/components/ui/text-editor/task-item-checkbox.ts +100 -0
  683. package/src/components/ui/text-editor/task-mention-chip.tsx +1397 -0
  684. package/src/components/ui/text-editor/task-mention-resolution.ts +235 -0
  685. package/src/components/ui/text-editor/task-summary-popover.tsx +360 -0
  686. package/src/components/ui/text-editor/text-replacements.ts +65 -0
  687. package/src/components/ui/text-editor/text-shortcuts-extension.ts +60 -0
  688. package/src/components/ui/text-editor/tool-bar.tsx +1294 -0
  689. package/src/components/ui/text-editor/types.ts +1 -0
  690. package/src/components/ui/text-editor/upload-errors.ts +93 -0
  691. package/src/components/ui/text-editor/upload-placeholder.ts +124 -0
  692. package/src/components/ui/text-editor/video-extension.ts +435 -0
  693. package/src/components/ui/textarea.tsx +2 -2
  694. package/src/components/ui/time-picker-input.tsx +6 -6
  695. package/src/components/ui/time-picker-utils.tsx +2 -2
  696. package/src/components/ui/time-tracker/types.ts +112 -0
  697. package/src/components/ui/toast.tsx +9 -9
  698. package/src/components/ui/toaster.tsx +10 -14
  699. package/src/components/ui/toggle-group.tsx +2 -2
  700. package/src/components/ui/toggle.tsx +2 -2
  701. package/src/components/ui/tooltip.tsx +3 -3
  702. package/src/components/ui/tu-do/boards/__tests__/quick-create-board-dialog.test.tsx +52 -0
  703. package/src/components/ui/tu-do/boards/__tests__/task-board-form.test.tsx +130 -0
  704. package/src/components/ui/tu-do/boards/__tests__/workspace-projects-client-page.test.tsx +100 -0
  705. package/src/components/ui/tu-do/boards/analytics/GanttChart.tsx +419 -0
  706. package/src/components/ui/tu-do/boards/analytics/GanttControls.tsx +123 -0
  707. package/src/components/ui/tu-do/boards/analytics/GanttHeader.tsx +48 -0
  708. package/src/components/ui/tu-do/boards/analytics/GanttTimeline.tsx +355 -0
  709. package/src/components/ui/tu-do/boards/analytics/StatusDistribution.tsx +130 -0
  710. package/src/components/ui/tu-do/boards/analytics/TaskCreationAnalytics.tsx +285 -0
  711. package/src/components/ui/tu-do/boards/analytics/TaskDetailCard.tsx +270 -0
  712. package/src/components/ui/tu-do/boards/analytics/TaskGroup.tsx +282 -0
  713. package/src/components/ui/tu-do/boards/analytics/TaskWorkflowAnalytics.tsx +280 -0
  714. package/src/components/ui/tu-do/boards/board-selector.tsx +301 -0
  715. package/src/components/ui/tu-do/boards/board-share-dialog.tsx +280 -0
  716. package/src/components/ui/tu-do/boards/boardId/__tests__/list-actions.test.tsx +199 -0
  717. package/src/components/ui/tu-do/boards/boardId/board-column-initial-load.test.ts +38 -0
  718. package/src/components/ui/tu-do/boards/boardId/board-column.tsx +755 -0
  719. package/src/components/ui/tu-do/boards/boardId/board-text-utils.test.ts +24 -0
  720. package/src/components/ui/tu-do/boards/boardId/board-text-utils.ts +11 -0
  721. package/src/components/ui/tu-do/boards/boardId/enhanced-task-list.tsx +536 -0
  722. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/__tests__/bulk-mutations-move.test.tsx +176 -0
  723. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-actions-bar.tsx +94 -0
  724. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-actions-menu.tsx +689 -0
  725. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-custom-date-dialog.tsx +82 -0
  726. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-delete-dialog.tsx +58 -0
  727. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +471 -0
  728. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +657 -0
  729. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-assignees.ts +429 -0
  730. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-labels.ts +294 -0
  731. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations-projects.ts +316 -0
  732. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-relations.ts +12 -0
  733. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +499 -0
  734. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-i18n.ts +524 -0
  735. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-types.ts +34 -0
  736. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-utils.ts +60 -0
  737. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operations.ts +312 -0
  738. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-personal-external-move.ts +132 -0
  739. package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +42 -0
  740. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-applied-sets.ts +79 -0
  741. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-bulk-resources.ts +58 -0
  742. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-filtered-resources.ts +54 -0
  743. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +63 -0
  744. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/auto-scroll.ts +86 -0
  745. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +62 -0
  746. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/drag-preview.tsx +98 -0
  747. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/kanban-sort-helpers.ts +76 -0
  748. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +325 -0
  749. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-geometry.test.ts +67 -0
  750. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-geometry.ts +94 -0
  751. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +156 -0
  752. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-pending.test.ts +37 -0
  753. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-pending.ts +42 -0
  754. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-preview.test.ts +318 -0
  755. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-preview.ts +260 -0
  756. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-types.ts +39 -0
  757. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.test.ts +686 -0
  758. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +1503 -0
  759. package/src/components/ui/tu-do/boards/boardId/kanban/kanban-constants.ts +43 -0
  760. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-column-width.ts +30 -0
  761. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +383 -0
  762. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +228 -0
  763. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +221 -0
  764. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-tasks.test.ts +267 -0
  765. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-tasks.ts +112 -0
  766. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +45 -0
  767. package/src/components/ui/tu-do/boards/boardId/kanban/selection/use-keyboard-shortcuts.ts +137 -0
  768. package/src/components/ui/tu-do/boards/boardId/kanban/selection/use-multi-select.ts +119 -0
  769. package/src/components/ui/tu-do/boards/boardId/kanban.tsx +495 -0
  770. package/src/components/ui/tu-do/boards/boardId/list-actions.tsx +522 -0
  771. package/src/components/ui/tu-do/boards/boardId/menus/__tests__/task-estimation-menu.test.tsx +261 -0
  772. package/src/components/ui/tu-do/boards/boardId/menus/__tests__/task-menus.test.tsx +491 -0
  773. package/src/components/ui/tu-do/boards/boardId/menus/index.ts +11 -0
  774. package/src/components/ui/tu-do/boards/boardId/menus/task-assignees-menu.tsx +176 -0
  775. package/src/components/ui/tu-do/boards/boardId/menus/task-blocking-menu.tsx +304 -0
  776. package/src/components/ui/tu-do/boards/boardId/menus/task-due-date-menu.tsx +180 -0
  777. package/src/components/ui/tu-do/boards/boardId/menus/task-estimation-menu.tsx +103 -0
  778. package/src/components/ui/tu-do/boards/boardId/menus/task-labels-menu.tsx +134 -0
  779. package/src/components/ui/tu-do/boards/boardId/menus/task-move-menu.tsx +66 -0
  780. package/src/components/ui/tu-do/boards/boardId/menus/task-parent-menu.tsx +228 -0
  781. package/src/components/ui/tu-do/boards/boardId/menus/task-picker-popover.tsx +300 -0
  782. package/src/components/ui/tu-do/boards/boardId/menus/task-priority-menu.tsx +176 -0
  783. package/src/components/ui/tu-do/boards/boardId/menus/task-projects-menu.tsx +143 -0
  784. package/src/components/ui/tu-do/boards/boardId/menus/task-related-menu.tsx +242 -0
  785. package/src/components/ui/tu-do/boards/boardId/status-grouped-board.tsx +533 -0
  786. package/src/components/ui/tu-do/boards/boardId/status-section.tsx +274 -0
  787. package/src/components/ui/tu-do/boards/boardId/task-actions.tsx +675 -0
  788. package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +41 -0
  789. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardCheckbox.tsx +47 -0
  790. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardDates.tsx +106 -0
  791. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardHeader.tsx +97 -0
  792. package/src/components/ui/tu-do/boards/boardId/task-card/TaskCardMetadata.tsx +152 -0
  793. package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +109 -0
  794. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.test.ts +61 -0
  795. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +87 -0
  796. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-label-options.ts +24 -0
  797. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-visibility.test.ts +41 -0
  798. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-visibility.ts +14 -0
  799. package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +2543 -0
  800. package/src/components/ui/tu-do/boards/boardId/task-dialogs/BoardEstimationConfigDialog.tsx +499 -0
  801. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskCustomDateDialog.tsx +109 -0
  802. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskDeleteDialog.tsx +96 -0
  803. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskNewLabelDialog.tsx +178 -0
  804. package/src/components/ui/tu-do/boards/boardId/task-dialogs/TaskNewProjectDialog.tsx +127 -0
  805. package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +986 -0
  806. package/src/components/ui/tu-do/boards/boardId/task-form.tsx +498 -0
  807. package/src/components/ui/tu-do/boards/boardId/task-list-drag-preview.test.ts +101 -0
  808. package/src/components/ui/tu-do/boards/boardId/task-list-form.tsx +91 -0
  809. package/src/components/ui/tu-do/boards/boardId/task-list.tsx +513 -0
  810. package/src/components/ui/tu-do/boards/boardId/task-parent-badge-state.test.ts +64 -0
  811. package/src/components/ui/tu-do/boards/boardId/task-parent-badge-state.ts +31 -0
  812. package/src/components/ui/tu-do/boards/boardId/task.tsx +2 -0
  813. package/src/components/ui/tu-do/boards/boardId/timeline/task-edit-dialog.tsx +109 -0
  814. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-display.ts +94 -0
  815. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-grid.tsx +380 -0
  816. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-task-row.tsx +350 -0
  817. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-toolbar.tsx +347 -0
  818. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.test.ts +134 -0
  819. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.ts +468 -0
  820. package/src/components/ui/tu-do/boards/boardId/timeline-board.test.tsx +217 -0
  821. package/src/components/ui/tu-do/boards/boardId/timeline-board.tsx +793 -0
  822. package/src/components/ui/tu-do/boards/boards-list-skeleton.tsx +62 -0
  823. package/src/components/ui/tu-do/boards/columns.tsx +159 -0
  824. package/src/components/ui/tu-do/boards/copy-board-dialog.tsx +156 -0
  825. package/src/components/ui/tu-do/boards/enhanced-boards-view.tsx +347 -0
  826. package/src/components/ui/tu-do/boards/form.tsx +264 -0
  827. package/src/components/ui/tu-do/boards/quick-create-board-dialog.tsx +75 -0
  828. package/src/components/ui/tu-do/boards/row-actions.tsx +397 -0
  829. package/src/components/ui/tu-do/boards/workspace-projects-client-page.tsx +182 -0
  830. package/src/components/ui/tu-do/boards/workspace-projects-page.tsx +155 -0
  831. package/src/components/ui/tu-do/cycles/task-cycles-client.tsx +744 -0
  832. package/src/components/ui/tu-do/cycles/task-cycles-page.tsx +103 -0
  833. package/src/components/ui/tu-do/drafts/draft-card.tsx +204 -0
  834. package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +197 -0
  835. package/src/components/ui/tu-do/drafts/drafts-page.tsx +105 -0
  836. package/src/components/ui/tu-do/drafts/task-drafts-page.tsx +90 -0
  837. package/src/components/ui/tu-do/estimates/client.tsx +292 -0
  838. package/src/components/ui/tu-do/estimates/edit-estimation-dialog.tsx +374 -0
  839. package/src/components/ui/tu-do/estimates/task-estimates-page.tsx +57 -0
  840. package/src/components/ui/tu-do/estimates/use-task-estimates.ts +319 -0
  841. package/src/components/ui/tu-do/habits/client.tsx +260 -0
  842. package/src/components/ui/tu-do/habits/habit-card.tsx +183 -0
  843. package/src/components/ui/tu-do/habits/habit-form-dialog.tsx +701 -0
  844. package/src/components/ui/tu-do/habits/habits-page.tsx +27 -0
  845. package/src/components/ui/tu-do/hooks/__tests__/useDraftPersistence.test.ts +494 -0
  846. package/src/components/ui/tu-do/hooks/__tests__/useTaskDialog.test.tsx +127 -0
  847. package/src/components/ui/tu-do/hooks/__tests__/useTaskDialogState.test.ts +217 -0
  848. package/src/components/ui/tu-do/hooks/__tests__/useTaskLabelManagement.test.tsx +524 -0
  849. package/src/components/ui/tu-do/hooks/useDraftPersistence.ts +199 -0
  850. package/src/components/ui/tu-do/hooks/useTaskCardRelationships.ts +340 -0
  851. package/src/components/ui/tu-do/hooks/useTaskDialog.ts +101 -0
  852. package/src/components/ui/tu-do/hooks/useTaskDialogState.ts +145 -0
  853. package/src/components/ui/tu-do/hooks/useTaskFormState.ts +206 -0
  854. package/src/components/ui/tu-do/hooks/useTaskKeyboardShortcuts.ts +58 -0
  855. package/src/components/ui/tu-do/hooks/useTaskLabelManagement.ts +416 -0
  856. package/src/components/ui/tu-do/hooks/useTaskProjectManagement.ts +461 -0
  857. package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +921 -0
  858. package/src/components/ui/tu-do/initiatives/task-initiatives-page.tsx +116 -0
  859. package/src/components/ui/tu-do/labels/client.tsx +201 -0
  860. package/src/components/ui/tu-do/labels/components/delete-label-dialog.tsx +57 -0
  861. package/src/components/ui/tu-do/labels/components/label-card.tsx +86 -0
  862. package/src/components/ui/tu-do/labels/components/label-dialog.tsx +259 -0
  863. package/src/components/ui/tu-do/labels/components/label-list.tsx +83 -0
  864. package/src/components/ui/tu-do/labels/hooks/use-task-labels.ts +170 -0
  865. package/src/components/ui/tu-do/labels/task-labels-page.tsx +53 -0
  866. package/src/components/ui/tu-do/labels/types.ts +6 -0
  867. package/src/components/ui/tu-do/logs/columns.tsx +755 -0
  868. package/src/components/ui/tu-do/logs/logs-client.tsx +1006 -0
  869. package/src/components/ui/tu-do/logs/logs-timeline.tsx +2483 -0
  870. package/src/components/ui/tu-do/logs/task-logs-page.tsx +59 -0
  871. package/src/components/ui/tu-do/my-tasks/__tests__/my-tasks-content.test.tsx +408 -0
  872. package/src/components/ui/tu-do/my-tasks/__tests__/use-my-tasks-query.test.ts +469 -0
  873. package/src/components/ui/tu-do/my-tasks/__tests__/use-my-tasks-state.test.ts +1017 -0
  874. package/src/components/ui/tu-do/my-tasks/__tests__/use-task-context-actions.test.ts +516 -0
  875. package/src/components/ui/tu-do/my-tasks/ai-credit-indicator.tsx +143 -0
  876. package/src/components/ui/tu-do/my-tasks/board-selector-dialog.tsx +239 -0
  877. package/src/components/ui/tu-do/my-tasks/command-bar.tsx +1351 -0
  878. package/src/components/ui/tu-do/my-tasks/label-project-filter.tsx +194 -0
  879. package/src/components/ui/tu-do/my-tasks/my-task-context-menu.tsx +356 -0
  880. package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +304 -0
  881. package/src/components/ui/tu-do/my-tasks/my-tasks-data-loader.tsx +17 -0
  882. package/src/components/ui/tu-do/my-tasks/my-tasks-filters.tsx +258 -0
  883. package/src/components/ui/tu-do/my-tasks/my-tasks-header.tsx +121 -0
  884. package/src/components/ui/tu-do/my-tasks/my-tasks-page.tsx +40 -0
  885. package/src/components/ui/tu-do/my-tasks/personal-placement-dialog.tsx +188 -0
  886. package/src/components/ui/tu-do/my-tasks/task-filter.tsx +235 -0
  887. package/src/components/ui/tu-do/my-tasks/task-list-with-completion.tsx +782 -0
  888. package/src/components/ui/tu-do/my-tasks/task-list.tsx +258 -0
  889. package/src/components/ui/tu-do/my-tasks/task-preview-dialog.tsx +1597 -0
  890. package/src/components/ui/tu-do/my-tasks/task-section.tsx +261 -0
  891. package/src/components/ui/tu-do/my-tasks/use-my-tasks-query.ts +140 -0
  892. package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +983 -0
  893. package/src/components/ui/tu-do/my-tasks/use-task-context-actions.ts +332 -0
  894. package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +121 -0
  895. package/src/components/ui/tu-do/notes/note-list.tsx +799 -0
  896. package/src/components/ui/tu-do/notes/notes-content.tsx +178 -0
  897. package/src/components/ui/tu-do/notes/notes-page.tsx +27 -0
  898. package/src/components/ui/tu-do/projects/components/index.ts +11 -0
  899. package/src/components/ui/tu-do/projects/components/project-actions-menu.tsx +66 -0
  900. package/src/components/ui/tu-do/projects/components/project-badges.tsx +84 -0
  901. package/src/components/ui/tu-do/projects/components/project-filter-menu.tsx +170 -0
  902. package/src/components/ui/tu-do/projects/components/project-grid-card.tsx +182 -0
  903. package/src/components/ui/tu-do/projects/components/project-list-item.tsx +179 -0
  904. package/src/components/ui/tu-do/projects/components/project-metrics.tsx +87 -0
  905. package/src/components/ui/tu-do/projects/components/project-progress-meter.tsx +33 -0
  906. package/src/components/ui/tu-do/projects/components/project-sort-menu.tsx +71 -0
  907. package/src/components/ui/tu-do/projects/components/projects-empty-state.tsx +38 -0
  908. package/src/components/ui/tu-do/projects/components/projects-loading-state.tsx +26 -0
  909. package/src/components/ui/tu-do/projects/components/projects-toolbar.tsx +179 -0
  910. package/src/components/ui/tu-do/projects/dialogs/create-project-dialog.tsx +117 -0
  911. package/src/components/ui/tu-do/projects/dialogs/edit-project-dialog.tsx +125 -0
  912. package/src/components/ui/tu-do/projects/dialogs/index.ts +3 -0
  913. package/src/components/ui/tu-do/projects/dialogs/manage-tasks-dialog.tsx +205 -0
  914. package/src/components/ui/tu-do/projects/hooks/index.ts +2 -0
  915. package/src/components/ui/tu-do/projects/hooks/use-project-filters.ts +248 -0
  916. package/src/components/ui/tu-do/projects/hooks/use-task-projects.ts +238 -0
  917. package/src/components/ui/tu-do/projects/projectId/components/__tests__/tasks-tab-layout.test.tsx +163 -0
  918. package/src/components/ui/tu-do/projects/projectId/components/documents-tab.tsx +90 -0
  919. package/src/components/ui/tu-do/projects/projectId/components/index.ts +9 -0
  920. package/src/components/ui/tu-do/projects/projectId/components/overview/description-card.tsx +77 -0
  921. package/src/components/ui/tu-do/projects/projectId/components/overview/linked-documents-card.tsx +81 -0
  922. package/src/components/ui/tu-do/projects/projectId/components/overview/linked-tasks-card.tsx +85 -0
  923. package/src/components/ui/tu-do/projects/projectId/components/overview/updates-card.tsx +85 -0
  924. package/src/components/ui/tu-do/projects/projectId/components/overview-tab.tsx +35 -0
  925. package/src/components/ui/tu-do/projects/projectId/components/project-configuration.tsx +229 -0
  926. package/src/components/ui/tu-do/projects/projectId/components/project-header.tsx +115 -0
  927. package/src/components/ui/tu-do/projects/projectId/components/project-lead-selector.tsx +55 -0
  928. package/src/components/ui/tu-do/projects/projectId/components/project-overview-context.tsx +82 -0
  929. package/src/components/ui/tu-do/projects/projectId/components/project-sidebar.tsx +246 -0
  930. package/src/components/ui/tu-do/projects/projectId/components/tasks-tab.tsx +264 -0
  931. package/src/components/ui/tu-do/projects/projectId/components/update-card.tsx +162 -0
  932. package/src/components/ui/tu-do/projects/projectId/components/updates-tab.tsx +129 -0
  933. package/src/components/ui/tu-do/projects/projectId/dialogs/index.ts +1 -0
  934. package/src/components/ui/tu-do/projects/projectId/dialogs/link-task-dialog.tsx +114 -0
  935. package/src/components/ui/tu-do/projects/projectId/hooks/index.ts +4 -0
  936. package/src/components/ui/tu-do/projects/projectId/hooks/use-animation-variants.ts +68 -0
  937. package/src/components/ui/tu-do/projects/projectId/hooks/use-project-form.ts +214 -0
  938. package/src/components/ui/tu-do/projects/projectId/hooks/use-project-updates.ts +209 -0
  939. package/src/components/ui/tu-do/projects/projectId/hooks/use-task-linking.ts +101 -0
  940. package/src/components/ui/tu-do/projects/projectId/task-project-detail-page-client.tsx +85 -0
  941. package/src/components/ui/tu-do/projects/projectId/task-project-detail-page.tsx +78 -0
  942. package/src/components/ui/tu-do/projects/projectId/task-project-detail.tsx +365 -0
  943. package/src/components/ui/tu-do/projects/projectId/types.ts +50 -0
  944. package/src/components/ui/tu-do/projects/task-projects-client.tsx +226 -0
  945. package/src/components/ui/tu-do/projects/task-projects-page.tsx +97 -0
  946. package/src/components/ui/tu-do/projects/types.ts +59 -0
  947. package/src/components/ui/tu-do/providers/__tests__/task-dialog-provider.test.tsx +404 -0
  948. package/src/components/ui/tu-do/providers/task-dialog-provider.tsx +721 -0
  949. package/src/components/ui/tu-do/providers/workspace-presence-provider.tsx +88 -0
  950. package/src/components/ui/tu-do/shared/AccessibleButton.tsx +79 -0
  951. package/src/components/ui/tu-do/shared/__tests__/assignee-select.test.tsx +72 -0
  952. package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +152 -0
  953. package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +172 -0
  954. package/src/components/ui/tu-do/shared/__tests__/board-query-cache.test.ts +219 -0
  955. package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +613 -0
  956. package/src/components/ui/tu-do/shared/__tests__/create-list-dialog.test.tsx +118 -0
  957. package/src/components/ui/tu-do/shared/__tests__/task-detail-page.test.tsx +170 -0
  958. package/src/components/ui/tu-do/shared/__tests__/task-dialog-manager.test.tsx +708 -0
  959. package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +85 -0
  960. package/src/components/ui/tu-do/shared/__tests__/use-progressive-board-loader.test.tsx +588 -0
  961. package/src/components/ui/tu-do/shared/assignee-select.tsx +541 -0
  962. package/src/components/ui/tu-do/shared/board-broadcast-context.tsx +45 -0
  963. package/src/components/ui/tu-do/shared/board-client.tsx +268 -0
  964. package/src/components/ui/tu-do/shared/board-config-storage.ts +88 -0
  965. package/src/components/ui/tu-do/shared/board-header.tsx +1248 -0
  966. package/src/components/ui/tu-do/shared/board-layout-settings.tsx +1105 -0
  967. package/src/components/ui/tu-do/shared/board-query-cache.ts +157 -0
  968. package/src/components/ui/tu-do/shared/board-switcher.tsx +298 -0
  969. package/src/components/ui/tu-do/shared/board-user-presence-avatars.tsx +572 -0
  970. package/src/components/ui/tu-do/shared/board-views.tsx +847 -0
  971. package/src/components/ui/tu-do/shared/clear-menu-item.tsx +34 -0
  972. package/src/components/ui/tu-do/shared/create-list-dialog.tsx +401 -0
  973. package/src/components/ui/tu-do/shared/cursor-overlay-multi-wrapper.tsx +204 -0
  974. package/src/components/ui/tu-do/shared/cursor-overlay.tsx +78 -0
  975. package/src/components/ui/tu-do/shared/custom-date-picker/custom-date-picker-dialog.tsx +157 -0
  976. package/src/components/ui/tu-do/shared/description-overflow-warning-dialog.tsx +68 -0
  977. package/src/components/ui/tu-do/shared/edit-list-dialog.tsx +383 -0
  978. package/src/components/ui/tu-do/shared/empty-state-card.tsx +46 -0
  979. package/src/components/ui/tu-do/shared/estimation-mapping.test.ts +32 -0
  980. package/src/components/ui/tu-do/shared/estimation-mapping.ts +74 -0
  981. package/src/components/ui/tu-do/shared/estimation-utils.ts +54 -0
  982. package/src/components/ui/tu-do/shared/fade-setting-initializer.tsx +59 -0
  983. package/src/components/ui/tu-do/shared/label-chip.tsx +46 -0
  984. package/src/components/ui/tu-do/shared/list-view-context-menu.test.tsx +150 -0
  985. package/src/components/ui/tu-do/shared/list-view-sorting.test.ts +50 -0
  986. package/src/components/ui/tu-do/shared/list-view-sorting.ts +108 -0
  987. package/src/components/ui/tu-do/shared/list-view.tsx +987 -0
  988. package/src/components/ui/tu-do/shared/mention-system/__tests__/mention-system.test.ts +250 -0
  989. package/src/components/ui/tu-do/shared/mention-system/mention-menu.tsx +217 -0
  990. package/src/components/ui/tu-do/shared/mention-system/types.ts +141 -0
  991. package/src/components/ui/tu-do/shared/mention-system/use-mention-suggestions.ts +244 -0
  992. package/src/components/ui/tu-do/shared/progressive-loader-context.tsx +45 -0
  993. package/src/components/ui/tu-do/shared/recent-sidebar-events.ts +58 -0
  994. package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +603 -0
  995. package/src/components/ui/tu-do/shared/relationship-task-identifier.ts +14 -0
  996. package/src/components/ui/tu-do/shared/slash-commands/__tests__/slash-commands.test.ts +315 -0
  997. package/src/components/ui/tu-do/shared/slash-commands/definitions.ts +167 -0
  998. package/src/components/ui/tu-do/shared/slash-commands/slash-command-menu.tsx +114 -0
  999. package/src/components/ui/tu-do/shared/sync-warning-dialog.tsx +133 -0
  1000. package/src/components/ui/tu-do/shared/task-board-errors.ts +19 -0
  1001. package/src/components/ui/tu-do/shared/task-detail-page.tsx +176 -0
  1002. package/src/components/ui/tu-do/shared/task-detail-server-page.tsx +37 -0
  1003. package/src/components/ui/tu-do/shared/task-dialog-manager.tsx +557 -0
  1004. package/src/components/ui/tu-do/shared/task-dialog-wrapper.tsx +28 -0
  1005. package/src/components/ui/tu-do/shared/task-edit-dialog/components/mobile-floating-save-button.tsx +46 -0
  1006. package/src/components/ui/tu-do/shared/task-edit-dialog/components/quick-settings-popover.tsx +164 -0
  1007. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-description-editor.tsx +491 -0
  1008. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-dialog-header.tsx +511 -0
  1009. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-picker-panel.tsx +220 -0
  1010. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-selector.tsx +127 -0
  1011. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-trigger-styles.ts +69 -0
  1012. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-name-input.test.tsx +140 -0
  1013. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-name-input.tsx +163 -0
  1014. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-suggestion-menus.tsx +148 -0
  1015. package/src/components/ui/tu-do/shared/task-edit-dialog/constants.ts +18 -0
  1016. package/src/components/ui/tu-do/shared/task-edit-dialog/context-menu-guard.test.ts +37 -0
  1017. package/src/components/ui/tu-do/shared/task-edit-dialog/description-diff-viewer.tsx +1665 -0
  1018. package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +715 -0
  1019. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-dialog-close.test.ts +218 -0
  1020. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-dialog-keyboard-shortcuts.test.ts +140 -0
  1021. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-overrides.test.ts +412 -0
  1022. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-realtime-sync.test.tsx +237 -0
  1023. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-task-yjs-sync.test.ts +190 -0
  1024. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-update-shared-task.test.ts +103 -0
  1025. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/task-api.ts +127 -0
  1026. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-editor-commands.ts +314 -0
  1027. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-suggestion-menus.ts +503 -0
  1028. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-change-detection.ts +175 -0
  1029. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-data.ts +332 -0
  1030. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dependencies.ts +773 -0
  1031. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dialog-close.ts +193 -0
  1032. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-dialog-keyboard-shortcuts.ts +365 -0
  1033. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-form-reset.ts +215 -0
  1034. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-form-state.ts +307 -0
  1035. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-mutations.ts +536 -0
  1036. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-overrides.ts +122 -0
  1037. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-realtime-sync.ts +271 -0
  1038. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.test.tsx +149 -0
  1039. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.ts +545 -0
  1040. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-revert.ts +140 -0
  1041. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-save.test.ts +206 -0
  1042. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-save.ts +1450 -0
  1043. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-snapshot.ts +59 -0
  1044. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-yjs-sync.ts +224 -0
  1045. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-update-shared-task.ts +55 -0
  1046. package/src/components/ui/tu-do/shared/task-edit-dialog/personal-overrides-section.tsx +348 -0
  1047. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/clickable-task-item.tsx +90 -0
  1048. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/index.ts +4 -0
  1049. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/subtask-action-buttons.tsx +140 -0
  1050. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/tab-button.tsx +76 -0
  1051. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/components/task-relationship-action-buttons.tsx +178 -0
  1052. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/dependencies-section.tsx +129 -0
  1053. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/index.ts +35 -0
  1054. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/parent-section.tsx +65 -0
  1055. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/related-section.tsx +76 -0
  1056. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/subtasks-section.tsx +82 -0
  1057. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/task-search-popover.tsx +229 -0
  1058. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/types/task-relationships.types.ts +186 -0
  1059. package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +320 -0
  1060. package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +748 -0
  1061. package/src/components/ui/tu-do/shared/task-edit-dialog/task-delete-dialog.tsx +104 -0
  1062. package/src/components/ui/tu-do/shared/task-edit-dialog/task-dialog-actions.tsx +213 -0
  1063. package/src/components/ui/tu-do/shared/task-edit-dialog/task-instances-section.tsx +173 -0
  1064. package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.tsx +1895 -0
  1065. package/src/components/ui/tu-do/shared/task-edit-dialog/task-relationships-properties.tsx +273 -0
  1066. package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +162 -0
  1067. package/src/components/ui/tu-do/shared/task-edit-dialog/types/pending-relationship.test.ts +52 -0
  1068. package/src/components/ui/tu-do/shared/task-edit-dialog/types/pending-relationship.ts +134 -0
  1069. package/src/components/ui/tu-do/shared/task-edit-dialog/types.ts +64 -0
  1070. package/src/components/ui/tu-do/shared/task-edit-dialog/user-display.test.ts +58 -0
  1071. package/src/components/ui/tu-do/shared/task-edit-dialog/user-display.ts +45 -0
  1072. package/src/components/ui/tu-do/shared/task-edit-dialog/utils/inline-task-target-list.test.ts +98 -0
  1073. package/src/components/ui/tu-do/shared/task-edit-dialog/utils/inline-task-target-list.ts +39 -0
  1074. package/src/components/ui/tu-do/shared/task-edit-dialog/utils.test.ts +404 -0
  1075. package/src/components/ui/tu-do/shared/task-edit-dialog/utils.ts +473 -0
  1076. package/src/components/ui/tu-do/shared/task-edit-dialog/yjs-prosemirror-compat.test.ts +65 -0
  1077. package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +2168 -0
  1078. package/src/components/ui/tu-do/shared/task-estimation-display.tsx +52 -0
  1079. package/src/components/ui/tu-do/shared/task-estimation-picker.tsx +223 -0
  1080. package/src/components/ui/tu-do/shared/task-filter.types.ts +65 -0
  1081. package/src/components/ui/tu-do/shared/task-label-selector.tsx +217 -0
  1082. package/src/components/ui/tu-do/shared/task-labels-display.test.tsx +51 -0
  1083. package/src/components/ui/tu-do/shared/task-labels-display.tsx +119 -0
  1084. package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +72 -0
  1085. package/src/components/ui/tu-do/shared/task-open-events.ts +94 -0
  1086. package/src/components/ui/tu-do/shared/task-projects-display.tsx +80 -0
  1087. package/src/components/ui/tu-do/shared/task-resource-search-field.tsx +49 -0
  1088. package/src/components/ui/tu-do/shared/task-resource-search-filters.ts +27 -0
  1089. package/src/components/ui/tu-do/shared/task-row-actions-menu.tsx +352 -0
  1090. package/src/components/ui/tu-do/shared/task-share-dialog/components/share-link-settings.tsx +86 -0
  1091. package/src/components/ui/tu-do/shared/task-share-dialog/components/shares-list.tsx +85 -0
  1092. package/src/components/ui/tu-do/shared/task-share-dialog/hooks/use-task-sharing.ts +296 -0
  1093. package/src/components/ui/tu-do/shared/task-share-dialog.tsx +144 -0
  1094. package/src/components/ui/tu-do/shared/task-url.ts +56 -0
  1095. package/src/components/ui/tu-do/shared/text-diff-viewer.tsx +55 -0
  1096. package/src/components/ui/tu-do/shared/types.ts +14 -0
  1097. package/src/components/ui/tu-do/shared/unsaved-changes-warning-dialog.tsx +71 -0
  1098. package/src/components/ui/tu-do/shared/use-progressive-board-loader.ts +310 -0
  1099. package/src/components/ui/tu-do/shared/user-avatar.tsx +46 -0
  1100. package/src/components/ui/tu-do/shared/user-presence-avatars.tsx +415 -0
  1101. package/src/components/ui/tu-do/shared/utils/translate-task-list-display-name.ts +28 -0
  1102. package/src/components/ui/tu-do/tasks-route-context.tsx +50 -0
  1103. package/src/components/ui/tu-do/templates/client.tsx +486 -0
  1104. package/src/components/ui/tu-do/templates/marketplace/client.tsx +451 -0
  1105. package/src/components/ui/tu-do/templates/marketplace/task-marketplace-page.tsx +169 -0
  1106. package/src/components/ui/tu-do/templates/save-as-template-dialog.tsx +381 -0
  1107. package/src/components/ui/tu-do/templates/task-templates-page.tsx +162 -0
  1108. package/src/components/ui/tu-do/templates/templateId/client.tsx +659 -0
  1109. package/src/components/ui/tu-do/templates/templateId/edit-template-dialog.tsx +300 -0
  1110. package/src/components/ui/tu-do/templates/templateId/share-template-dialog.tsx +261 -0
  1111. package/src/components/ui/tu-do/templates/templateId/task-template-detail-page-client.tsx +121 -0
  1112. package/src/components/ui/tu-do/templates/templateId/task-template-detail-page.tsx +89 -0
  1113. package/src/components/ui/tu-do/templates/templateId/use-template-dialog.tsx +165 -0
  1114. package/src/components/ui/tu-do/templates/types.ts +53 -0
  1115. package/src/components/ui/tu-do/utils/__tests__/label-colors.test.ts +43 -0
  1116. package/src/components/ui/tu-do/utils/__tests__/taskColorUtils.test.ts +267 -0
  1117. package/src/components/ui/tu-do/utils/__tests__/taskConstants.test.ts +178 -0
  1118. package/src/components/ui/tu-do/utils/__tests__/taskDateUtils.test.ts +226 -0
  1119. package/src/components/ui/tu-do/utils/__tests__/weekDateUtils.test.ts +182 -0
  1120. package/src/components/ui/tu-do/utils/label-colors.test.ts +15 -0
  1121. package/src/components/ui/tu-do/utils/label-colors.ts +59 -0
  1122. package/src/components/ui/tu-do/utils/taskColorUtils.ts +116 -0
  1123. package/src/components/ui/tu-do/utils/taskConstants.ts +102 -0
  1124. package/src/components/ui/tu-do/utils/taskDateUtils.ts +81 -0
  1125. package/src/components/ui/tu-do/utils/taskPriorityUtils.tsx +80 -0
  1126. package/src/components/ui/tu-do/utils/weekDateUtils.ts +64 -0
  1127. package/src/constants/boards.ts +9 -0
  1128. package/src/declarations.d.ts +2 -0
  1129. package/src/globals.css +609 -200
  1130. package/src/gsap.ts +2 -0
  1131. package/src/hooks/__tests__/supabase-provider.test.ts +346 -0
  1132. package/src/hooks/__tests__/use-calendar-readonly.test.tsx +90 -0
  1133. package/src/hooks/__tests__/use-forwarded-ref.test.tsx +127 -0
  1134. package/src/hooks/__tests__/use-local-storage.test.tsx +243 -0
  1135. package/src/hooks/__tests__/use-mobile.test.tsx +222 -0
  1136. package/src/hooks/__tests__/use-notifications-subscription.test.tsx +163 -0
  1137. package/src/hooks/__tests__/use-notifications.test.ts +59 -0
  1138. package/src/hooks/__tests__/use-stable-array.test.tsx +214 -0
  1139. package/src/hooks/__tests__/use-task-actions.test.tsx +1893 -0
  1140. package/src/hooks/__tests__/use-workspace-presence.test.tsx +217 -0
  1141. package/src/hooks/__tests__/useBoardRealtime.test.tsx +1156 -0
  1142. package/src/hooks/supabase-provider.ts +725 -0
  1143. package/src/hooks/task-actions-personal-external.ts +308 -0
  1144. package/src/hooks/time-blocking-provider.tsx +756 -0
  1145. package/src/hooks/use-ai-credits.ts +78 -0
  1146. package/src/hooks/use-analytics-filters.ts +269 -0
  1147. package/src/hooks/use-at-bottom.tsx +64 -0
  1148. package/src/hooks/use-board-actions.ts +213 -0
  1149. package/src/hooks/use-calendar-preferences.tsx +24 -0
  1150. package/src/hooks/use-calendar-sync.tsx +1184 -0
  1151. package/src/hooks/use-calendar.tsx +1972 -0
  1152. package/src/hooks/use-callback-ref.ts +1 -1
  1153. package/src/hooks/use-controllable-state.ts +3 -4
  1154. package/src/hooks/use-copy-to-clipboard.ts +1 -3
  1155. package/src/hooks/use-currency-formatter.ts +81 -0
  1156. package/src/hooks/use-debounce.ts +15 -0
  1157. package/src/hooks/use-dom-resolved-theme.ts +81 -0
  1158. package/src/hooks/use-enter-submit.tsx +23 -0
  1159. package/src/hooks/use-exchange-rates.ts +23 -0
  1160. package/src/hooks/use-finance-transaction-preferences.ts +58 -0
  1161. package/src/hooks/use-form.ts +8 -6
  1162. package/src/hooks/use-interest-preferences.ts +104 -0
  1163. package/src/hooks/use-local-storage.ts +42 -0
  1164. package/src/hooks/use-notifications.ts +704 -0
  1165. package/src/hooks/use-page-visibility.ts +27 -0
  1166. package/src/hooks/use-popover-manager.tsx +98 -0
  1167. package/src/hooks/use-semantic-task-search.ts +76 -0
  1168. package/src/hooks/use-session-history-query.ts +1 -0
  1169. package/src/hooks/use-stable-array.ts +23 -0
  1170. package/src/hooks/use-task-actions.ts +1915 -0
  1171. package/src/hooks/use-task-analytics.ts +354 -0
  1172. package/src/hooks/use-toast.ts +2 -3
  1173. package/src/hooks/use-user-config.ts +109 -0
  1174. package/src/hooks/use-view-transition.ts +69 -0
  1175. package/src/hooks/use-workspace-config.ts +49 -0
  1176. package/src/hooks/use-workspace-currency.ts +26 -0
  1177. package/src/hooks/use-workspace-members.ts +58 -0
  1178. package/src/hooks/use-workspace-permission.ts +61 -0
  1179. package/src/hooks/use-workspace-presence.ts +554 -0
  1180. package/src/hooks/use-workspace-user.ts +33 -0
  1181. package/src/hooks/use-yjs-collaboration.ts +297 -0
  1182. package/src/hooks/useBoardRealtime.ts +372 -0
  1183. package/src/hooks/useBoardRealtime.types.ts +45 -0
  1184. package/src/hooks/useBoardRealtimeEventHandler.ts +332 -0
  1185. package/src/hooks/useCursorTracking.ts +338 -0
  1186. package/src/hooks/useHorizontalScroll.ts +215 -0
  1187. package/src/hooks/usePresence.ts +272 -0
  1188. package/src/hooks/useSearchParams.tsx +133 -0
  1189. package/src/lib/__tests__/lunar-calendar.test.ts +137 -0
  1190. package/src/lib/calendar/planning-query-client.ts +197 -0
  1191. package/src/lib/calendar/preview-engine.ts +14 -0
  1192. package/src/lib/calendar-settings-resolver.ts +200 -0
  1193. package/src/lib/lunar-calendar.ts +71 -0
  1194. package/src/lib/template-background.ts +159 -0
  1195. package/src/lib/workspace-actions.ts +457 -0
  1196. package/src/utils/__tests__/label-colors.test.ts +219 -0
  1197. package/src/utils/__tests__/priority-styles.test.ts +78 -0
  1198. package/src/utils/label-colors.ts +4 -0
  1199. package/src/utils/priority-styles.ts +42 -0
  1200. package/src/xlsx.ts +3 -0
  1201. package/tsconfig.json +3 -11
  1202. package/tsconfig.typecheck.json +9 -0
  1203. package/vendor/xlsx-0.20.3.tgz +0 -0
  1204. package/vitest.config.ts +42 -0
  1205. package/vitest.setup.ts +37 -0
  1206. package/eslint.config.mjs +0 -20
  1207. package/rollup.config.js +0 -40
  1208. package/src/components/ui/icons.tsx +0 -506
  1209. package/src/components/ui/tag-input.tsx +0 -141
  1210. /package/src/hooks/{use-mobile.tsx → use-mobile.ts} +0 -0
@@ -0,0 +1,2543 @@
1
+ import { useSortable } from '@dnd-kit/sortable';
2
+ import { CSS } from '@dnd-kit/utilities';
3
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
4
+ import {
5
+ AlertCircle,
6
+ Archive,
7
+ ArrowUpCircle,
8
+ Ban,
9
+ Box,
10
+ Calendar,
11
+ Check,
12
+ CheckCircle2,
13
+ CircleSlash,
14
+ Clock,
15
+ Copy,
16
+ ExternalLink,
17
+ FileText,
18
+ Image as ImageIcon,
19
+ Link2,
20
+ ListChecks,
21
+ ListTodo,
22
+ ListTree,
23
+ Loader2,
24
+ MoreHorizontal,
25
+ MoveRight,
26
+ Play,
27
+ Share2,
28
+ SquareCenterlineDashedVertical,
29
+ Timer,
30
+ Trash2,
31
+ } from '@tuturuuu/icons';
32
+ import {
33
+ getWorkspaceTask,
34
+ listWorkspaceTaskLists,
35
+ listWorkspaceTaskProjects,
36
+ removeCurrentUserTaskPersonalPlacement,
37
+ } from '@tuturuuu/internal-api/tasks';
38
+ import type { Task } from '@tuturuuu/types/primitives/Task';
39
+ import type { TaskList } from '@tuturuuu/types/primitives/TaskList';
40
+ import { Badge } from '@tuturuuu/ui/badge';
41
+ import { Button } from '@tuturuuu/ui/button';
42
+ import { Card } from '@tuturuuu/ui/card';
43
+ import {
44
+ DropdownMenu,
45
+ DropdownMenuContent,
46
+ DropdownMenuItem,
47
+ DropdownMenuSeparator,
48
+ DropdownMenuTrigger,
49
+ } from '@tuturuuu/ui/dropdown-menu';
50
+ import { useCalendarPreferences } from '@tuturuuu/ui/hooks/use-calendar-preferences';
51
+ import { useTaskActions } from '@tuturuuu/ui/hooks/use-task-actions';
52
+ import { useWorkspaceMembers } from '@tuturuuu/ui/hooks/use-workspace-members';
53
+ import {
54
+ HoverCard,
55
+ HoverCardContent,
56
+ HoverCardTrigger,
57
+ } from '@tuturuuu/ui/hover-card';
58
+ import { toast } from '@tuturuuu/ui/sonner';
59
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@tuturuuu/ui/tooltip';
60
+ import { cn } from '@tuturuuu/utils/format';
61
+ import {
62
+ createTask,
63
+ getPersonalExternalStagingListId,
64
+ getTicketIdentifier,
65
+ useBoardConfig,
66
+ useWorkspaceLabels,
67
+ } from '@tuturuuu/utils/task-helper';
68
+ import { isTaskBoardResolvedStatus } from '@tuturuuu/utils/task-list-status';
69
+ import { getDescriptionMetadata } from '@tuturuuu/utils/text-helper';
70
+ import { getTimeFormatPattern } from '@tuturuuu/utils/time-helper';
71
+ import { format, formatDistanceToNow } from 'date-fns';
72
+ import { enUS, vi } from 'date-fns/locale';
73
+ import Link from 'next/link';
74
+ import { useParams } from 'next/navigation';
75
+ import { useLocale, useTranslations } from 'next-intl';
76
+ import React, {
77
+ useCallback,
78
+ useEffect,
79
+ useMemo,
80
+ useRef,
81
+ useState,
82
+ } from 'react';
83
+ import {
84
+ enqueueTaskCardRelationshipRequest,
85
+ useTaskCardRelationships,
86
+ } from '../../../hooks/useTaskCardRelationships';
87
+ import { useTaskDialog } from '../../../hooks/useTaskDialog';
88
+ import { useTaskDialogState } from '../../../hooks/useTaskDialogState';
89
+ import { useTaskLabelManagement } from '../../../hooks/useTaskLabelManagement';
90
+ import { useTaskProjectManagement } from '../../../hooks/useTaskProjectManagement';
91
+ import { useTaskDialogContext } from '../../../providers/task-dialog-provider';
92
+ import { AssigneeSelect } from '../../../shared/assignee-select';
93
+ import { useBoardBroadcast } from '../../../shared/board-broadcast-context';
94
+ import { CreateListDialog } from '../../../shared/create-list-dialog';
95
+ import { formatRelationshipTaskIdentifier } from '../../../shared/relationship-task-identifier';
96
+ import { TaskEstimationDisplay } from '../../../shared/task-estimation-display';
97
+ import { TaskLabelsDisplay } from '../../../shared/task-labels-display';
98
+ import { TaskShareDialog } from '../../../shared/task-share-dialog';
99
+ import { TaskViewerAvatarsComponent } from '../../../shared/user-presence-avatars';
100
+ import { useTasksHref } from '../../../tasks-route-context';
101
+ import {
102
+ getCardColorClasses as getCardColorClassesUtil,
103
+ getListTextColorClass,
104
+ getTicketBadgeColorClasses,
105
+ } from '../../../utils/taskColorUtils';
106
+ import {
107
+ DESTINATION_TONE_COLORS,
108
+ getRandomNewLabelColor,
109
+ } from '../../../utils/taskConstants';
110
+ import { formatSmartDate } from '../../../utils/taskDateUtils';
111
+ import { getPriorityIndicator } from '../../../utils/taskPriorityUtils';
112
+ import { sortByDisplayName } from '../board-text-utils';
113
+ import {
114
+ TaskAssigneesMenu,
115
+ TaskBlockingMenu,
116
+ TaskDueDateMenu,
117
+ TaskEstimationMenu,
118
+ TaskLabelsMenu,
119
+ TaskMoveMenu,
120
+ TaskParentMenu,
121
+ TaskPriorityMenu,
122
+ TaskProjectsMenu,
123
+ TaskRelatedMenu,
124
+ } from '../menus';
125
+ import { TaskActions } from '../task-actions';
126
+ import { TaskCustomDateDialog } from '../task-dialogs/TaskCustomDateDialog';
127
+ import { TaskDeleteDialog } from '../task-dialogs/TaskDeleteDialog';
128
+ import { TaskNewLabelDialog } from '../task-dialogs/TaskNewLabelDialog';
129
+ import { TaskNewProjectDialog } from '../task-dialogs/TaskNewProjectDialog';
130
+ import { getTaskCardParentBadgeState } from '../task-parent-badge-state';
131
+ import { TaskCardCheckbox } from './TaskCardCheckbox';
132
+ import { areTaskCardPropsEqual } from './task-card-comparator';
133
+ import { mergeTaskCardLabelOptions } from './task-card-label-options';
134
+ import { getTaskCardVisibilityState } from './task-card-visibility';
135
+
136
+ export interface TaskCardProps {
137
+ task: Task;
138
+ boardId: string;
139
+ workspaceId?: string;
140
+ taskList?: TaskList;
141
+ isOverlay?: boolean;
142
+ onUpdate: () => void;
143
+ availableLists?: TaskList[]; // Optional: pass from parent to avoid redundant API calls
144
+ isSelected?: boolean;
145
+ isMultiSelectMode?: boolean;
146
+ isPersonalWorkspace?: boolean;
147
+ onSelect?: (taskId: string, event: React.MouseEvent) => void;
148
+ onClearSelection?: () => void;
149
+ dragDisabled?: boolean;
150
+ sortableId?: string;
151
+ suppressSortableTransform?: boolean;
152
+ optimisticUpdateInProgress?: Set<string>;
153
+ selectedTasks?: Set<string>; // For bulk operations
154
+ bulkUpdateCustomDueDate?: (date: Date | null) => Promise<void>; // From useBulkOperations
155
+ }
156
+
157
+ // Memoized full TaskCard
158
+ function TaskCardInner({
159
+ task,
160
+ boardId,
161
+ workspaceId,
162
+ taskList,
163
+ isOverlay,
164
+ onUpdate,
165
+ availableLists: propAvailableLists,
166
+ isSelected = false,
167
+ isMultiSelectMode = false,
168
+ isPersonalWorkspace = false,
169
+ onSelect,
170
+ onClearSelection,
171
+ dragDisabled: dragDisabledProp = false,
172
+ sortableId: sortableIdProp,
173
+ suppressSortableTransform = false,
174
+ optimisticUpdateInProgress,
175
+ selectedTasks,
176
+ bulkUpdateCustomDueDate,
177
+ }: TaskCardProps) {
178
+ const { wsId: rawWsId } = useParams();
179
+ const wsId = Array.isArray(rawWsId) ? rawWsId[0] : rawWsId;
180
+ const queryClient = useQueryClient();
181
+ const broadcast = useBoardBroadcast();
182
+ const t = useTranslations('common');
183
+ const tTasks = useTranslations('ws-tasks');
184
+ const taskBoardT = useTranslations();
185
+ const tasksHref = useTasksHref();
186
+ const locale = useLocale();
187
+ const dateLocale = locale === 'vi' ? vi : enUS;
188
+ const { weekStartsOn, timeFormat } = useCalendarPreferences();
189
+ const timePattern = getTimeFormatPattern(timeFormat);
190
+
191
+ const [isLoading, setIsLoading] = useState(false);
192
+ const [menuOpen, setMenuOpen] = useState(false);
193
+ const [isCreateListDialogOpen, setIsCreateListDialogOpen] = useState(false);
194
+ const [menuGuardUntil, setMenuGuardUntil] = useState(0);
195
+ const [shareDialogOpen, setShareDialogOpen] = useState(false);
196
+ const [isInViewport, setIsInViewport] = useState(false);
197
+ const [relationshipMenusOpen, setRelationshipMenusOpen] = useState({
198
+ parent: false,
199
+ dependencies: false,
200
+ related: false,
201
+ });
202
+ const isAnyRelationshipMenuOpen =
203
+ relationshipMenusOpen.parent ||
204
+ relationshipMenusOpen.dependencies ||
205
+ relationshipMenusOpen.related;
206
+ const cardElementRef = useRef<HTMLDivElement | null>(null);
207
+
208
+ // Use extracted dialog state management hook
209
+ const { state: dialogState, actions: dialogActions } = useTaskDialogState();
210
+ const { createSubtask } = useTaskDialogContext();
211
+
212
+ // Use centralized task dialog
213
+ const { openTask, openTaskById } = useTaskDialog();
214
+
215
+ // Guarded select handler for Radix DropdownMenuItem to avoid immediate action on context open
216
+ const handleMenuItemSelect = useCallback(
217
+ (e: Event, action: () => void) => {
218
+ if (Date.now() < menuGuardUntil) {
219
+ // Keep menu open by preventing default close
220
+ if (e && typeof (e as any).preventDefault === 'function') {
221
+ (e as any).preventDefault();
222
+ }
223
+ return;
224
+ }
225
+ action();
226
+ },
227
+ [menuGuardUntil]
228
+ );
229
+
230
+ // Use React Query hooks for shared data (cached across all task cards)
231
+ const workspaceContextWsId = workspaceId ?? wsId;
232
+ const { data: boardConfig } = useBoardConfig(boardId, workspaceContextWsId);
233
+ const effectiveWorkspaceId = workspaceId ?? boardConfig?.ws_id ?? wsId;
234
+ const taskShareWsId = effectiveWorkspaceId;
235
+ const { data: workspaceLabels = [], isLoading: labelsLoading } =
236
+ useWorkspaceLabels(effectiveWorkspaceId);
237
+
238
+ // Local state for UI interactions
239
+ const [estimationSaving, setEstimationSaving] = useState(false);
240
+
241
+ // Use extracted label management hook
242
+ const {
243
+ toggleTaskLabel,
244
+ createNewLabel,
245
+ newLabelName,
246
+ setNewLabelName,
247
+ newLabelColor,
248
+ setNewLabelColor,
249
+ creatingLabel,
250
+ } = useTaskLabelManagement({
251
+ task,
252
+ boardId,
253
+ workspaceLabels,
254
+ workspaceId: effectiveWorkspaceId,
255
+ selectedTasks,
256
+ isMultiSelectMode,
257
+ onClearSelection,
258
+ labelCacheWorkspaceIds: [
259
+ effectiveWorkspaceId,
260
+ workspaceContextWsId,
261
+ wsId,
262
+ task.source_workspace_id ?? undefined,
263
+ ],
264
+ });
265
+
266
+ const openNewLabelDialog = () => {
267
+ setNewLabelColor((previousColor) => getRandomNewLabelColor(previousColor));
268
+ dialogActions.openNewLabelDialog();
269
+ };
270
+
271
+ // Fetch workspace projects
272
+ const { data: workspaceProjects = [], isLoading: projectsLoading } = useQuery(
273
+ {
274
+ queryKey: ['task_projects', effectiveWorkspaceId],
275
+ queryFn: async () => {
276
+ if (!effectiveWorkspaceId) return [];
277
+ return listWorkspaceTaskProjects(effectiveWorkspaceId);
278
+ },
279
+ enabled: !!effectiveWorkspaceId,
280
+ staleTime: 5 * 60 * 1000, // 5 minutes - projects rarely change
281
+ }
282
+ );
283
+
284
+ // Use extracted project management hook
285
+ const {
286
+ toggleTaskProject,
287
+ newProjectName,
288
+ setNewProjectName,
289
+ creatingProject,
290
+ createNewProject,
291
+ } = useTaskProjectManagement({
292
+ task,
293
+ boardId,
294
+ workspaceProjects,
295
+ workspaceId: effectiveWorkspaceId,
296
+ selectedTasks,
297
+ isMultiSelectMode,
298
+ onClearSelection,
299
+ });
300
+
301
+ // Fetch workspace members
302
+ const { data: workspaceMembers = [], isLoading: membersLoading } =
303
+ useWorkspaceMembers(effectiveWorkspaceId, {
304
+ enabled: !!effectiveWorkspaceId && !isPersonalWorkspace,
305
+ });
306
+
307
+ const relationshipSummary =
308
+ task.relationship_summary ??
309
+ ({
310
+ parent_task_id: null,
311
+ parent_task: null,
312
+ child_count: 0,
313
+ completed_child_count: 0,
314
+ blocked_by_count: 0,
315
+ blocking_count: 0,
316
+ related_count: 0,
317
+ } as const);
318
+ const shouldLoadRelationshipPreview =
319
+ isInViewport &&
320
+ (isAnyRelationshipMenuOpen || relationshipSummary.blocked_by_count > 0);
321
+
322
+ // Use task relationships hook for managing parent/child/blocking/related tasks
323
+ const {
324
+ parentTask,
325
+ childTasks,
326
+ blocking: blockingTasks,
327
+ blockedBy: blockedByTasks,
328
+ relatedTasks,
329
+ setParentTask,
330
+ removeParentTask,
331
+ addBlockingTask,
332
+ removeBlockingTask,
333
+ addBlockedByTask,
334
+ removeBlockedByTask,
335
+ addRelatedTask,
336
+ removeRelatedTask,
337
+ isSaving: relationshipSaving,
338
+ savingTaskId: relationshipSavingTaskId,
339
+ hasLoadedRelationships,
340
+ } = useTaskCardRelationships({
341
+ taskId: task.id,
342
+ boardId,
343
+ wsId: effectiveWorkspaceId,
344
+ enabled: shouldLoadRelationshipPreview,
345
+ });
346
+
347
+ const summaryParentTaskId = relationshipSummary.parent_task_id;
348
+ const summaryParentTask = relationshipSummary.parent_task ?? null;
349
+ const { data: cachedBoardParentTask } = useQuery({
350
+ queryKey: ['tasks', boardId],
351
+ queryFn: async () => [] as Task[],
352
+ enabled: false,
353
+ select: (tasks: Task[]) => {
354
+ if (!summaryParentTaskId) {
355
+ return null;
356
+ }
357
+
358
+ const match = tasks.find(
359
+ (candidate) => candidate.id === summaryParentTaskId
360
+ );
361
+ if (!match) {
362
+ return null;
363
+ }
364
+
365
+ return {
366
+ id: match.id,
367
+ name: match.name,
368
+ display_number: match.display_number,
369
+ ticket_prefix:
370
+ 'ticket_prefix' in match && typeof match.ticket_prefix === 'string'
371
+ ? match.ticket_prefix
372
+ : (boardConfig?.ticket_prefix ?? null),
373
+ };
374
+ },
375
+ });
376
+ const shouldHydrateParentTask =
377
+ isInViewport &&
378
+ !!effectiveWorkspaceId &&
379
+ !!summaryParentTaskId &&
380
+ !summaryParentTask &&
381
+ !cachedBoardParentTask &&
382
+ (!parentTask || parentTask.id !== summaryParentTaskId);
383
+ const { data: hydratedParentTask } = useQuery({
384
+ queryKey: [
385
+ 'task-parent-summary',
386
+ effectiveWorkspaceId,
387
+ summaryParentTaskId ?? 'none',
388
+ ],
389
+ queryFn: async () => {
390
+ if (!effectiveWorkspaceId || !summaryParentTaskId) {
391
+ return null;
392
+ }
393
+
394
+ const response = await enqueueTaskCardRelationshipRequest(() =>
395
+ getWorkspaceTask(effectiveWorkspaceId, summaryParentTaskId)
396
+ );
397
+ const fetchedTask = response.task;
398
+
399
+ return {
400
+ id: fetchedTask.id,
401
+ name: fetchedTask.name,
402
+ display_number: fetchedTask.display_number,
403
+ ticket_prefix:
404
+ 'ticket_prefix' in fetchedTask &&
405
+ typeof fetchedTask.ticket_prefix === 'string'
406
+ ? fetchedTask.ticket_prefix
407
+ : fetchedTask.board_id === boardId
408
+ ? (boardConfig?.ticket_prefix ?? null)
409
+ : null,
410
+ };
411
+ },
412
+ enabled: shouldHydrateParentTask,
413
+ staleTime: 5 * 60 * 1000,
414
+ });
415
+ const [resolvedParentTask, setResolvedParentTask] = useState(
416
+ summaryParentTask ?? parentTask
417
+ );
418
+
419
+ useEffect(() => {
420
+ if (parentTask?.id && parentTask.id === summaryParentTaskId) {
421
+ setResolvedParentTask(parentTask);
422
+ return;
423
+ }
424
+
425
+ if (summaryParentTask?.id && summaryParentTask.id === summaryParentTaskId) {
426
+ setResolvedParentTask(summaryParentTask);
427
+ return;
428
+ }
429
+
430
+ if (
431
+ cachedBoardParentTask?.id &&
432
+ cachedBoardParentTask.id === summaryParentTaskId
433
+ ) {
434
+ setResolvedParentTask(cachedBoardParentTask);
435
+ return;
436
+ }
437
+
438
+ if (
439
+ hydratedParentTask?.id &&
440
+ hydratedParentTask.id === summaryParentTaskId
441
+ ) {
442
+ setResolvedParentTask(hydratedParentTask);
443
+ return;
444
+ }
445
+
446
+ if (!summaryParentTaskId) {
447
+ setResolvedParentTask(null);
448
+ }
449
+ }, [
450
+ cachedBoardParentTask,
451
+ hydratedParentTask,
452
+ parentTask,
453
+ summaryParentTask,
454
+ summaryParentTaskId,
455
+ ]);
456
+
457
+ const { hasParentRelationship, parentBadgeTask } =
458
+ getTaskCardParentBadgeState({
459
+ summaryParentTaskId,
460
+ summaryParentTask,
461
+ parentTask,
462
+ resolvedParentTask,
463
+ hasLoadedRelationships,
464
+ });
465
+ const childTaskCount = hasLoadedRelationships
466
+ ? childTasks.length
467
+ : relationshipSummary.child_count;
468
+ const completedChildTaskCount = hasLoadedRelationships
469
+ ? childTasks.filter((childTask) => childTask.completed).length
470
+ : (relationshipSummary.completed_child_count ?? 0);
471
+ const blockedByCount = hasLoadedRelationships
472
+ ? blockedByTasks.length
473
+ : relationshipSummary.blocked_by_count;
474
+ const blockingCount = hasLoadedRelationships
475
+ ? blockingTasks.length
476
+ : relationshipSummary.blocking_count;
477
+ const relatedTaskCount = hasLoadedRelationships
478
+ ? relatedTasks.length
479
+ : relationshipSummary.related_count;
480
+ const parentBadgeIdentifier = parentBadgeTask
481
+ ? formatRelationshipTaskIdentifier(parentBadgeTask)
482
+ : null;
483
+ const blockedByPreviewTasks = useMemo(() => {
484
+ if (!hasLoadedRelationships) {
485
+ return [];
486
+ }
487
+
488
+ return [...blockedByTasks]
489
+ .sort((left, right) => {
490
+ const leftCompleted = left.completed ? 1 : 0;
491
+ const rightCompleted = right.completed ? 1 : 0;
492
+ if (leftCompleted !== rightCompleted) {
493
+ return leftCompleted - rightCompleted;
494
+ }
495
+
496
+ return left.name.localeCompare(right.name);
497
+ })
498
+ .slice(0, 1);
499
+ }, [blockedByTasks, hasLoadedRelationships]);
500
+ const primaryBlockedByTask = blockedByPreviewTasks[0] ?? null;
501
+ const primaryBlockedByTaskIdentifier = primaryBlockedByTask
502
+ ? formatRelationshipTaskIdentifier(primaryBlockedByTask)
503
+ : null;
504
+ const blockedByOverflowCount = Math.max(
505
+ 0,
506
+ blockedByCount - blockedByPreviewTasks.length
507
+ );
508
+ const showBlockedByCallout =
509
+ blockedByCount > 0 && !(task.closed_at || task.completed_at);
510
+
511
+ // Fetch available task lists using React Query (same key as other components)
512
+ const { data: availableLists = [] } = useQuery({
513
+ queryKey: ['task_lists', boardId],
514
+ queryFn: async () => {
515
+ if (!effectiveWorkspaceId) {
516
+ return [];
517
+ }
518
+
519
+ const { lists } = await listWorkspaceTaskLists(
520
+ effectiveWorkspaceId,
521
+ boardId,
522
+ typeof window !== 'undefined'
523
+ ? { baseUrl: window.location.origin }
524
+ : undefined
525
+ );
526
+
527
+ return lists.filter((list) => !list.deleted) as TaskList[];
528
+ },
529
+ enabled: !propAvailableLists && !!effectiveWorkspaceId, // Only fetch if not provided as prop
530
+ initialData: propAvailableLists,
531
+ staleTime: 60 * 1000, // 1 minute - lists change less frequently
532
+ });
533
+
534
+ // Find the first list with 'done' or 'closed' status
535
+ const getTargetCompletionList = () => {
536
+ const doneList = availableLists.find((list) => list.status === 'done');
537
+ const closedList = availableLists.find((list) => list.status === 'closed');
538
+ return doneList || closedList || null;
539
+ };
540
+
541
+ const duplicateTaskMutation = useMutation({
542
+ mutationFn: async (tasksToDuplicate: Task[]) => {
543
+ if (!effectiveWorkspaceId) {
544
+ throw new Error('Workspace ID is required to duplicate tasks');
545
+ }
546
+
547
+ const duplicatedTasks: Task[] = [];
548
+
549
+ for (const sourceTask of tasksToDuplicate) {
550
+ const taskData: Parameters<typeof createTask>[2] = {
551
+ name: sourceTask.name.trim(),
552
+ description: sourceTask.description,
553
+ priority: sourceTask.priority,
554
+ start_date: sourceTask.start_date,
555
+ end_date: sourceTask.end_date,
556
+ estimation_points: sourceTask.estimation_points ?? null,
557
+ label_ids: sourceTask.labels?.map((label) => label.id) ?? [],
558
+ assignee_ids:
559
+ sourceTask.assignees?.map((assignee) => assignee.id) ?? [],
560
+ project_ids: sourceTask.projects?.map((project) => project.id) ?? [],
561
+ };
562
+
563
+ const newTask = await createTask(
564
+ effectiveWorkspaceId,
565
+ sourceTask.list_id,
566
+ taskData
567
+ );
568
+
569
+ duplicatedTasks.push({
570
+ ...newTask,
571
+ assignees: sourceTask.assignees,
572
+ labels: sourceTask.labels,
573
+ projects: sourceTask.projects,
574
+ });
575
+ }
576
+
577
+ return duplicatedTasks;
578
+ },
579
+ onSuccess: (duplicatedTasks) => {
580
+ const localMutationAt = Date.now();
581
+ const locallyDuplicatedTasks = duplicatedTasks.map(
582
+ (duplicatedTask) =>
583
+ ({
584
+ ...(duplicatedTask as Task & { _localMutationAt?: number }),
585
+ _localMutationAt: localMutationAt,
586
+ }) as Task
587
+ );
588
+
589
+ queryClient.setQueryData(
590
+ ['tasks', boardId],
591
+ (old: Task[] | undefined) => {
592
+ if (!old) return locallyDuplicatedTasks;
593
+ const newTasks = locallyDuplicatedTasks.filter(
594
+ (newTask) => !old.some((task) => task.id === newTask.id)
595
+ );
596
+ return [...old, ...newTasks];
597
+ }
598
+ );
599
+
600
+ for (const duplicatedTask of locallyDuplicatedTasks) {
601
+ broadcast?.('task:upsert', { task: duplicatedTask });
602
+ if (
603
+ (duplicatedTask.assignees && duplicatedTask.assignees.length > 0) ||
604
+ (duplicatedTask.labels && duplicatedTask.labels.length > 0) ||
605
+ (duplicatedTask.projects && duplicatedTask.projects.length > 0)
606
+ ) {
607
+ broadcast?.('task:relations-changed', {
608
+ taskId: duplicatedTask.id,
609
+ });
610
+ }
611
+ }
612
+
613
+ toast.success(
614
+ t('tasks_duplicated_successfully', { count: duplicatedTasks.length })
615
+ );
616
+ },
617
+ onError: (error) => {
618
+ console.error('Error duplicating task(s):', error);
619
+ toast.error(
620
+ error instanceof Error ? error.message : t('please_try_again_later')
621
+ );
622
+ },
623
+ onSettled: () => {
624
+ setIsLoading(false);
625
+ },
626
+ });
627
+
628
+ // Find specifically the closed list
629
+ const getTargetClosedList = () => {
630
+ return availableLists.find((list) => list.status === 'closed') || null;
631
+ };
632
+
633
+ const targetCompletionList = getTargetCompletionList();
634
+ const targetClosedList = getTargetClosedList();
635
+ const canMoveToCompletion =
636
+ targetCompletionList && targetCompletionList.id !== task.list_id;
637
+ const canMoveToClose =
638
+ targetClosedList && targetClosedList.id !== task.list_id;
639
+ const canQuickArchive =
640
+ taskList?.status === 'done' && !isOverlay && Boolean(canMoveToClose);
641
+ const quickArchiveToneClass = taskList?.color
642
+ ? DESTINATION_TONE_COLORS[taskList.color]
643
+ : DESTINATION_TONE_COLORS.GRAY;
644
+
645
+ // Check if task is optimistically added (pending realtime confirmation)
646
+ const isOptimistic = '_isOptimistic' in task && task._isOptimistic === true;
647
+ const isPersonalExternalTask =
648
+ task.is_personal_external === true || Boolean(task.personal_board_id);
649
+ const sourceBoardUrl =
650
+ task.source_workspace_id && task.source_board_id
651
+ ? `/${task.source_workspace_id}${tasksHref(`/boards/${task.source_board_id}`)}`
652
+ : null;
653
+ const taskTicketPrefix =
654
+ 'ticket_prefix' in task && typeof task.ticket_prefix === 'string'
655
+ ? task.ticket_prefix
656
+ : null;
657
+ const taskTicketIdentifier = getTicketIdentifier(
658
+ isPersonalExternalTask ? taskTicketPrefix : boardConfig?.ticket_prefix,
659
+ task.display_number
660
+ );
661
+ const externalSourceLabel =
662
+ task.source_workspace_name ??
663
+ task.source_board_name ??
664
+ tTasks('external_task');
665
+
666
+ const dragDisabled =
667
+ dragDisabledProp ||
668
+ dialogState.editDialogOpen ||
669
+ dialogState.deleteDialogOpen ||
670
+ dialogState.customDateDialogOpen ||
671
+ dialogState.newLabelDialogOpen ||
672
+ dialogState.newProjectDialogOpen ||
673
+ menuOpen ||
674
+ isOptimistic; // Disable drag for optimistic tasks until confirmed
675
+
676
+ // Debug: log drag state for newly created task
677
+ if (task.name === 'new task') {
678
+ console.log('[TaskCard Debug]', {
679
+ taskId: task.id,
680
+ editDialogOpen: dialogState.editDialogOpen,
681
+ deleteDialogOpen: dialogState.deleteDialogOpen,
682
+ customDateDialogOpen: dialogState.customDateDialogOpen,
683
+ newLabelDialogOpen: dialogState.newLabelDialogOpen,
684
+ newProjectDialogOpen: dialogState.newProjectDialogOpen,
685
+ menuOpen,
686
+ isOptimistic,
687
+ RESULT_dragDisabled: dragDisabled,
688
+ });
689
+ }
690
+
691
+ const sortableDisabled = dragDisabled || isOverlay;
692
+ const sortableId = isOverlay
693
+ ? `${task.id}:drag-overlay`
694
+ : (sortableIdProp ?? task.id);
695
+ const {
696
+ setNodeRef,
697
+ attributes,
698
+ listeners,
699
+ transform,
700
+ transition,
701
+ isDragging,
702
+ } = useSortable({
703
+ id: sortableId,
704
+ data: {
705
+ type: 'Task',
706
+ task: {
707
+ ...task,
708
+ list_id: String(task.list_id),
709
+ },
710
+ },
711
+ disabled: sortableDisabled,
712
+ });
713
+
714
+ const cardVisibilityState = getTaskCardVisibilityState({
715
+ isDragging,
716
+ optimisticUpdateInProgress:
717
+ optimisticUpdateInProgress?.has(task.id) ?? false,
718
+ });
719
+
720
+ const setCardRefs = useCallback(
721
+ (node: HTMLDivElement | null) => {
722
+ cardElementRef.current = node;
723
+ setNodeRef(node);
724
+ },
725
+ [setNodeRef]
726
+ );
727
+
728
+ useEffect(() => {
729
+ const node = cardElementRef.current;
730
+ if (!node) return;
731
+
732
+ if (typeof IntersectionObserver === 'undefined') {
733
+ setIsInViewport(true);
734
+ return;
735
+ }
736
+
737
+ const observer = new IntersectionObserver(
738
+ ([entry]) => {
739
+ if (!entry) {
740
+ return;
741
+ }
742
+ setIsInViewport(entry.isIntersecting);
743
+ },
744
+ {
745
+ rootMargin: '220px 0px',
746
+ threshold: 0.05,
747
+ }
748
+ );
749
+
750
+ observer.observe(node);
751
+ return () => observer.disconnect();
752
+ }, []);
753
+
754
+ const style: React.CSSProperties = {
755
+ transform:
756
+ isOverlay || isDragging || suppressSortableTransform
757
+ ? 'translate3d(0, 0, 0)'
758
+ : CSS.Transform.toString(transform),
759
+ transition: isOverlay || suppressSortableTransform ? 'none' : transition,
760
+ height: 'var(--task-height)',
761
+ background: isOverlay || isDragging ? 'var(--card)' : undefined,
762
+ // Show reduced opacity for optimistic tasks (pending realtime confirmation)
763
+ opacity: isOverlay ? 1 : isOptimistic ? 0.6 : undefined,
764
+ };
765
+
766
+ const now = new Date();
767
+ const isOverdue = task.end_date && new Date(task.end_date) < now;
768
+ const isResolvedListStatus = isTaskBoardResolvedStatus(taskList?.status);
769
+ const startDate = task.start_date ? new Date(task.start_date) : null;
770
+ const endDate = task.end_date ? new Date(task.end_date) : null;
771
+
772
+ // Memoize description metadata to prevent unnecessary recalculations
773
+ // This is important because descriptionMeta is used in taskBadges dependency array
774
+ const descriptionMeta = useMemo(
775
+ () => getDescriptionMetadata(task.description),
776
+ [task.description]
777
+ );
778
+
779
+ // Helper function to get card color classes
780
+ const getCardColorClasses = () =>
781
+ getCardColorClassesUtil(taskList, task.priority);
782
+
783
+ // Use the extracted task actions hook
784
+ const {
785
+ handleArchiveToggle,
786
+ handleMoveToCompletion,
787
+ handleMoveToClose,
788
+ handleDelete,
789
+ handleMoveToList,
790
+ handleDueDateChange,
791
+ handlePriorityChange,
792
+ updateEstimationPoints,
793
+ handleCustomDateChange,
794
+ handleToggleAssignee,
795
+ } = useTaskActions({
796
+ task,
797
+ boardId,
798
+ workspaceId: effectiveWorkspaceId,
799
+ targetCompletionList,
800
+ targetClosedList,
801
+ availableLists,
802
+ onUpdate,
803
+ setIsLoading,
804
+ setMenuOpen,
805
+ setCustomDateDialogOpen: (open: boolean) =>
806
+ open
807
+ ? dialogActions.openCustomDateDialog()
808
+ : dialogActions.closeCustomDateDialog(),
809
+ setDeleteDialogOpen: (open: boolean) =>
810
+ open
811
+ ? dialogActions.openDeleteDialog()
812
+ : dialogActions.closeDeleteDialog(),
813
+ setEstimationSaving,
814
+ selectedTasks,
815
+ isMultiSelectMode,
816
+ onClearSelection,
817
+ bulkUpdateCustomDueDate,
818
+ });
819
+
820
+ const onToggleAssignee = useCallback(
821
+ (assigneeId: string) => handleToggleAssignee(assigneeId),
822
+ [handleToggleAssignee]
823
+ );
824
+
825
+ const quickArchiveButton = canQuickArchive ? (
826
+ <Tooltip>
827
+ <TooltipTrigger asChild>
828
+ <button
829
+ type="button"
830
+ aria-label={t('archive')}
831
+ disabled={isLoading}
832
+ onPointerDown={(e) => {
833
+ e.stopPropagation();
834
+ }}
835
+ onClick={(e) => {
836
+ e.preventDefault();
837
+ e.stopPropagation();
838
+ void handleMoveToClose();
839
+ }}
840
+ className={cn(
841
+ 'flex h-5 w-5 flex-none items-center justify-center rounded-sm border border-transparent transition-all duration-200',
842
+ quickArchiveToneClass,
843
+ 'hover:scale-110 hover:ring-2 hover:brightness-110',
844
+ 'focus-visible:outline-none focus-visible:ring-2',
845
+ 'disabled:cursor-not-allowed disabled:opacity-60'
846
+ )}
847
+ >
848
+ {isLoading ? (
849
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
850
+ ) : (
851
+ <Archive className="h-3.5 w-3.5" />
852
+ )}
853
+ </button>
854
+ </TooltipTrigger>
855
+ <TooltipContent side="top" className="text-xs">
856
+ {t('archive')}
857
+ </TooltipContent>
858
+ </Tooltip>
859
+ ) : null;
860
+
861
+ // Memoize drag handle for performance
862
+ // Removed explicit drag handle – entire card is now draggable for better UX.
863
+ // Keep attributes/listeners to spread onto root interactive area.
864
+
865
+ const openExternalTask = useCallback(async () => {
866
+ const sourceWorkspaceId = task.source_workspace_id;
867
+ const sourceBoardId = task.source_board_id;
868
+
869
+ if (sourceWorkspaceId && sourceBoardId) {
870
+ try {
871
+ const { task: sourceTask } = await getWorkspaceTask(
872
+ sourceWorkspaceId,
873
+ task.id
874
+ );
875
+ let sourceLists: TaskList[] | undefined;
876
+
877
+ try {
878
+ sourceLists = (
879
+ await listWorkspaceTaskLists(sourceWorkspaceId, sourceBoardId)
880
+ ).lists;
881
+ } catch {
882
+ sourceLists = undefined;
883
+ }
884
+
885
+ openTask(sourceTask as Task, sourceBoardId, sourceLists, false, {
886
+ taskWsId: sourceWorkspaceId,
887
+ taskWorkspacePersonal: false,
888
+ });
889
+ return;
890
+ } catch {
891
+ const opened = await openTaskById(task.id);
892
+ if (opened) return;
893
+ }
894
+ } else {
895
+ const opened = await openTaskById(task.id);
896
+ if (opened) return;
897
+ }
898
+
899
+ openTask(task, sourceBoardId ?? boardId, availableLists, false, {
900
+ taskWsId: sourceWorkspaceId ?? effectiveWorkspaceId,
901
+ taskWorkspacePersonal: sourceWorkspaceId ? false : isPersonalWorkspace,
902
+ });
903
+ }, [
904
+ task,
905
+ boardId,
906
+ availableLists,
907
+ effectiveWorkspaceId,
908
+ isPersonalWorkspace,
909
+ openTask,
910
+ openTaskById,
911
+ ]);
912
+
913
+ const handleCardClick = useCallback(
914
+ (e: React.MouseEvent) => {
915
+ // Check if only Shift is held (without CMD/Ctrl) for multiselect
916
+ const isShiftOnlyHeld =
917
+ e.shiftKey && !e.metaKey && !e.ctrlKey && !e.altKey;
918
+
919
+ // Handle multi-select functionality only when Shift is held alone
920
+ if (isMultiSelectMode || isShiftOnlyHeld) {
921
+ onSelect?.(task.id, e);
922
+ } else if (
923
+ !isDragging &&
924
+ !dialogState.editDialogOpen &&
925
+ !dialogState.isClosingDialog &&
926
+ !menuOpen &&
927
+ !dialogState.deleteDialogOpen &&
928
+ !dialogState.customDateDialogOpen &&
929
+ !dialogState.newLabelDialogOpen &&
930
+ !dialogState.newProjectDialogOpen
931
+ ) {
932
+ // Only open edit dialog if not in multi-select mode, not dragging, and no other dialogs are open
933
+ if (isPersonalExternalTask) {
934
+ void openExternalTask();
935
+ return;
936
+ }
937
+
938
+ openTask(task, boardId, availableLists, false, {
939
+ taskWsId: effectiveWorkspaceId,
940
+ taskWorkspacePersonal: isPersonalWorkspace,
941
+ });
942
+ }
943
+ },
944
+ [
945
+ task,
946
+ boardId,
947
+ effectiveWorkspaceId,
948
+ isPersonalWorkspace,
949
+ isPersonalExternalTask,
950
+ isMultiSelectMode,
951
+ availableLists,
952
+ isDragging,
953
+ menuOpen,
954
+ dialogState,
955
+ onSelect,
956
+ openTask,
957
+ openExternalTask,
958
+ ]
959
+ );
960
+
961
+ // Refs for measuring badge widths
962
+ const containerRef = useRef<HTMLDivElement>(null);
963
+ const badgeRefs = useRef<Map<string, HTMLDivElement>>(new Map());
964
+ const descriptionMetaRef = useRef<HTMLDivElement>(null);
965
+ const [visibleBadgeCount, setVisibleBadgeCount] = useState(0);
966
+
967
+ const handleDuplicateTask = async () => {
968
+ setIsLoading(true);
969
+ setMenuOpen(false);
970
+
971
+ // Check if we're in multi-select mode and have multiple tasks selected
972
+ const shouldBulkDuplicate =
973
+ isMultiSelectMode &&
974
+ selectedTasks &&
975
+ selectedTasks.size > 1 &&
976
+ selectedTasks.has(task.id);
977
+
978
+ // Get all tasks data from cache for bulk operations
979
+ const allTasks =
980
+ (queryClient.getQueryData<Task[]>(['tasks', boardId]) as Task[]) || [];
981
+ const tasksToDuplicate = shouldBulkDuplicate
982
+ ? allTasks.filter((t) => selectedTasks?.has(t.id))
983
+ : [task];
984
+
985
+ try {
986
+ await duplicateTaskMutation.mutateAsync(tasksToDuplicate);
987
+ } catch {
988
+ // Error handling is centralized in the mutation callbacks.
989
+ }
990
+ };
991
+
992
+ const handleAddSubtask = () => {
993
+ setMenuOpen(false);
994
+ // Open subtask creation dialog - the relationship will be created when the user saves
995
+ createSubtask(task.id, task.name, boardId, task.list_id, availableLists);
996
+ };
997
+
998
+ const handleMoveToExternalStaging = async () => {
999
+ if (!task.personal_board_id) return;
1000
+
1001
+ setIsLoading(true);
1002
+ setMenuOpen(false);
1003
+
1004
+ try {
1005
+ await removeCurrentUserTaskPersonalPlacement(task.id);
1006
+
1007
+ const localMutationAt = Date.now();
1008
+ queryClient.setQueryData(['tasks', boardId], (old: Task[] | undefined) =>
1009
+ old?.map((candidate) =>
1010
+ candidate.id === task.id
1011
+ ? {
1012
+ ...candidate,
1013
+ list_id: getPersonalExternalStagingListId(
1014
+ task.personal_board_id ?? boardId
1015
+ ),
1016
+ sort_key: null,
1017
+ personal_list_id: null,
1018
+ personal_sort_key: null,
1019
+ personal_placed_at: null,
1020
+ is_personal_external: true,
1021
+ is_personal_external_default: true,
1022
+ _localMutationAt: localMutationAt,
1023
+ }
1024
+ : candidate
1025
+ )
1026
+ );
1027
+
1028
+ toast.success(tTasks('moved_to_external_tasks'));
1029
+ } catch (error) {
1030
+ console.error('Failed to move task to external staging:', error);
1031
+ toast.error(tTasks('failed_update_personal_placement'));
1032
+ } finally {
1033
+ setIsLoading(false);
1034
+ }
1035
+ };
1036
+
1037
+ const handleRemoveFromPersonalBoard = async () => {
1038
+ setIsLoading(true);
1039
+ setMenuOpen(false);
1040
+
1041
+ try {
1042
+ await removeCurrentUserTaskPersonalPlacement(task.id);
1043
+
1044
+ queryClient.setQueryData(['tasks', boardId], (old: Task[] | undefined) =>
1045
+ old?.filter((candidate) => candidate.id !== task.id)
1046
+ );
1047
+
1048
+ toast.success(tTasks('removed_from_personal_board'));
1049
+ } catch (error) {
1050
+ console.error('Failed to remove task from personal board:', error);
1051
+ toast.error(tTasks('failed_update_personal_placement'));
1052
+ } finally {
1053
+ setIsLoading(false);
1054
+ }
1055
+ };
1056
+
1057
+ const taskBadges = useMemo(() => {
1058
+ // Collect all badges into an array for overflow handling
1059
+ const badges: { id: string; element: React.ReactNode }[] = [];
1060
+
1061
+ // Priority badge
1062
+ if (task.priority) {
1063
+ badges.push({
1064
+ id: 'priority',
1065
+ element: (
1066
+ <div
1067
+ key="priority"
1068
+ className="flex-none overflow-hidden"
1069
+ ref={(el) => {
1070
+ if (el) badgeRefs.current.set('priority', el);
1071
+ }}
1072
+ >
1073
+ {getPriorityIndicator(task.priority)}
1074
+ </div>
1075
+ ),
1076
+ });
1077
+ }
1078
+
1079
+ // Sub-tasks counter badge (checked / total, excludes indeterminate)
1080
+ if (descriptionMeta.totalCheckboxes > 0) {
1081
+ const allChecked =
1082
+ descriptionMeta.checkedCheckboxes === descriptionMeta.totalCheckboxes;
1083
+ badges.push({
1084
+ id: 'subtasks',
1085
+ element: (
1086
+ <Badge
1087
+ key="subtasks"
1088
+ variant="secondary"
1089
+ className={cn(
1090
+ 'border font-medium text-[10px]',
1091
+ allChecked
1092
+ ? 'border-dynamic-green/30 bg-dynamic-green/15 text-dynamic-green'
1093
+ : 'border-dynamic-gray/30 bg-dynamic-gray/10 text-dynamic-gray'
1094
+ )}
1095
+ title={t('n_subtasks_completed', {
1096
+ checked: descriptionMeta.checkedCheckboxes,
1097
+ total: descriptionMeta.totalCheckboxes,
1098
+ })}
1099
+ ref={(el) => {
1100
+ if (el) badgeRefs.current.set('subtasks', el as any);
1101
+ }}
1102
+ >
1103
+ {allChecked ? (
1104
+ <ListChecks className="h-3 w-3" />
1105
+ ) : (
1106
+ <ListTodo className="h-3 w-3" />
1107
+ )}
1108
+ {descriptionMeta.checkedCheckboxes}/
1109
+ {descriptionMeta.totalCheckboxes}
1110
+ </Badge>
1111
+ ),
1112
+ });
1113
+ }
1114
+
1115
+ // Indeterminate (abandoned) sub-tasks badge
1116
+ if (descriptionMeta.indeterminateCheckboxes > 0) {
1117
+ badges.push({
1118
+ id: 'indeterminate-subtasks',
1119
+ element: (
1120
+ <Badge
1121
+ key="indeterminate-subtasks"
1122
+ variant="secondary"
1123
+ className="border border-dynamic-orange/30 bg-dynamic-orange/15 font-medium text-[10px] text-dynamic-orange"
1124
+ title={t('n_subtasks_abandoned', {
1125
+ count: descriptionMeta.indeterminateCheckboxes,
1126
+ })}
1127
+ ref={(el) => {
1128
+ if (el)
1129
+ badgeRefs.current.set('indeterminate-subtasks', el as any);
1130
+ }}
1131
+ >
1132
+ <SquareCenterlineDashedVertical className="h-3 w-3" />
1133
+ {descriptionMeta.indeterminateCheckboxes}
1134
+ </Badge>
1135
+ ),
1136
+ });
1137
+ }
1138
+
1139
+ // Project indicator badge
1140
+ if (task.projects && task.projects.length > 0) {
1141
+ badges.push({
1142
+ id: 'projects',
1143
+ element: (
1144
+ <div
1145
+ key="projects"
1146
+ className="min-w-0 shrink-0"
1147
+ ref={(el) => {
1148
+ if (el) badgeRefs.current.set('projects', el);
1149
+ }}
1150
+ >
1151
+ <Badge
1152
+ variant="secondary"
1153
+ className={cn(
1154
+ 'h-5 border px-2 text-[10px]',
1155
+ 'border-dynamic-sky/30 bg-dynamic-sky/10 text-dynamic-sky'
1156
+ )}
1157
+ >
1158
+ <Box className="h-2.5 w-2.5" />
1159
+ {task.projects.length === 1
1160
+ ? task.projects[0]?.name
1161
+ : t('n_projects', { count: task.projects.length })}
1162
+ </Badge>
1163
+ </div>
1164
+ ),
1165
+ });
1166
+ }
1167
+
1168
+ // Estimation Points badge
1169
+ if (task.estimation_points != null) {
1170
+ badges.push({
1171
+ id: 'estimation',
1172
+ element: (
1173
+ <div
1174
+ key="estimation"
1175
+ className="min-w-0 shrink-0"
1176
+ ref={(el) => {
1177
+ if (el) badgeRefs.current.set('estimation', el);
1178
+ }}
1179
+ >
1180
+ <TaskEstimationDisplay
1181
+ points={task.estimation_points}
1182
+ size="sm"
1183
+ estimationType={boardConfig?.estimation_type}
1184
+ showIcon
1185
+ />
1186
+ </div>
1187
+ ),
1188
+ });
1189
+ }
1190
+
1191
+ // Labels badge
1192
+ if (task.labels && task.labels.length > 0) {
1193
+ badges.push({
1194
+ id: 'labels',
1195
+ element: (
1196
+ <div
1197
+ key="labels"
1198
+ className="flex min-w-0 shrink-0 flex-wrap gap-1"
1199
+ ref={(el) => {
1200
+ if (el) badgeRefs.current.set('labels', el);
1201
+ }}
1202
+ >
1203
+ <TaskLabelsDisplay
1204
+ labels={sortByDisplayName(task.labels)}
1205
+ size="sm"
1206
+ hiddenLabelsLabel={t('hidden_labels')}
1207
+ />
1208
+ </div>
1209
+ ),
1210
+ });
1211
+ }
1212
+
1213
+ // Parent task indicator badge
1214
+ if (hasParentRelationship) {
1215
+ badges.push({
1216
+ id: 'parent',
1217
+ element: (
1218
+ <Badge
1219
+ key="parent"
1220
+ variant="secondary"
1221
+ className="flex h-6 max-w-full shrink-0 items-center gap-1.5 overflow-hidden rounded-full border border-dynamic-purple/35 bg-dynamic-purple/10 px-2.5 text-[10px] text-dynamic-purple"
1222
+ title={
1223
+ parentBadgeTask
1224
+ ? parentBadgeIdentifier
1225
+ ? `${parentBadgeIdentifier} · ${parentBadgeTask.name}`
1226
+ : t('subtask_of', { name: parentBadgeTask.name })
1227
+ : undefined
1228
+ }
1229
+ ref={(el) => {
1230
+ if (el) badgeRefs.current.set('parent', el as any);
1231
+ }}
1232
+ >
1233
+ <ArrowUpCircle className="h-2.5 w-2.5" />
1234
+ {parentBadgeIdentifier && (
1235
+ <span className="rounded-full bg-dynamic-purple/12 px-1.5 py-0.5 font-mono text-[9px] leading-none">
1236
+ {parentBadgeIdentifier}
1237
+ </span>
1238
+ )}
1239
+ <span className="truncate">
1240
+ {parentBadgeTask?.name ||
1241
+ parentBadgeIdentifier ||
1242
+ t('parent_task')}
1243
+ </span>
1244
+ </Badge>
1245
+ ),
1246
+ });
1247
+ }
1248
+
1249
+ // Child tasks (sub-tasks) count badge
1250
+ if (childTaskCount > 0) {
1251
+ badges.push({
1252
+ id: 'children',
1253
+ element: (
1254
+ <Badge
1255
+ key="children"
1256
+ variant="secondary"
1257
+ className={cn(
1258
+ 'h-5 shrink-0 border px-2 text-[10px]',
1259
+ completedChildTaskCount === childTaskCount
1260
+ ? 'border-dynamic-green/30 bg-dynamic-green/10 text-dynamic-green'
1261
+ : 'border-dynamic-gray/30 bg-dynamic-gray/10 text-dynamic-gray'
1262
+ )}
1263
+ title={t('n_subtasks_completed', {
1264
+ checked: completedChildTaskCount,
1265
+ total: childTaskCount,
1266
+ })}
1267
+ ref={(el) => {
1268
+ if (el) badgeRefs.current.set('children', el as any);
1269
+ }}
1270
+ >
1271
+ <ListTree className="h-2.5 w-2.5" />
1272
+ {completedChildTaskCount}/{childTaskCount}
1273
+ </Badge>
1274
+ ),
1275
+ });
1276
+ }
1277
+
1278
+ // Blocking indicator badge (this task blocks others)
1279
+ if (blockingCount > 0) {
1280
+ badges.push({
1281
+ id: 'blocking',
1282
+ element: (
1283
+ <Badge
1284
+ key="blocking"
1285
+ variant="secondary"
1286
+ className="h-5 shrink-0 border border-dynamic-orange/30 bg-dynamic-orange/10 px-2 text-[10px] text-dynamic-orange"
1287
+ title={t('blocking_n_tasks', { count: blockingCount })}
1288
+ ref={(el) => {
1289
+ if (el) badgeRefs.current.set('blocking', el as any);
1290
+ }}
1291
+ >
1292
+ <Ban className="h-2.5 w-2.5" />
1293
+ {blockingCount}
1294
+ </Badge>
1295
+ ),
1296
+ });
1297
+ }
1298
+
1299
+ // Related tasks indicator badge
1300
+ if (relatedTaskCount > 0) {
1301
+ badges.push({
1302
+ id: 'related',
1303
+ element: (
1304
+ <Badge
1305
+ key="related"
1306
+ variant="secondary"
1307
+ className="h-5 shrink-0 border border-dynamic-blue/30 bg-dynamic-blue/10 px-2 text-[10px] text-dynamic-blue"
1308
+ title={t('n_related_tasks', { count: relatedTaskCount })}
1309
+ ref={(el) => {
1310
+ if (el) badgeRefs.current.set('related', el as any);
1311
+ }}
1312
+ >
1313
+ <Link2 className="h-2.5 w-2.5" />
1314
+ {relatedTaskCount}
1315
+ </Badge>
1316
+ ),
1317
+ });
1318
+ }
1319
+
1320
+ return badges;
1321
+ }, [
1322
+ // Only depend on specific task properties that affect badge rendering
1323
+ // to prevent recalculation when unrelated properties (like name) change
1324
+ task.priority,
1325
+ task.projects,
1326
+ task.estimation_points,
1327
+ task.labels,
1328
+ boardConfig?.estimation_type,
1329
+ descriptionMeta.totalCheckboxes,
1330
+ descriptionMeta.checkedCheckboxes,
1331
+ descriptionMeta.indeterminateCheckboxes,
1332
+ parentBadgeTask,
1333
+ hasParentRelationship,
1334
+ childTaskCount,
1335
+ completedChildTaskCount,
1336
+ blockingCount,
1337
+ relatedTaskCount,
1338
+ t,
1339
+ parentBadgeIdentifier,
1340
+ ]);
1341
+
1342
+ // Calculate visible badges based on available width
1343
+ useEffect(() => {
1344
+ const container = containerRef.current;
1345
+ if (!container) return;
1346
+
1347
+ const calculateVisibleCount = () => {
1348
+ const containerWidth = container.clientWidth;
1349
+ const gap = 4; // gap-1 = 4px
1350
+
1351
+ // Get description meta width
1352
+ let descriptionMetaWidth = 0;
1353
+ if (descriptionMetaRef.current) {
1354
+ descriptionMetaWidth = descriptionMetaRef.current.offsetWidth + gap;
1355
+ }
1356
+
1357
+ // Calculate total width needed for each badge
1358
+ let totalWidth = descriptionMetaWidth;
1359
+ let count = 0;
1360
+
1361
+ for (let i = 0; i < taskBadges.length; i++) {
1362
+ const badge = taskBadges[i];
1363
+ const badgeElement = badgeRefs.current.get(badge?.id || '');
1364
+ if (!badgeElement) continue;
1365
+
1366
+ const isLastBadge = i === taskBadges.length - 1;
1367
+ const badgeWidth = badgeElement.offsetWidth + (isLastBadge ? 0 : gap);
1368
+
1369
+ const totalNeeded = totalWidth + badgeWidth;
1370
+
1371
+ if (totalNeeded <= containerWidth) {
1372
+ totalWidth += badgeWidth;
1373
+ count++;
1374
+ } else {
1375
+ break;
1376
+ }
1377
+ }
1378
+
1379
+ setVisibleBadgeCount(count);
1380
+ };
1381
+
1382
+ // Initial calculation
1383
+ calculateVisibleCount();
1384
+
1385
+ // Re-calculate on container resize
1386
+ const resizeObserver = new ResizeObserver(calculateVisibleCount);
1387
+ resizeObserver.observe(container);
1388
+
1389
+ return () => {
1390
+ resizeObserver.disconnect();
1391
+ };
1392
+ }, [taskBadges]);
1393
+
1394
+ const visibleBadges = taskBadges.slice(0, visibleBadgeCount);
1395
+ const hiddenBadges = taskBadges.slice(visibleBadgeCount);
1396
+ const showBlockedByInlineWithCheckbox =
1397
+ showBlockedByCallout && taskBadges.length === 0;
1398
+ const showBlockedByUnderTitle =
1399
+ showBlockedByCallout && !showBlockedByInlineWithCheckbox;
1400
+
1401
+ // Get all tasks from query to subscribe to cache updates
1402
+ const { data: allTasksFromQuery } = useQuery({
1403
+ queryKey: ['tasks', boardId],
1404
+ queryFn: () => [], // No-op function - we only want to read from cache
1405
+ enabled: false, // Don't fetch, just subscribe to cache
1406
+ });
1407
+
1408
+ // Compute collective attributes for bulk operations
1409
+ const {
1410
+ displayLabels,
1411
+ displayProjects,
1412
+ displayAssignees,
1413
+ displayEstimation,
1414
+ } = useMemo(() => {
1415
+ const shouldUseBulkMode =
1416
+ isMultiSelectMode &&
1417
+ selectedTasks &&
1418
+ selectedTasks.size > 1 &&
1419
+ selectedTasks.has(task.id);
1420
+
1421
+ if (!shouldUseBulkMode) {
1422
+ return {
1423
+ displayLabels: task.labels || [],
1424
+ displayProjects: task.projects || [],
1425
+ displayAssignees: task.assignees || [],
1426
+ displayEstimation: task.estimation_points,
1427
+ };
1428
+ }
1429
+
1430
+ // Get all selected tasks data from query cache
1431
+ const allTasks = (allTasksFromQuery as Task[]) || [];
1432
+ const selectedTasksData = allTasks.filter((t) => selectedTasks?.has(t.id));
1433
+
1434
+ if (selectedTasksData.length === 0) {
1435
+ return {
1436
+ displayLabels: task.labels || [],
1437
+ displayProjects: task.projects || [],
1438
+ displayAssignees: task.assignees || [],
1439
+ displayEstimation: task.estimation_points,
1440
+ };
1441
+ }
1442
+
1443
+ // Find attributes that ALL selected tasks have in common
1444
+ // Start with all unique attributes from all selected tasks
1445
+ const allLabels = new Map<string, any>();
1446
+ const allProjects = new Map<string, any>();
1447
+ const allAssignees = new Map<string, any>();
1448
+
1449
+ selectedTasksData.forEach((t) => {
1450
+ t.labels?.forEach((label) => {
1451
+ allLabels.set(label.id, label);
1452
+ });
1453
+ t.projects?.forEach((project) => {
1454
+ allProjects.set(project.id, project);
1455
+ });
1456
+ t.assignees?.forEach((assignee) => {
1457
+ allAssignees.set(assignee.id, assignee);
1458
+ });
1459
+ });
1460
+
1461
+ // Filter to only those present in ALL selected tasks
1462
+ const commonLabels = Array.from(allLabels.values()).filter((label) =>
1463
+ selectedTasksData.every((t) => t.labels?.some((l) => l.id === label.id))
1464
+ );
1465
+
1466
+ const commonProjects = Array.from(allProjects.values()).filter((project) =>
1467
+ selectedTasksData.every((t) =>
1468
+ t.projects?.some((p) => p.id === project.id)
1469
+ )
1470
+ );
1471
+
1472
+ const commonAssignees = Array.from(allAssignees.values()).filter(
1473
+ (assignee) =>
1474
+ selectedTasksData.every((t) =>
1475
+ t.assignees?.some((a) => a.id === assignee.id)
1476
+ )
1477
+ );
1478
+
1479
+ // Check if ALL selected tasks have the same estimation
1480
+ const firstEstimation = selectedTasksData[0]?.estimation_points;
1481
+ const allSameEstimation = selectedTasksData.every(
1482
+ (t) => t.estimation_points === firstEstimation
1483
+ );
1484
+ const commonEstimation = allSameEstimation ? firstEstimation : undefined;
1485
+
1486
+ return {
1487
+ displayLabels: commonLabels,
1488
+ displayProjects: commonProjects,
1489
+ displayAssignees: commonAssignees,
1490
+ displayEstimation: commonEstimation,
1491
+ };
1492
+ }, [
1493
+ isMultiSelectMode,
1494
+ selectedTasks,
1495
+ task.id,
1496
+ task.labels,
1497
+ task.projects,
1498
+ task.assignees,
1499
+ task.estimation_points,
1500
+ allTasksFromQuery,
1501
+ ]);
1502
+
1503
+ const availableLabelsForMenu = useMemo(() => {
1504
+ return mergeTaskCardLabelOptions(workspaceLabels, displayLabels);
1505
+ }, [workspaceLabels, displayLabels]);
1506
+
1507
+ const blockedByCluster = (
1508
+ <div className="relative overflow-hidden rounded-md border border-dynamic-red/16 bg-dynamic-red/[0.045] px-2 py-1.5">
1509
+ <div className="absolute inset-y-1.5 left-1.5 w-0.75 rounded-full bg-dynamic-red/45" />
1510
+ <div className="flex min-w-0 items-center justify-between gap-2 pl-3">
1511
+ <div className="flex min-w-0 items-center gap-1.5">
1512
+ <div className="flex shrink-0 items-center gap-1 font-semibold text-[10px] text-dynamic-red uppercase tracking-[0.12em]">
1513
+ <Ban className="h-3 w-3" />
1514
+ <span>{t('blocked_by')}</span>
1515
+ </div>
1516
+ {!primaryBlockedByTask && (
1517
+ <span className="truncate text-[11px] text-muted-foreground">
1518
+ {t('blocked_by_help')}
1519
+ </span>
1520
+ )}
1521
+ </div>
1522
+ {primaryBlockedByTask && (
1523
+ <div className="flex shrink-0 items-center gap-1">
1524
+ <HoverCard openDelay={120}>
1525
+ <HoverCardTrigger asChild>
1526
+ <button
1527
+ type="button"
1528
+ className={cn(
1529
+ 'rounded-md border border-dynamic-red/18 bg-background/90 px-1.5 py-0.5 font-mono text-[9px] text-dynamic-red/85 uppercase transition-colors',
1530
+ 'hover:border-dynamic-red/30 hover:bg-background'
1531
+ )}
1532
+ aria-label={t('blocked_by_n_tasks', {
1533
+ count: blockedByCount,
1534
+ })}
1535
+ >
1536
+ {primaryBlockedByTaskIdentifier ?? t('blocked')}
1537
+ </button>
1538
+ </HoverCardTrigger>
1539
+ <HoverCardContent
1540
+ side="top"
1541
+ align="end"
1542
+ className="w-64 border-dynamic-red/20 bg-background/95 p-3 backdrop-blur-sm"
1543
+ >
1544
+ <div className="flex flex-col gap-1">
1545
+ <div className="flex items-center gap-2">
1546
+ <span className="rounded-md border border-dynamic-red/18 bg-dynamic-red/8 px-1.5 py-0.5 font-mono text-[10px] text-dynamic-red uppercase">
1547
+ {primaryBlockedByTaskIdentifier ?? t('blocked')}
1548
+ </span>
1549
+ {primaryBlockedByTask.completed && (
1550
+ <Badge
1551
+ variant="secondary"
1552
+ className="h-5 border-dynamic-green/20 bg-dynamic-green/10 px-1.5 text-[10px] text-dynamic-green"
1553
+ >
1554
+ {t('done')}
1555
+ </Badge>
1556
+ )}
1557
+ </div>
1558
+ <div
1559
+ className={cn(
1560
+ 'text-sm leading-snug',
1561
+ primaryBlockedByTask.completed &&
1562
+ 'text-muted-foreground line-through'
1563
+ )}
1564
+ >
1565
+ {primaryBlockedByTask.name}
1566
+ </div>
1567
+ {primaryBlockedByTask.board_name && (
1568
+ <div className="text-[11px] text-muted-foreground">
1569
+ {primaryBlockedByTask.board_name}
1570
+ </div>
1571
+ )}
1572
+ </div>
1573
+ </HoverCardContent>
1574
+ </HoverCard>
1575
+ {blockedByOverflowCount > 0 && (
1576
+ <Badge
1577
+ variant="secondary"
1578
+ className="h-5 border-dynamic-red/16 bg-dynamic-red/8 px-1.5 text-[10px] text-dynamic-red/80"
1579
+ >
1580
+ +{blockedByOverflowCount}
1581
+ </Badge>
1582
+ )}
1583
+ </div>
1584
+ )}
1585
+ </div>
1586
+ </div>
1587
+ );
1588
+
1589
+ return (
1590
+ <Card
1591
+ data-id={task.id}
1592
+ data-task-id={task.id}
1593
+ ref={setCardRefs}
1594
+ style={style}
1595
+ onClick={handleCardClick}
1596
+ onContextMenu={(e) => {
1597
+ // If only Shift is held (without CMD/Ctrl), handle as selection
1598
+ if (e.shiftKey && !e.metaKey && !e.ctrlKey && !e.altKey) {
1599
+ e.preventDefault();
1600
+ e.stopPropagation();
1601
+ // Trigger selection
1602
+ onSelect?.(task.id, e as any);
1603
+ return;
1604
+ }
1605
+
1606
+ // Normal right-click behavior - open context menu
1607
+ e.preventDefault();
1608
+ e.stopPropagation();
1609
+ // Open the context menu (actions dropdown) and guard first click briefly
1610
+ setMenuOpen(true);
1611
+ setMenuGuardUntil(Date.now() + 300);
1612
+ }}
1613
+ // Apply sortable listeners/attributes to the full card so the whole surface remains draggable
1614
+ {...(sortableDisabled ? {} : attributes)}
1615
+ {...(sortableDisabled ? {} : listeners)}
1616
+ className={cn(
1617
+ 'group relative overflow-hidden rounded-lg border-l-4',
1618
+ cardVisibilityState.hidden && 'pointer-events-none opacity-0',
1619
+ sortableDisabled
1620
+ ? 'cursor-default'
1621
+ : 'cursor-grab touch-none select-none active:cursor-grabbing',
1622
+ // Task list or priority-based styling
1623
+ getCardColorClasses(),
1624
+ showBlockedByCallout && 'bg-dynamic-red/[0.03]',
1625
+ cardVisibilityState.pending
1626
+ ? 'border-dashed opacity-90'
1627
+ : 'border-solid',
1628
+ (isOverlay || isDragging) &&
1629
+ 'bg-card bg-none shadow-lg ring-2 ring-primary/50',
1630
+ // Closed state (closed tasks)
1631
+ (!!task.closed_at || !!task.completed_at) && 'opacity-70 saturate-75',
1632
+ // Overdue state
1633
+ isOverdue &&
1634
+ !isResolvedListStatus &&
1635
+ !(!!task.closed_at || !!task.completed_at) &&
1636
+ 'border-dynamic-red/70 bg-dynamic-red/10 ring-1 ring-dynamic-red/20',
1637
+ // Hover state (no transitions)
1638
+ !isDragging && !isSelected && 'hover:ring-1 hover:ring-primary/15',
1639
+ // Selection state - enhanced visual feedback
1640
+ isSelected &&
1641
+ 'scale-[1.01] border-l-primary bg-linear-to-r from-primary/10 via-primary/5 to-transparent shadow-lg ring-2 ring-primary/60',
1642
+ // Multi-select mode cursor
1643
+ isMultiSelectMode && 'cursor-pointer'
1644
+ )}
1645
+ >
1646
+ {/* Overdue indicator */}
1647
+ {isOverdue &&
1648
+ !isResolvedListStatus &&
1649
+ !(!!task.closed_at || !!task.completed_at) && (
1650
+ <div className="absolute top-0 right-0 h-0 w-0 border-t-20 border-t-dynamic-red border-l-20 border-l-transparent">
1651
+ <AlertCircle className="absolute -top-4 -right-4.5 h-3 w-3" />
1652
+ </div>
1653
+ )}
1654
+ {/* Selection indicator */}
1655
+ {isMultiSelectMode && (
1656
+ <div
1657
+ className={cn(
1658
+ 'absolute top-2 left-2 flex h-6 w-6 items-center justify-center rounded-full border-2 transition-all duration-200',
1659
+ isSelected
1660
+ ? 'scale-110 border-primary bg-primary text-primary-foreground shadow-md'
1661
+ : 'border-border bg-background/80 text-muted-foreground shadow-sm hover:scale-105 hover:border-primary/50'
1662
+ )}
1663
+ >
1664
+ {isSelected ? (
1665
+ <Check className="h-4 w-4 stroke-3" />
1666
+ ) : (
1667
+ <div className="h-2 w-2 rounded-full bg-current opacity-30" />
1668
+ )}
1669
+ </div>
1670
+ )}
1671
+ <div className="p-3">
1672
+ {/* Header */}
1673
+ <div className="flex items-start gap-1">
1674
+ <div className="min-w-0 flex-1">
1675
+ <div
1676
+ className={cn(
1677
+ 'mb-1 flex gap-1',
1678
+ isPersonalExternalTask ? 'flex-wrap items-center' : 'flex-col'
1679
+ )}
1680
+ >
1681
+ {isPersonalExternalTask && (
1682
+ <Badge
1683
+ variant="secondary"
1684
+ className="h-5 min-w-0 max-w-[70%] gap-1 border border-dynamic-cyan/30 bg-dynamic-cyan/10 px-1.5 text-[10px] text-dynamic-cyan"
1685
+ title={[
1686
+ task.source_workspace_name,
1687
+ task.source_board_name,
1688
+ task.source_list_name,
1689
+ ]
1690
+ .filter(Boolean)
1691
+ .join(' / ')}
1692
+ >
1693
+ <ExternalLink className="h-2.5 w-2.5 shrink-0" />
1694
+ <span className="truncate">{externalSourceLabel}</span>
1695
+ </Badge>
1696
+ )}
1697
+ {/* Ticket Identifier */}
1698
+ {taskList?.status !== 'documents' && (
1699
+ <Badge
1700
+ variant="outline"
1701
+ className={cn(
1702
+ 'w-fit px-1 py-0 font-mono text-[10px]',
1703
+ getTicketBadgeColorClasses(taskList, task.priority)
1704
+ )}
1705
+ title={t('ticket_id_label', {
1706
+ id: taskTicketIdentifier,
1707
+ })}
1708
+ >
1709
+ {taskTicketIdentifier}
1710
+ </Badge>
1711
+ )}
1712
+ </div>
1713
+ <div className="mb-1">
1714
+ {/* Task Name */}
1715
+ <button
1716
+ type="button"
1717
+ className={cn(
1718
+ 'w-full cursor-pointer text-left font-semibold text-xs leading-tight transition-colors duration-200',
1719
+ 'line-clamp-2',
1720
+ task.closed_at || task.completed_at
1721
+ ? 'text-muted-foreground line-through'
1722
+ : '-mx-1 -my-0.5 rounded-sm px-1 py-0.5 text-foreground active:bg-muted/50'
1723
+ )}
1724
+ aria-label={t('edit_task_aria', { name: task.name })}
1725
+ title={t('click_to_edit_task')}
1726
+ >
1727
+ {task.name}
1728
+ </button>
1729
+ {showBlockedByUnderTitle && blockedByCluster}
1730
+ </div>
1731
+ </div>
1732
+ {/* Actions menu only */}
1733
+ <div className="flex items-center justify-end gap-1">
1734
+ {/* Main Actions Menu - With integrated date picker */}
1735
+ {!isOverlay && (
1736
+ <DropdownMenu
1737
+ open={menuOpen}
1738
+ onOpenChange={(open) => {
1739
+ setMenuOpen(open);
1740
+ if (!open) {
1741
+ setRelationshipMenusOpen({
1742
+ parent: false,
1743
+ dependencies: false,
1744
+ related: false,
1745
+ });
1746
+ }
1747
+ }}
1748
+ >
1749
+ <DropdownMenuTrigger asChild>
1750
+ <Button
1751
+ variant="ghost"
1752
+ size="xs"
1753
+ className={cn(
1754
+ 'h-7 w-7 shrink-0 p-0 transition-all duration-200',
1755
+ 'hover:scale-105 hover:bg-muted',
1756
+ menuOpen
1757
+ ? 'opacity-100'
1758
+ : 'opacity-0 group-hover:opacity-100',
1759
+ menuOpen && 'bg-muted ring-1 ring-border'
1760
+ )}
1761
+ >
1762
+ <MoreHorizontal className="h-3 w-3" />
1763
+ </Button>
1764
+ </DropdownMenuTrigger>
1765
+ <DropdownMenuContent
1766
+ align="end"
1767
+ className="w-56"
1768
+ sideOffset={5}
1769
+ onClick={(e) => {
1770
+ e.stopPropagation(); // Prevent triggering task card click
1771
+ }}
1772
+ >
1773
+ {taskList?.status !== 'documents' && (
1774
+ <DropdownMenuItem
1775
+ className="cursor-pointer"
1776
+ disabled={isLoading}
1777
+ >
1778
+ <Link
1779
+ href={`/${wsId}/time-tracker/timer?taskSelect=${task?.id}`}
1780
+ target="_blank"
1781
+ rel="noopener noreferrer"
1782
+ className="flex items-center gap-2"
1783
+ >
1784
+ <Timer className="h-4 w-4 text-dynamic-blue" />
1785
+ {t('start_tracking_time')}
1786
+ </Link>
1787
+ </DropdownMenuItem>
1788
+ )}
1789
+ {taskList?.status !== 'documents' && (
1790
+ <DropdownMenuSeparator />
1791
+ )}
1792
+ {/* Quick Completion Action */}
1793
+ {taskList?.status !== 'documents' && canMoveToCompletion && (
1794
+ <DropdownMenuItem
1795
+ onSelect={(e) =>
1796
+ handleMenuItemSelect(
1797
+ e as unknown as Event,
1798
+ handleMoveToCompletion
1799
+ )
1800
+ }
1801
+ className="cursor-pointer"
1802
+ disabled={isLoading}
1803
+ >
1804
+ <CheckCircle2 className="h-4 w-4 text-dynamic-green" />
1805
+ {targetCompletionList?.status === 'done'
1806
+ ? t('mark_as_done')
1807
+ : t('mark_as_closed')}
1808
+ </DropdownMenuItem>
1809
+ )}
1810
+
1811
+ {/* Mark as Closed Action - Only show if closed list exists and is different from the generic completion */}
1812
+ {taskList?.status !== 'documents' &&
1813
+ canMoveToClose &&
1814
+ targetClosedList?.id !== targetCompletionList?.id && (
1815
+ <DropdownMenuItem
1816
+ onSelect={(e) =>
1817
+ handleMenuItemSelect(
1818
+ e as unknown as Event,
1819
+ handleMoveToClose
1820
+ )
1821
+ }
1822
+ className="cursor-pointer"
1823
+ disabled={isLoading}
1824
+ >
1825
+ <CircleSlash className="h-4 w-4 text-dynamic-purple" />
1826
+ {t('mark_as_closed')}
1827
+ </DropdownMenuItem>
1828
+ )}
1829
+
1830
+ {taskList?.status !== 'documents' &&
1831
+ (canMoveToCompletion || canMoveToClose) && (
1832
+ <DropdownMenuSeparator />
1833
+ )}
1834
+
1835
+ {/* Priority Menu */}
1836
+ <TaskPriorityMenu
1837
+ currentPriority={task.priority ?? null}
1838
+ isLoading={isLoading}
1839
+ onPriorityChange={handlePriorityChange}
1840
+ onMenuItemSelect={handleMenuItemSelect}
1841
+ onClose={() => setMenuOpen(false)}
1842
+ translations={{
1843
+ priority: t('priority'),
1844
+ none: t('none'),
1845
+ urgent: t('priority_urgent'),
1846
+ high: t('priority_high'),
1847
+ medium: t('priority_medium'),
1848
+ low: t('priority_low'),
1849
+ }}
1850
+ />
1851
+
1852
+ {/* Due Date Menu */}
1853
+ <TaskDueDateMenu
1854
+ endDate={task.end_date}
1855
+ isLoading={isLoading}
1856
+ weekStartsOn={weekStartsOn}
1857
+ onDueDateChange={handleDueDateChange}
1858
+ onCustomDateClick={() => {
1859
+ setMenuOpen(false);
1860
+ setTimeout(
1861
+ () => dialogActions.openCustomDateDialog(),
1862
+ 100
1863
+ );
1864
+ }}
1865
+ onMenuItemSelect={handleMenuItemSelect}
1866
+ onClose={() => setMenuOpen(false)}
1867
+ translations={{
1868
+ dueDate: t('due_date'),
1869
+ none: t('none'),
1870
+ today: t('today'),
1871
+ tomorrow: t('tomorrow'),
1872
+ yesterday: t('yesterday'),
1873
+ thisWeek: t('this_week'),
1874
+ nextWeek: t('next_week'),
1875
+ customDate: t('custom_date'),
1876
+ removeDueDate: t('remove_due_date'),
1877
+ }}
1878
+ />
1879
+
1880
+ {/* Estimation Menu */}
1881
+ {boardConfig?.estimation_type && (
1882
+ <TaskEstimationMenu
1883
+ currentPoints={displayEstimation}
1884
+ estimationType={boardConfig?.estimation_type}
1885
+ extendedEstimation={boardConfig?.extended_estimation}
1886
+ allowZeroEstimates={boardConfig?.allow_zero_estimates}
1887
+ isLoading={estimationSaving}
1888
+ onEstimationChange={updateEstimationPoints}
1889
+ onMenuItemSelect={handleMenuItemSelect}
1890
+ />
1891
+ )}
1892
+
1893
+ {/* Labels Menu */}
1894
+ <TaskLabelsMenu
1895
+ taskLabels={displayLabels}
1896
+ availableLabels={availableLabelsForMenu}
1897
+ isLoading={labelsLoading}
1898
+ onToggleLabel={toggleTaskLabel}
1899
+ onCreateNewLabel={() => {
1900
+ openNewLabelDialog();
1901
+ setMenuOpen(false);
1902
+ }}
1903
+ onMenuItemSelect={handleMenuItemSelect}
1904
+ translations={{
1905
+ labels: t('labels'),
1906
+ searchLabels: t('search_labels'),
1907
+ loading: t('loading'),
1908
+ noLabelsFound: t('no_labels_found'),
1909
+ noLabelsAvailable: t('no_labels_available'),
1910
+ applied: t('applied'),
1911
+ createNewLabel: t('create_new_label'),
1912
+ }}
1913
+ />
1914
+
1915
+ {/* Projects Menu */}
1916
+ <TaskProjectsMenu
1917
+ taskProjects={displayProjects}
1918
+ availableProjects={workspaceProjects}
1919
+ isLoading={projectsLoading}
1920
+ onToggleProject={toggleTaskProject}
1921
+ onCreateNewProject={() => {
1922
+ dialogActions.openNewProjectDialog();
1923
+ setMenuOpen(false);
1924
+ }}
1925
+ onMenuItemSelect={handleMenuItemSelect}
1926
+ translations={{
1927
+ projects: t('projects'),
1928
+ searchProjects: t('search_projects'),
1929
+ loading: t('loading'),
1930
+ noProjectsFound: t('no_projects_found'),
1931
+ noProjectsAvailable: t('no_projects_available'),
1932
+ assigned: t('assigned'),
1933
+ createNewProject: t('create_new_project'),
1934
+ }}
1935
+ />
1936
+
1937
+ <DropdownMenuSeparator />
1938
+
1939
+ {/* Task Relationships Section */}
1940
+ {effectiveWorkspaceId && (
1941
+ <>
1942
+ {/* Parent Task Menu */}
1943
+ <TaskParentMenu
1944
+ wsId={effectiveWorkspaceId}
1945
+ taskId={task.id}
1946
+ parentTask={parentTask}
1947
+ childTaskIds={childTasks.map((t) => t.id)}
1948
+ isSaving={relationshipSaving}
1949
+ onSetParent={setParentTask}
1950
+ onRemoveParent={removeParentTask}
1951
+ onOpenChange={(open) =>
1952
+ setRelationshipMenusOpen((prev) => ({
1953
+ ...prev,
1954
+ parent: open,
1955
+ }))
1956
+ }
1957
+ translations={{
1958
+ parent_task: t('parent_task'),
1959
+ search_tasks: t('search_tasks'),
1960
+ error_loading_tasks: t('error'),
1961
+ no_matching_tasks: t('no-results'),
1962
+ no_available_tasks: t('no_tasks'),
1963
+ n_set: '1',
1964
+ }}
1965
+ />
1966
+
1967
+ {/* Blocking/Blocked By Menu */}
1968
+ <TaskBlockingMenu
1969
+ wsId={effectiveWorkspaceId}
1970
+ taskId={task.id}
1971
+ blockingTasks={blockingTasks}
1972
+ blockedByTasks={blockedByTasks}
1973
+ isSaving={relationshipSaving}
1974
+ savingTaskId={relationshipSavingTaskId}
1975
+ onAddBlocking={addBlockingTask}
1976
+ onRemoveBlocking={removeBlockingTask}
1977
+ onAddBlockedBy={addBlockedByTask}
1978
+ onRemoveBlockedBy={removeBlockedByTask}
1979
+ onOpenChange={(open) =>
1980
+ setRelationshipMenusOpen((prev) => ({
1981
+ ...prev,
1982
+ dependencies: open,
1983
+ }))
1984
+ }
1985
+ translations={{
1986
+ dependencies: t('dependencies'),
1987
+ blocks: t('blocks'),
1988
+ blocked_by: t('blocked_by'),
1989
+ search_tasks_to_block: t('search_tasks'),
1990
+ search_blocking_tasks: t('search_tasks'),
1991
+ error_loading_tasks: t('error'),
1992
+ no_matching_tasks: t('no-results'),
1993
+ no_available_tasks: t('no_tasks'),
1994
+ remove_dependency: t('remove'),
1995
+ tasks_that_cannot_start: t('blocks_help'),
1996
+ tasks_that_must_complete: t('blocked_by_help'),
1997
+ }}
1998
+ />
1999
+
2000
+ {/* Related Tasks Menu */}
2001
+ <TaskRelatedMenu
2002
+ wsId={effectiveWorkspaceId}
2003
+ taskId={task.id}
2004
+ relatedTasks={relatedTasks}
2005
+ isSaving={relationshipSaving}
2006
+ savingTaskId={relationshipSavingTaskId}
2007
+ onAddRelated={addRelatedTask}
2008
+ onRemoveRelated={removeRelatedTask}
2009
+ onOpenChange={(open) =>
2010
+ setRelationshipMenusOpen((prev) => ({
2011
+ ...prev,
2012
+ related: open,
2013
+ }))
2014
+ }
2015
+ translations={{
2016
+ related_tasks: t('related_tasks'),
2017
+ currently_related: t('currently_related'),
2018
+ search_tasks_to_link: t('search_tasks'),
2019
+ no_matching_tasks: t('no-results'),
2020
+ no_available_tasks: t('no_tasks'),
2021
+ related_tasks_help: t('related_tasks_help'),
2022
+ }}
2023
+ />
2024
+
2025
+ <DropdownMenuSeparator />
2026
+ </>
2027
+ )}
2028
+
2029
+ {/* Move Menu */}
2030
+ {availableLists.length > 0 && effectiveWorkspaceId && (
2031
+ <TaskMoveMenu
2032
+ currentListId={task.list_id}
2033
+ availableLists={availableLists}
2034
+ isLoading={isLoading}
2035
+ onMoveToList={handleMoveToList}
2036
+ onMenuItemSelect={handleMenuItemSelect}
2037
+ onRequestOpenCreateDialog={() => {
2038
+ setMenuOpen(false);
2039
+ setIsCreateListDialogOpen(true);
2040
+ }}
2041
+ translations={{
2042
+ move: t('move'),
2043
+ }}
2044
+ />
2045
+ )}
2046
+
2047
+ {isPersonalExternalTask && (
2048
+ <>
2049
+ {task.personal_board_id && task.personal_list_id && (
2050
+ <DropdownMenuItem
2051
+ onSelect={(e) =>
2052
+ handleMenuItemSelect(
2053
+ e as unknown as Event,
2054
+ () => void handleMoveToExternalStaging()
2055
+ )
2056
+ }
2057
+ className="cursor-pointer"
2058
+ disabled={isLoading}
2059
+ >
2060
+ <MoveRight className="h-4 w-4 text-dynamic-cyan" />
2061
+ {tTasks('move_to_external_tasks')}
2062
+ </DropdownMenuItem>
2063
+ )}
2064
+ {sourceBoardUrl && (
2065
+ <DropdownMenuItem asChild>
2066
+ <Link href={sourceBoardUrl}>
2067
+ <ExternalLink className="h-4 w-4 text-foreground" />
2068
+ {tTasks('open_source_board')}
2069
+ </Link>
2070
+ </DropdownMenuItem>
2071
+ )}
2072
+ {!task.is_personal_external_default && (
2073
+ <DropdownMenuItem
2074
+ onSelect={(e) =>
2075
+ handleMenuItemSelect(e as unknown as Event, () => {
2076
+ void handleRemoveFromPersonalBoard();
2077
+ })
2078
+ }
2079
+ className="cursor-pointer text-dynamic-red focus:text-dynamic-red"
2080
+ disabled={isLoading}
2081
+ >
2082
+ <Trash2 className="h-4 w-4" />
2083
+ {tTasks('remove_from_personal_board')}
2084
+ </DropdownMenuItem>
2085
+ )}
2086
+ <DropdownMenuSeparator />
2087
+ </>
2088
+ )}
2089
+
2090
+ {/* Assignee Actions - Show if not personal workspace */}
2091
+ {!isPersonalWorkspace && (
2092
+ <TaskAssigneesMenu
2093
+ taskAssignees={displayAssignees}
2094
+ availableMembers={workspaceMembers}
2095
+ isLoading={membersLoading}
2096
+ onToggleAssignee={onToggleAssignee}
2097
+ onMenuItemSelect={handleMenuItemSelect}
2098
+ translations={{
2099
+ assignees: t('assignees'),
2100
+ searchMembers: t('search_members'),
2101
+ loading: t('loading'),
2102
+ noMembersFound: t('no_members_found'),
2103
+ noMembersAvailable: t('no_members_available'),
2104
+ assigned: t('assigned'),
2105
+ memberNoLongerInWorkspace: t(
2106
+ 'member_no_longer_in_workspace'
2107
+ ),
2108
+ }}
2109
+ />
2110
+ )}
2111
+
2112
+ <DropdownMenuSeparator />
2113
+ {taskShareWsId && (
2114
+ <DropdownMenuItem
2115
+ onSelect={(e) =>
2116
+ handleMenuItemSelect(e as unknown as Event, () => {
2117
+ setShareDialogOpen(true);
2118
+ setMenuOpen(false);
2119
+ })
2120
+ }
2121
+ className="cursor-pointer"
2122
+ >
2123
+ <Share2 className="h-4 w-4 text-foreground" />
2124
+ {t('task_sharing.share_task')}
2125
+ </DropdownMenuItem>
2126
+ )}
2127
+ <DropdownMenuItem
2128
+ onSelect={handleDuplicateTask}
2129
+ className="cursor-pointer"
2130
+ >
2131
+ <Copy className="h-4 w-4 text-foreground" />
2132
+ {t('duplicate_task')}
2133
+ </DropdownMenuItem>
2134
+ <DropdownMenuItem
2135
+ onSelect={handleAddSubtask}
2136
+ className="cursor-pointer"
2137
+ >
2138
+ <ListTree className="h-4 w-4 text-foreground" />
2139
+ {t('add_subtask')}
2140
+ </DropdownMenuItem>
2141
+ <DropdownMenuSeparator />
2142
+ {!isPersonalExternalTask && (
2143
+ <DropdownMenuItem
2144
+ onSelect={(e) =>
2145
+ handleMenuItemSelect(e as unknown as Event, () => {
2146
+ dialogActions.openDeleteDialog();
2147
+ setMenuOpen(false);
2148
+ })
2149
+ }
2150
+ className="cursor-pointer"
2151
+ >
2152
+ <Trash2 className="h-4 w-4 text-dynamic-red" />
2153
+ {t('delete_task')}
2154
+ </DropdownMenuItem>
2155
+ )}
2156
+ </DropdownMenuContent>
2157
+ </DropdownMenu>
2158
+ )}
2159
+ </div>
2160
+ {/* Assignee: left, not cut off */}
2161
+ {!isPersonalWorkspace && (
2162
+ <div className="flex flex-none items-start justify-start">
2163
+ <AssigneeSelect
2164
+ taskId={task.id}
2165
+ assignees={task.assignees}
2166
+ onUpdate={onUpdate}
2167
+ />
2168
+ </div>
2169
+ )}
2170
+ </div>
2171
+ {/* Dates Section (improved layout & conditional rendering) */}
2172
+ {/* Hide dates when the list itself represents resolved work. */}
2173
+ {(startDate || endDate) && !isResolvedListStatus && (
2174
+ <div className="mb-1 space-y-0.5 text-[10px] leading-snug">
2175
+ {/* Show start only if in the future (hide historical start for visual simplicity) */}
2176
+ {startDate && startDate > now && (
2177
+ <div className="flex items-center gap-1 text-muted-foreground">
2178
+ <Clock className="h-2.5 w-2.5 shrink-0" />
2179
+ <span className="truncate">
2180
+ {t('starts_at', {
2181
+ date: formatSmartDate(
2182
+ startDate,
2183
+ {
2184
+ today: t('today'),
2185
+ tomorrow: t('tomorrow'),
2186
+ yesterday: t('yesterday'),
2187
+ },
2188
+ dateLocale
2189
+ ),
2190
+ })}
2191
+ </span>
2192
+ </div>
2193
+ )}
2194
+ {endDate && (
2195
+ <div
2196
+ className={cn(
2197
+ 'flex items-center gap-1',
2198
+ isOverdue && !task.closed_at
2199
+ ? 'font-medium text-dynamic-red'
2200
+ : 'text-muted-foreground'
2201
+ )}
2202
+ >
2203
+ <Calendar className="h-2.5 w-2.5 shrink-0" />
2204
+ <span className="truncate">
2205
+ {t('due_at', {
2206
+ date: formatSmartDate(
2207
+ endDate,
2208
+ {
2209
+ today: t('today'),
2210
+ tomorrow: t('tomorrow'),
2211
+ yesterday: t('yesterday'),
2212
+ },
2213
+ dateLocale
2214
+ ),
2215
+ })}
2216
+ </span>
2217
+ {isOverdue && !task.closed_at ? (
2218
+ <Badge className="ml-1 h-4 bg-dynamic-red px-1 font-semibold text-[9px] text-white tracking-wide">
2219
+ {t('overdue')}
2220
+ </Badge>
2221
+ ) : (
2222
+ <span className="ml-1 hidden text-[10px] text-muted-foreground md:inline">
2223
+ {format(endDate, `MMM dd '${t('at')}' ${timePattern}`, {
2224
+ locale: dateLocale,
2225
+ })}
2226
+ </span>
2227
+ )}
2228
+ </div>
2229
+ )}
2230
+ </div>
2231
+ )}
2232
+ {taskList?.status === 'done' || taskList?.status === 'closed' ? (
2233
+ /*
2234
+ Completion and Closed Dates Section
2235
+ Show completed_at when in done list, closed_at when in closed list
2236
+ */
2237
+ <div className="mb-1 flex min-h-5 items-center justify-between gap-2 text-[10px] leading-snug sm:min-h-6">
2238
+ <div className="min-w-0 space-y-0.5">
2239
+ {taskList?.status === 'done' && task.completed_at && (
2240
+ <div
2241
+ className={cn(
2242
+ 'flex min-w-0 items-center gap-1',
2243
+ getListTextColorClass(taskList?.color)
2244
+ )}
2245
+ >
2246
+ <CheckCircle2 className="h-2.5 w-2.5 shrink-0" />
2247
+ <span className="truncate">
2248
+ {t('completed')}{' '}
2249
+ {formatDistanceToNow(new Date(task.completed_at), {
2250
+ addSuffix: true,
2251
+ locale: dateLocale,
2252
+ })}
2253
+ </span>
2254
+ <span className="ml-1 hidden shrink-0 text-[10px] text-muted-foreground md:inline">
2255
+ {format(
2256
+ new Date(task.completed_at),
2257
+ `MMM dd '${t('at')}' ${timePattern}`,
2258
+ { locale: dateLocale }
2259
+ )}
2260
+ </span>
2261
+ </div>
2262
+ )}
2263
+ {taskList?.status === 'closed' && task.closed_at && (
2264
+ <div
2265
+ className={cn(
2266
+ 'flex min-w-0 items-center gap-1',
2267
+ getListTextColorClass(taskList?.color)
2268
+ )}
2269
+ >
2270
+ <CircleSlash className="h-2.5 w-2.5 shrink-0" />
2271
+ <span className="truncate">
2272
+ {t('closed')}{' '}
2273
+ {formatDistanceToNow(new Date(task.closed_at), {
2274
+ addSuffix: true,
2275
+ locale: dateLocale,
2276
+ })}
2277
+ </span>
2278
+ <span className="ml-1 hidden shrink-0 text-[10px] text-muted-foreground md:inline">
2279
+ {format(
2280
+ new Date(task.closed_at),
2281
+ `MMM dd '${t('at')}' ${timePattern}`,
2282
+ { locale: dateLocale }
2283
+ )}
2284
+ </span>
2285
+ </div>
2286
+ )}
2287
+ </div>
2288
+ {quickArchiveButton}
2289
+ </div>
2290
+ ) : (
2291
+ /*
2292
+ Bottom Row: Three-column layout for assignee, priority, and checkbox, with only one tag visible and +N tooltip for extras.
2293
+ Hide bottom row entirely when in done/closed list
2294
+ */
2295
+ <div className="flex items-center gap-2">
2296
+ {/* Hidden measurement container - render all badges to measure their width */}
2297
+ <div
2298
+ className="pointer-events-none absolute top-0 -left-2499.75 flex items-center gap-1 opacity-0"
2299
+ aria-hidden="true"
2300
+ >
2301
+ {taskBadges.map((badge) => badge.element)}
2302
+ </div>
2303
+ {/* Visible container - only show badges that fit */}
2304
+ <div
2305
+ ref={containerRef}
2306
+ className="scrollbar-hide flex w-full items-center gap-1 overflow-auto whitespace-nowrap rounded-lg"
2307
+ >
2308
+ {showBlockedByInlineWithCheckbox && (
2309
+ <div className="min-w-0 flex-1">{blockedByCluster}</div>
2310
+ )}
2311
+ {visibleBadges.map((badge) => badge.element)}
2312
+ {visibleBadges.length > 0 && hiddenBadges.length > 0 && (
2313
+ <HoverCard openDelay={200}>
2314
+ <HoverCardTrigger asChild>
2315
+ <Badge
2316
+ variant="secondary"
2317
+ className="cursor-pointer border border-border bg-muted/50 font-medium text-[10px] text-muted-foreground hover:bg-muted"
2318
+ >
2319
+ +{hiddenBadges.length}
2320
+ </Badge>
2321
+ </HoverCardTrigger>
2322
+ <HoverCardContent
2323
+ side="top"
2324
+ align="start"
2325
+ className="flex w-auto max-w-xs flex-col gap-2 p-2"
2326
+ >
2327
+ <div className="text-center font-semibold text-sm">
2328
+ {t('other_properties')}
2329
+ </div>
2330
+ <div className="border" />
2331
+ <div className="flex flex-col gap-2">
2332
+ {hiddenBadges.map((badge) => badge.element)}
2333
+ </div>
2334
+ </HoverCardContent>
2335
+ </HoverCard>
2336
+ )}
2337
+ {/* Description indicators */}
2338
+ {(descriptionMeta.hasText ||
2339
+ descriptionMeta.hasImages ||
2340
+ descriptionMeta.hasVideos ||
2341
+ descriptionMeta.hasLinks) && (
2342
+ <div
2343
+ ref={descriptionMetaRef}
2344
+ className="flex min-w-0 shrink-0 items-center gap-0.5"
2345
+ >
2346
+ {descriptionMeta.hasText && (
2347
+ <div
2348
+ className="flex items-center gap-0.5 rounded bg-dynamic-surface/50 py-0.5"
2349
+ title={t('has_description')}
2350
+ >
2351
+ <FileText className="h-3.5 w-3.5 text-muted-foreground" />
2352
+ </div>
2353
+ )}
2354
+ {descriptionMeta.hasImages && (
2355
+ <div
2356
+ className="flex items-center gap-0.5 rounded bg-dynamic-surface/50 py-0.5"
2357
+ title={t('n_images', {
2358
+ count: descriptionMeta.imageCount,
2359
+ })}
2360
+ >
2361
+ <ImageIcon className="h-3.5 w-3.5 text-muted-foreground" />
2362
+ {descriptionMeta.imageCount > 1 && (
2363
+ <span className="text-[9px] text-muted-foreground">
2364
+ {descriptionMeta.imageCount}
2365
+ </span>
2366
+ )}
2367
+ </div>
2368
+ )}
2369
+ {descriptionMeta.hasVideos && (
2370
+ <div
2371
+ className="flex items-center gap-0.5 rounded bg-dynamic-surface/50 py-0.5"
2372
+ title={t('n_videos', {
2373
+ count: descriptionMeta.videoCount,
2374
+ })}
2375
+ >
2376
+ <Play className="h-3.5 w-3.5 text-muted-foreground" />
2377
+ {descriptionMeta.videoCount > 1 && (
2378
+ <span className="text-[9px] text-muted-foreground">
2379
+ {descriptionMeta.videoCount}
2380
+ </span>
2381
+ )}
2382
+ </div>
2383
+ )}
2384
+ {descriptionMeta.hasLinks && (
2385
+ <div
2386
+ className="flex items-center gap-0.5 rounded bg-dynamic-surface/50 px-1 py-0.5"
2387
+ title={t('n_links', { count: descriptionMeta.linkCount })}
2388
+ >
2389
+ <Link2 className="h-2.5 w-2.5 text-muted-foreground" />
2390
+ {descriptionMeta.linkCount > 1 && (
2391
+ <span className="text-[9px] text-muted-foreground">
2392
+ {descriptionMeta.linkCount}
2393
+ </span>
2394
+ )}
2395
+ </div>
2396
+ )}
2397
+ </div>
2398
+ )}
2399
+ </div>
2400
+ <div className="flex min-h-5 items-center gap-2 sm:min-h-6">
2401
+ {!isPersonalWorkspace && (
2402
+ <TaskViewerAvatarsComponent taskId={task.id} />
2403
+ )}
2404
+
2405
+ {/* Checkbox: hidden for documents lists */}
2406
+ {taskList?.status !== 'documents' && (
2407
+ <TaskCardCheckbox
2408
+ task={task}
2409
+ taskList={taskList}
2410
+ isLoading={isLoading}
2411
+ onToggle={handleArchiveToggle}
2412
+ />
2413
+ )}
2414
+ </div>
2415
+ </div>
2416
+ )}
2417
+ </div>
2418
+ <TaskDeleteDialog
2419
+ task={task}
2420
+ open={dialogState.deleteDialogOpen}
2421
+ isLoading={isLoading}
2422
+ onOpenChange={(open) =>
2423
+ open
2424
+ ? dialogActions.openDeleteDialog()
2425
+ : dialogActions.closeDeleteDialog()
2426
+ }
2427
+ onConfirm={handleDelete}
2428
+ translations={{
2429
+ delete_task: t('delete_task'),
2430
+ delete_task_confirmation: t('delete_task_confirmation', {
2431
+ name: task.name ?? '',
2432
+ }),
2433
+ cancel: t('cancel'),
2434
+ deleting: t('deleting'),
2435
+ }}
2436
+ />
2437
+ {effectiveWorkspaceId && (
2438
+ <CreateListDialog
2439
+ open={isCreateListDialogOpen}
2440
+ onOpenChange={setIsCreateListDialogOpen}
2441
+ boardId={boardId}
2442
+ wsId={effectiveWorkspaceId}
2443
+ initialStatus="active"
2444
+ onSuccess={(listId) => {
2445
+ handleMoveToList(listId);
2446
+ }}
2447
+ translations={{
2448
+ listNameAlreadyExists: taskBoardT(
2449
+ 'ws-task-boards.layout_settings.list_name_exists'
2450
+ ),
2451
+ }}
2452
+ />
2453
+ )}
2454
+ <TaskNewLabelDialog
2455
+ open={dialogState.newLabelDialogOpen}
2456
+ newLabelName={newLabelName}
2457
+ newLabelColor={newLabelColor}
2458
+ creatingLabel={creatingLabel}
2459
+ onNameChange={setNewLabelName}
2460
+ onColorChange={setNewLabelColor}
2461
+ onOpenChange={(open) =>
2462
+ open ? openNewLabelDialog() : dialogActions.closeNewLabelDialog()
2463
+ }
2464
+ onConfirm={async () => {
2465
+ const result = await createNewLabel();
2466
+ if (result) dialogActions.closeNewLabelDialog();
2467
+ }}
2468
+ translations={{
2469
+ create_new_label: t('create_new_label'),
2470
+ create_new_label_description: t('create_new_label_description'),
2471
+ label_name: t('label_name'),
2472
+ color: t('color'),
2473
+ preview: t('preview'),
2474
+ cancel: t('cancel'),
2475
+ creating: t('creating'),
2476
+ create_label: t('create_label'),
2477
+ randomize_color: t('randomize_color'),
2478
+ }}
2479
+ />
2480
+
2481
+ <TaskNewProjectDialog
2482
+ open={dialogState.newProjectDialogOpen}
2483
+ newProjectName={newProjectName}
2484
+ creatingProject={creatingProject}
2485
+ onNameChange={setNewProjectName}
2486
+ onOpenChange={(open) =>
2487
+ open
2488
+ ? dialogActions.openNewProjectDialog()
2489
+ : dialogActions.closeNewProjectDialog()
2490
+ }
2491
+ onConfirm={async () => {
2492
+ const result = await createNewProject();
2493
+ if (result) dialogActions.closeNewProjectDialog();
2494
+ }}
2495
+ translations={{
2496
+ create_new_project: t('create_new_project'),
2497
+ create_new_project_description: t('create_new_project_description'),
2498
+ project_name: t('project_name'),
2499
+ cancel: t('cancel'),
2500
+ creating: t('creating'),
2501
+ create_project: t('create_project'),
2502
+ }}
2503
+ />
2504
+
2505
+ <TaskCustomDateDialog
2506
+ open={dialogState.customDateDialogOpen}
2507
+ endDate={task.end_date ?? null}
2508
+ isLoading={isLoading}
2509
+ onOpenChange={(open) =>
2510
+ open
2511
+ ? dialogActions.openCustomDateDialog()
2512
+ : dialogActions.closeCustomDateDialog()
2513
+ }
2514
+ onDateChange={handleCustomDateChange}
2515
+ onClear={() => {
2516
+ handleDueDateChange(null);
2517
+ dialogActions.closeCustomDateDialog();
2518
+ }}
2519
+ translations={{
2520
+ set_custom_due_date: t('set_custom_due_date'),
2521
+ custom_due_date_description: t('custom_due_date_description'),
2522
+ cancel: t('cancel'),
2523
+ remove_due_date: t('remove_due_date'),
2524
+ }}
2525
+ />
2526
+ {taskShareWsId && (
2527
+ <TaskShareDialog
2528
+ open={shareDialogOpen}
2529
+ onOpenChange={setShareDialogOpen}
2530
+ taskId={task.id}
2531
+ taskName={task.name ?? ''}
2532
+ wsId={taskShareWsId}
2533
+ />
2534
+ )}
2535
+
2536
+ {!isOverlay && !isPersonalExternalTask && (
2537
+ <TaskActions taskId={task.id} boardId={boardId} onUpdate={onUpdate} />
2538
+ )}
2539
+ </Card>
2540
+ );
2541
+ }
2542
+
2543
+ export const TaskCard = React.memo(TaskCardInner, areTaskCardPropsEqual);