@tuturuuu/ui 0.8.0 → 0.10.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 (245) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/biome.json +1 -1
  3. package/package.json +74 -71
  4. package/src/components/ui/accordion.tsx +1 -1
  5. package/src/components/ui/breadcrumb.tsx +1 -1
  6. package/src/components/ui/calendar-app/calendar-page-shell.tsx +4 -0
  7. package/src/components/ui/calendar-app/components/calendar-connections-settings-content.tsx +239 -33
  8. package/src/components/ui/calendar-app/components/load-smart-scheduling-tasks.tsx +143 -0
  9. package/src/components/ui/calendar-app/components/priority-view.tsx +10 -3
  10. package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +4 -116
  11. package/src/components/ui/calendar-app/components/use-calendar-connections-manager.ts +67 -2
  12. package/src/components/ui/calendar.tsx +1 -1
  13. package/src/components/ui/carousel.tsx +1 -1
  14. package/src/components/ui/chat/chat-agent-details-external-thread-panel.test.tsx +1 -1
  15. package/src/components/ui/chat/chat-agent-details-external-thread-panel.tsx +1 -1
  16. package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +1 -1
  17. package/src/components/ui/chat/chat-agent-details-operations-panel.tsx +1 -1
  18. package/src/components/ui/chat/chat-agent-details-setup-panel.tsx +1 -1
  19. package/src/components/ui/chat/chat-agent-details-sidebar.test.tsx +1 -1
  20. package/src/components/ui/chat/chat-agent-details-sidebar.tsx +2 -2
  21. package/src/components/ui/chat/chat-agent-details-utils.test.ts +1 -1
  22. package/src/components/ui/chat/chat-agent-details-utils.tsx +1 -1
  23. package/src/components/ui/chat/chat-agent-details-zalo-personal-panel.tsx +2 -2
  24. package/src/components/ui/checkbox.tsx +1 -1
  25. package/src/components/ui/color-picker.tsx +1 -1
  26. package/src/components/ui/command.tsx +1 -1
  27. package/src/components/ui/context-menu.tsx +5 -1
  28. package/src/components/ui/custom/__tests__/settings-dialog-search.test.ts +78 -0
  29. package/src/components/ui/custom/__tests__/settings-dialog-shell-compile-graph.test.ts +76 -0
  30. package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +3 -0
  31. package/src/components/ui/custom/__tests__/workspace-select-helpers.test.ts +46 -1
  32. package/src/components/ui/custom/combobox.test.tsx +195 -0
  33. package/src/components/ui/custom/combobox.tsx +273 -156
  34. package/src/components/ui/custom/education/modules/youtube/delete-link-button.tsx +5 -13
  35. package/src/components/ui/custom/facebook-mockup/facebook-mockup.tsx +7 -1
  36. package/src/components/ui/custom/facebook-mockup/form.tsx +1 -1
  37. package/src/components/ui/custom/facebook-mockup/image-upload-field.tsx +1 -1
  38. package/src/components/ui/custom/facebook-mockup/preview.tsx +1 -1
  39. package/src/components/ui/custom/nav-link.test.tsx +165 -0
  40. package/src/components/ui/custom/nav-link.tsx +69 -11
  41. package/src/components/ui/custom/navigation.tsx +1 -0
  42. package/src/components/ui/custom/settings/task-settings.tsx +104 -0
  43. package/src/components/ui/custom/settings-dialog-search-loader.d.ts +5 -0
  44. package/src/components/ui/custom/settings-dialog-search-loader.js +3 -0
  45. package/src/components/ui/custom/settings-dialog-search.ts +75 -0
  46. package/src/components/ui/custom/settings-dialog-shell.tsx +65 -28
  47. package/src/components/ui/custom/theme-toggle.tsx +1 -1
  48. package/src/components/ui/custom/workspace-select-helpers.ts +23 -0
  49. package/src/components/ui/custom/workspace-select.tsx +25 -19
  50. package/src/components/ui/dialog.test.tsx +52 -0
  51. package/src/components/ui/dialog.tsx +6 -2
  52. package/src/components/ui/dropdown-menu.tsx +5 -1
  53. package/src/components/ui/finance/debts/debt-loan-form.tsx +12 -5
  54. package/src/components/ui/finance/debts/debt-loan-summary.tsx +3 -2
  55. package/src/components/ui/finance/debts/debts-page.test.tsx +54 -5
  56. package/src/components/ui/finance/debts/debts-page.tsx +15 -2
  57. package/src/components/ui/finance/invoices/components/subscription-group-selector.tsx +3 -5
  58. package/src/components/ui/finance/invoices/new-invoice-page.test.tsx +25 -5
  59. package/src/components/ui/finance/invoices/new-invoice-page.tsx +7 -2
  60. package/src/components/ui/finance/invoices/standard-invoice.tsx +4 -2
  61. package/src/components/ui/finance/invoices/subscription-invoice.tsx +4 -2
  62. package/src/components/ui/finance/invoices/utils.ts +3 -1
  63. package/src/components/ui/finance/transactions/form-content-dialog.tsx +3 -0
  64. package/src/components/ui/finance/transactions/form-types.ts +1 -0
  65. package/src/components/ui/finance/transactions/form.tsx +2 -0
  66. package/src/components/ui/finance/transactions/infinite-transactions-list.tsx +2 -0
  67. package/src/components/ui/finance/transactions/period-charts/category-breakdown-dialog.tsx +1 -1
  68. package/src/components/ui/finance/transactions/transaction-edit-dialog.tsx +1 -4
  69. package/src/components/ui/finance/transactions/transactions-create-summary.tsx +3 -0
  70. package/src/components/ui/finance/transactions/transactions-page.tsx +4 -1
  71. package/src/components/ui/finance/wallets/form.test.tsx +51 -3
  72. package/src/components/ui/finance/wallets/form.tsx +15 -4
  73. package/src/components/ui/finance/wallets/walletId/wallet-details-actions.tsx +4 -0
  74. package/src/components/ui/finance/wallets/walletId/wallet-details-page.tsx +4 -2
  75. package/src/components/ui/finance/wallets/wallets-data-table.tsx +1 -0
  76. package/src/components/ui/finance/wallets/wallets-page.tsx +5 -2
  77. package/src/components/ui/input-otp.tsx +1 -1
  78. package/src/components/ui/legacy/calendar/all-day-event-bar.tsx +28 -39
  79. package/src/components/ui/legacy/calendar/calendar-cell.tsx +2 -0
  80. package/src/components/ui/legacy/calendar/calendar-content.tsx +10 -6
  81. package/src/components/ui/legacy/calendar/calendar-header.tsx +23 -3
  82. package/src/components/ui/legacy/calendar/calendar-loading-skeleton.tsx +135 -0
  83. package/src/components/ui/legacy/calendar/calendar-matrix.tsx +175 -237
  84. package/src/components/ui/legacy/calendar/event-card.test.tsx +177 -0
  85. package/src/components/ui/legacy/calendar/event-card.tsx +220 -131
  86. package/src/components/ui/legacy/calendar/event-modal.tsx +17 -17
  87. package/src/components/ui/legacy/calendar/event-provider-display.tsx +69 -0
  88. package/src/components/ui/legacy/calendar/smart-calendar.test.tsx +86 -4
  89. package/src/components/ui/legacy/calendar/smart-calendar.tsx +32 -2
  90. package/src/components/ui/legacy/meet/create-plan-dialog.tsx +19 -10
  91. package/src/components/ui/navigation-menu.tsx +1 -1
  92. package/src/components/ui/pagination.tsx +1 -1
  93. package/src/components/ui/radio-group.tsx +1 -1
  94. package/src/components/ui/select.tsx +5 -1
  95. package/src/components/ui/sheet.tsx +1 -1
  96. package/src/components/ui/sidebar.tsx +1 -1
  97. package/src/components/ui/storefront/cart-popover.tsx +61 -0
  98. package/src/components/ui/storefront/cart-summary-parts.tsx +290 -0
  99. package/src/components/ui/storefront/cart-summary.tsx +93 -154
  100. package/src/components/ui/storefront/checkout-overlay.tsx +4 -5
  101. package/src/components/ui/storefront/listing-card.tsx +1 -1
  102. package/src/components/ui/storefront/merch-sections.tsx +70 -0
  103. package/src/components/ui/storefront/product-detail.tsx +1 -1
  104. package/src/components/ui/storefront/storefront-surface.test.tsx +106 -11
  105. package/src/components/ui/storefront/storefront-surface.tsx +101 -166
  106. package/src/components/ui/storefront/types.ts +4 -0
  107. package/src/components/ui/storefront/utils.ts +6 -0
  108. package/src/components/ui/text-editor/__tests__/extensions.test.ts +123 -0
  109. package/src/components/ui/text-editor/background-color-extension.ts +62 -0
  110. package/src/components/ui/text-editor/color-controls.tsx +284 -0
  111. package/src/components/ui/text-editor/editor.tsx +69 -14
  112. package/src/components/ui/text-editor/extensions.ts +8 -2
  113. package/src/components/ui/text-editor/highlight-extension.ts +22 -0
  114. package/src/components/ui/text-editor/tool-bar.tsx +9 -16
  115. package/src/components/ui/toast.tsx +1 -1
  116. package/src/components/ui/tu-do/boards/__tests__/board-share-dialog.test.tsx +286 -0
  117. package/src/components/ui/tu-do/boards/__tests__/task-board-form.test.tsx +12 -0
  118. package/src/components/ui/tu-do/boards/board-public-link-section.tsx +231 -0
  119. package/src/components/ui/tu-do/boards/board-share-dialog.tsx +15 -226
  120. package/src/components/ui/tu-do/boards/board-share-settings-panel.tsx +351 -0
  121. package/src/components/ui/tu-do/boards/boardId/board-column.tsx +121 -39
  122. package/src/components/ui/tu-do/boards/boardId/enhanced-task-list.tsx +7 -0
  123. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +2 -0
  124. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +5 -0
  125. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +3 -0
  126. package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-operation-types.ts +3 -3
  127. package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +50 -2
  128. package/src/components/ui/tu-do/boards/boardId/kanban/data/use-bulk-resources.ts +59 -5
  129. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +17 -0
  130. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +4 -1
  131. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/drag-preview.tsx +20 -1
  132. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +38 -9
  133. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +2 -8
  134. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-sort-key.ts +47 -0
  135. package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +81 -30
  136. package/src/components/ui/tu-do/boards/boardId/kanban/planner/__tests__/kanban-planner-island.test.tsx +380 -0
  137. package/src/components/ui/tu-do/boards/boardId/kanban/planner/kanban-planner-dialog.tsx +204 -0
  138. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-digest-panel.tsx +61 -0
  139. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-item-strip.tsx +54 -0
  140. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-plan-toolbar.tsx +251 -0
  141. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-scope-badge.tsx +27 -0
  142. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-section.tsx +58 -0
  143. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-share-dialog.tsx +238 -0
  144. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-target-controls.tsx +143 -0
  145. package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-utils.ts +65 -0
  146. package/src/components/ui/tu-do/boards/boardId/kanban/planner/use-kanban-planner-state.ts +234 -0
  147. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +642 -5
  148. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +224 -15
  149. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +535 -53
  150. package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +101 -33
  151. package/src/components/ui/tu-do/boards/boardId/kanban.tsx +235 -113
  152. package/src/components/ui/tu-do/boards/boardId/task-board-server-page.test.tsx +50 -5
  153. package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +12 -2
  154. package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +10 -1
  155. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +3 -0
  156. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.test.ts +20 -0
  157. package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.ts +10 -0
  158. package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +271 -36
  159. package/src/components/ui/tu-do/boards/boardId/task-filter.test.tsx +152 -0
  160. package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +555 -545
  161. package/src/components/ui/tu-do/boards/boardId/task-list.tsx +22 -0
  162. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-grid.tsx +9 -0
  163. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-task-row.tsx +9 -0
  164. package/src/components/ui/tu-do/boards/boardId/timeline/timeline-toolbar.tsx +9 -0
  165. package/src/components/ui/tu-do/boards/boardId/timeline-board.tsx +35 -3
  166. package/src/components/ui/tu-do/boards/form.tsx +1 -1
  167. package/src/components/ui/tu-do/boards/share-section.tsx +100 -0
  168. package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +10 -12
  169. package/src/components/ui/tu-do/drafts/drafts-page.tsx +33 -16
  170. package/src/components/ui/tu-do/hooks/__tests__/useTaskLabelManagement.test.tsx +48 -0
  171. package/src/components/ui/tu-do/hooks/__tests__/useTaskProjectManagement.test.tsx +144 -0
  172. package/src/components/ui/tu-do/hooks/useTaskDialog.ts +7 -0
  173. package/src/components/ui/tu-do/hooks/useTaskLabelManagement.ts +115 -106
  174. package/src/components/ui/tu-do/hooks/useTaskProjectManagement.ts +115 -122
  175. package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +56 -88
  176. package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +26 -2
  177. package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +55 -8
  178. package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +1 -4
  179. package/src/components/ui/tu-do/progress/task-progress-import-panel.tsx +60 -0
  180. package/src/components/ui/tu-do/progress/task-progress-leaderboards-panel.tsx +156 -0
  181. package/src/components/ui/tu-do/progress/task-progress-page.tsx +348 -0
  182. package/src/components/ui/tu-do/progress/task-progress-panels.tsx +301 -0
  183. package/src/components/ui/tu-do/providers/task-dialog-provider.tsx +26 -0
  184. package/src/components/ui/tu-do/shared/__tests__/assignee-select.test.tsx +81 -10
  185. package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +141 -1
  186. package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +377 -36
  187. package/src/components/ui/tu-do/shared/__tests__/board-switcher.test.tsx +374 -0
  188. package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +419 -5
  189. package/src/components/ui/tu-do/shared/__tests__/task-board-loading-state.test.tsx +38 -0
  190. package/src/components/ui/tu-do/shared/__tests__/task-cache-patches.test.ts +147 -0
  191. package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +16 -0
  192. package/src/components/ui/tu-do/shared/__tests__/use-progressive-board-loader.test.tsx +3 -0
  193. package/src/components/ui/tu-do/shared/assignee-select.tsx +77 -26
  194. package/src/components/ui/tu-do/shared/board-client.tsx +15 -10
  195. package/src/components/ui/tu-do/shared/board-config-storage.ts +7 -1
  196. package/src/components/ui/tu-do/shared/board-header.tsx +471 -975
  197. package/src/components/ui/tu-do/shared/board-layout-settings.tsx +165 -136
  198. package/src/components/ui/tu-do/shared/board-switcher.tsx +244 -220
  199. package/src/components/ui/tu-do/shared/board-user-presence-avatars.tsx +18 -12
  200. package/src/components/ui/tu-do/shared/board-views.tsx +577 -85
  201. package/src/components/ui/tu-do/shared/list-view.tsx +246 -2
  202. package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +142 -94
  203. package/src/components/ui/tu-do/shared/special-task-list-pins.ts +51 -0
  204. package/src/components/ui/tu-do/shared/task-board-loading-state.tsx +28 -0
  205. package/src/components/ui/tu-do/shared/task-cache-patches.ts +394 -0
  206. package/src/components/ui/tu-do/shared/task-dialog-manager.tsx +21 -1
  207. package/src/components/ui/tu-do/shared/task-edit-dialog/components/quick-settings-popover.tsx +5 -1
  208. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-dialog-header.tsx +25 -2
  209. package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-list-selector.tsx +7 -1
  210. package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +3 -2
  211. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-data.ts +79 -10
  212. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-mutations.ts +76 -77
  213. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.test.tsx +63 -0
  214. package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-relationships.ts +78 -69
  215. package/src/components/ui/tu-do/shared/task-edit-dialog/personal-overrides-section.tsx +28 -8
  216. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/dependencies-section.tsx +14 -3
  217. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/parent-section.tsx +6 -1
  218. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/related-section.tsx +6 -1
  219. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/subtasks-section.tsx +6 -1
  220. package/src/components/ui/tu-do/shared/task-edit-dialog/relationships/types/task-relationships.types.ts +8 -0
  221. package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.test.tsx +91 -0
  222. package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +123 -78
  223. package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +7 -1
  224. package/src/components/ui/tu-do/shared/task-edit-dialog/task-dialog-actions.tsx +8 -1
  225. package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.test.tsx +150 -0
  226. package/src/components/ui/tu-do/shared/task-edit-dialog/task-properties-section.tsx +61 -35
  227. package/src/components/ui/tu-do/shared/task-edit-dialog/task-relationships-properties.tsx +44 -2
  228. package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +8 -3
  229. package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +11 -1
  230. package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +2 -9
  231. package/src/components/ui/tu-do/shared/task-row-actions-menu.tsx +11 -0
  232. package/src/components/ui/tu-do/shared/use-progressive-board-loader.ts +2 -0
  233. package/src/declarations.d.ts +1 -0
  234. package/src/hooks/__tests__/use-calendar-readonly.test.tsx +322 -2
  235. package/src/hooks/__tests__/use-calendar-sync.test.tsx +446 -0
  236. package/src/hooks/__tests__/useBoardPresence.test.tsx +191 -0
  237. package/src/hooks/__tests__/useBoardRealtime.test.tsx +24 -144
  238. package/src/hooks/use-calendar-sync.tsx +247 -243
  239. package/src/hooks/use-calendar.tsx +323 -138
  240. package/src/hooks/use-task-actions.ts +24 -0
  241. package/src/hooks/use-user-workspace-config.ts +75 -0
  242. package/src/hooks/use-workspace-currency.ts +8 -3
  243. package/src/hooks/useBoardPresence.ts +364 -0
  244. package/src/hooks/useBoardRealtimeEventHandler.ts +45 -90
  245. package/src/lib/workspace-actions.ts +2 -6
@@ -3,8 +3,11 @@ import {
3
3
  type CalendarSourceOption,
4
4
  getGoogleCalendarAuthUrl,
5
5
  getWorkspaceCalendarDefaultSource,
6
+ getWorkspaceCalendarSyncPreferences,
7
+ updateCalendarConnection as updateCalendarConnectionRequest,
6
8
  updateWorkspaceCalendarDefaultSource,
7
- } from '@tuturuuu/internal-api';
9
+ updateWorkspaceCalendarSyncPreferences,
10
+ } from '@tuturuuu/internal-api/calendar';
8
11
  import { createClient } from '@tuturuuu/supabase/next/client';
9
12
  import { useRouter } from 'next/navigation';
10
13
  import { useTranslations } from 'next-intl';
@@ -184,6 +187,12 @@ export function useCalendarConnectionsManager(wsId: string) {
184
187
  staleTime: 30_000,
185
188
  });
186
189
 
190
+ const { data: syncPreferencesData } = useQuery({
191
+ queryKey: ['calendar-sync-preferences', wsId],
192
+ queryFn: () => getWorkspaceCalendarSyncPreferences(wsId),
193
+ staleTime: 30_000,
194
+ });
195
+
187
196
  const defaultSourceMutation = useMutation({
188
197
  mutationFn: async (sourceId: string) => {
189
198
  const option = defaultSourceData?.options.find(
@@ -209,6 +218,46 @@ export function useCalendarConnectionsManager(wsId: string) {
209
218
  },
210
219
  });
211
220
 
221
+ const syncPreferencesMutation = useMutation({
222
+ mutationFn: (
223
+ payload: Parameters<typeof updateWorkspaceCalendarSyncPreferences>[1]
224
+ ) => updateWorkspaceCalendarSyncPreferences(wsId, payload),
225
+ onSuccess: () => {
226
+ queryClient.invalidateQueries({
227
+ queryKey: ['calendar-sync-preferences', wsId],
228
+ });
229
+ toast.success(
230
+ t('calendar_sync_settings_updated') || 'Calendar sync settings updated'
231
+ );
232
+ },
233
+ onError: (error: Error) => {
234
+ toast.error(error.message || 'Failed to update calendar sync settings');
235
+ },
236
+ });
237
+
238
+ const updateConnectionSyncSettingsMutation = useMutation({
239
+ mutationFn: (
240
+ payload: Parameters<typeof updateCalendarConnectionRequest>[0]
241
+ ) => updateCalendarConnectionRequest(payload),
242
+ onSuccess: () => {
243
+ queryClient.invalidateQueries({
244
+ queryKey: ['calendar-connections', wsId],
245
+ });
246
+ queryClient.invalidateQueries({
247
+ queryKey: ['provider-calendar-list', wsId],
248
+ });
249
+ queryClient.invalidateQueries({
250
+ queryKey: ['calendar-sync-preferences', wsId],
251
+ });
252
+ toast.success(
253
+ t('calendar_sync_settings_updated') || 'Calendar sync settings updated'
254
+ );
255
+ },
256
+ onError: (error: Error) => {
257
+ toast.error(error.message || 'Failed to update calendar sync settings');
258
+ },
259
+ });
260
+
212
261
  // Fetch current user's email
213
262
  const { data: userEmail } = useQuery({
214
263
  queryKey: ['current-user-email'],
@@ -621,7 +670,13 @@ export function useCalendarConnectionsManager(wsId: string) {
621
670
  const existingConnection = calendarConnections.find(
622
671
  (conn) =>
623
672
  conn.calendar_id === apiCal.id && conn.auth_token_id === account.id
624
- );
673
+ ) as
674
+ | ((typeof calendarConnections)[number] & {
675
+ sync_delete_enabled?: boolean | null;
676
+ sync_inbound_enabled?: boolean | null;
677
+ sync_outbound_enabled?: boolean | null;
678
+ })
679
+ | undefined;
625
680
 
626
681
  return {
627
682
  id: existingConnection?.id || apiCal.id,
@@ -634,6 +689,10 @@ export function useCalendarConnectionsManager(wsId: string) {
634
689
  connectionExists: !!existingConnection,
635
690
  accountId: account.id,
636
691
  accessRole: apiCal.accessRole,
692
+ syncDeleteEnabled: existingConnection?.sync_delete_enabled ?? true,
693
+ syncInboundEnabled: existingConnection?.sync_inbound_enabled ?? true,
694
+ syncOutboundEnabled:
695
+ existingConnection?.sync_outbound_enabled ?? false,
637
696
  };
638
697
  });
639
698
 
@@ -652,6 +711,9 @@ export function useCalendarConnectionsManager(wsId: string) {
652
711
  connectionExists: boolean;
653
712
  accountId: string;
654
713
  accessRole: string;
714
+ syncDeleteEnabled: boolean;
715
+ syncInboundEnabled: boolean;
716
+ syncOutboundEnabled: boolean;
655
717
  }>
656
718
  >
657
719
  );
@@ -688,6 +750,8 @@ export function useCalendarConnectionsManager(wsId: string) {
688
750
  showCreateCalendarDialog,
689
751
  syncHealth,
690
752
  syncMutation,
753
+ syncPreferencesData,
754
+ syncPreferencesMutation,
691
755
  syncStatusStyles,
692
756
  syncToTuturuuu,
693
757
  systemCalendars,
@@ -696,6 +760,7 @@ export function useCalendarConnectionsManager(wsId: string) {
696
760
  togglingTuturuuuIds,
697
761
  toggleAccountExpanded,
698
762
  toggleWorkspaceCalendarMutation,
763
+ updateConnectionSyncSettingsMutation,
699
764
  tuturuuuEnabledCount,
700
765
  userEmail,
701
766
  workspaceCalendars,
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { ChevronLeft, ChevronRight } from '@tuturuuu/icons';
3
+ import { ChevronLeft, ChevronRight } from '@tuturuuu/icons/lucide-static';
4
4
  import { cn } from '@tuturuuu/utils/format';
5
5
  import { format } from 'date-fns';
6
6
  import dayjs from 'dayjs';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { ArrowLeft, ArrowRight } from '@tuturuuu/icons';
3
+ import { ArrowLeft, ArrowRight } from '@tuturuuu/icons/lucide-static';
4
4
  import { cn } from '@tuturuuu/utils/format';
5
5
  import useEmblaCarousel, {
6
6
  type UseEmblaCarouselType,
@@ -18,7 +18,7 @@ vi.mock('next-intl', () => ({
18
18
  values?.count === undefined ? key : `${key}:${values.count}`,
19
19
  }));
20
20
 
21
- vi.mock('@tuturuuu/internal-api/infrastructure', () => ({
21
+ vi.mock('@tuturuuu/internal-api/infrastructure/ai', () => ({
22
22
  draftAiAgentExternalResponse: (...args: unknown[]) =>
23
23
  mocks.draftAiAgentExternalResponse(...args),
24
24
  listAiAgentExternalThreads: (...args: unknown[]) =>
@@ -13,7 +13,7 @@ import {
13
13
  listAiAgentExternalThreads,
14
14
  sendAiAgentExternalResponse,
15
15
  syncAiAgentExternalThread,
16
- } from '@tuturuuu/internal-api/infrastructure';
16
+ } from '@tuturuuu/internal-api/infrastructure/ai';
17
17
  import { useTranslations } from 'next-intl';
18
18
  import { useState } from 'react';
19
19
  import { Button } from '../button';
@@ -16,7 +16,7 @@ vi.mock('next-intl', () => ({
16
16
  useTranslations: () => (key: string) => key,
17
17
  }));
18
18
 
19
- vi.mock('@tuturuuu/internal-api/infrastructure', () => ({
19
+ vi.mock('@tuturuuu/internal-api/infrastructure/ai', () => ({
20
20
  abortAiAgentZaloPersonalQrLogin: (
21
21
  ...args: Parameters<typeof mocks.abortAiAgentZaloPersonalQrLogin>
22
22
  ) => mocks.abortAiAgentZaloPersonalQrLogin(...args),
@@ -14,7 +14,7 @@ import {
14
14
  import type {
15
15
  AiAgentChannelConfig,
16
16
  AiAgentTestResponse,
17
- } from '@tuturuuu/internal-api/infrastructure';
17
+ } from '@tuturuuu/internal-api/infrastructure/ai';
18
18
  import { useTranslations } from 'next-intl';
19
19
  import { useState } from 'react';
20
20
  import { Button } from '../button';
@@ -14,7 +14,7 @@ import type {
14
14
  AiAgentChannelConfig,
15
15
  AiAgentDefinition,
16
16
  SaveAiAgentPayload,
17
- } from '@tuturuuu/internal-api/infrastructure';
17
+ } from '@tuturuuu/internal-api/infrastructure/ai';
18
18
  import { useTranslations } from 'next-intl';
19
19
  import { useState } from 'react';
20
20
  import { Badge } from '../badge';
@@ -20,7 +20,7 @@ vi.mock('next-intl', () => ({
20
20
  useTranslations: () => (key: string) => key,
21
21
  }));
22
22
 
23
- vi.mock('@tuturuuu/internal-api/infrastructure', () => ({
23
+ vi.mock('@tuturuuu/internal-api/infrastructure/ai', () => ({
24
24
  abortAiAgentZaloPersonalQrLogin: vi.fn(),
25
25
  deployAiAgentChannel: vi.fn(),
26
26
  getAiAgentZaloPersonalQrLoginStatus: vi.fn(),
@@ -6,7 +6,7 @@ import type { ChatConversation } from '@tuturuuu/internal-api';
6
6
  import type {
7
7
  AiAgentTestResponse,
8
8
  SaveAiAgentPayload,
9
- } from '@tuturuuu/internal-api/infrastructure';
9
+ } from '@tuturuuu/internal-api/infrastructure/ai';
10
10
  import {
11
11
  deployAiAgentChannel,
12
12
  listAiAgents,
@@ -14,7 +14,7 @@ import {
14
14
  rotateAiAgentChannelSecret,
15
15
  saveAiAgent,
16
16
  testAiAgentChannel,
17
- } from '@tuturuuu/internal-api/infrastructure';
17
+ } from '@tuturuuu/internal-api/infrastructure/ai';
18
18
  import { useTranslations } from 'next-intl';
19
19
  import { useMemo, useState } from 'react';
20
20
  import { Badge } from '../badge';
@@ -1,5 +1,5 @@
1
1
  import type { ChatConversation } from '@tuturuuu/internal-api';
2
- import type { AiAgentDefinition } from '@tuturuuu/internal-api/infrastructure';
2
+ import type { AiAgentDefinition } from '@tuturuuu/internal-api/infrastructure/ai';
3
3
  import { ROOT_WORKSPACE_ID } from '@tuturuuu/utils/constants';
4
4
  import { describe, expect, it } from 'vitest';
5
5
  import {
@@ -6,7 +6,7 @@ import type {
6
6
  AiAgentChannelConfig,
7
7
  AiAgentDefinition,
8
8
  SaveAiAgentPayload,
9
- } from '@tuturuuu/internal-api/infrastructure';
9
+ } from '@tuturuuu/internal-api/infrastructure/ai';
10
10
  import { cn } from '@tuturuuu/utils/format';
11
11
  import { useTranslations } from 'next-intl';
12
12
  import type { ReactNode } from 'react';
@@ -19,14 +19,14 @@ import type {
19
19
  AiAgentZaloPersonalPhoneSyncResult,
20
20
  AiAgentZaloPersonalQrLoginSession,
21
21
  AiAgentZaloPersonalQrLoginStatus,
22
- } from '@tuturuuu/internal-api/infrastructure';
22
+ } from '@tuturuuu/internal-api/infrastructure/ai';
23
23
  import {
24
24
  abortAiAgentZaloPersonalQrLogin,
25
25
  getAiAgentZaloPersonalQrLoginStatus,
26
26
  getAiAgentZaloPersonalStatus,
27
27
  runAiAgentZaloPersonalAction,
28
28
  startAiAgentZaloPersonalQrLogin,
29
- } from '@tuturuuu/internal-api/infrastructure';
29
+ } from '@tuturuuu/internal-api/infrastructure/ai';
30
30
  import Image from 'next/image';
31
31
  import { useTranslations } from 'next-intl';
32
32
  import type { ReactNode } from 'react';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
- import { CheckIcon, MinusIcon } from '@tuturuuu/icons';
4
+ import { CheckIcon, MinusIcon } from '@tuturuuu/icons/lucide-static';
5
5
  import { cn } from '@tuturuuu/utils/format';
6
6
  import type * as React from 'react';
7
7
 
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { TextIcon } from '@tuturuuu/icons';
3
+ import { TextIcon } from '@tuturuuu/icons/lucide-static';
4
4
  import { forwardRef, useMemo, useState } from 'react';
5
5
  import { HexColorPicker } from 'react-colorful';
6
6
  import { useDomResolvedTheme } from '../../hooks/use-dom-resolved-theme';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { SearchIcon } from '@tuturuuu/icons';
3
+ import { SearchIcon } from '@tuturuuu/icons/lucide-static';
4
4
  import { cn } from '@tuturuuu/utils/format';
5
5
  import { Command as CommandPrimitive } from 'cmdk';
6
6
  import type * as React from 'react';
@@ -1,7 +1,11 @@
1
1
  'use client';
2
2
 
3
3
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
4
- import { CheckIcon, ChevronRightIcon, CircleIcon } from '@tuturuuu/icons';
4
+ import {
5
+ CheckIcon,
6
+ ChevronRightIcon,
7
+ CircleIcon,
8
+ } from '@tuturuuu/icons/lucide-static';
5
9
  import { cn } from '@tuturuuu/utils/format';
6
10
  import type * as React from 'react';
7
11
 
@@ -0,0 +1,78 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { createSettingsSearchEngine } from '../settings-dialog-search';
3
+ import type { SettingsNavGroup } from '../settings-dialog-shell';
4
+
5
+ function TestIcon() {
6
+ return null;
7
+ }
8
+
9
+ const navItems: SettingsNavGroup[] = [
10
+ {
11
+ label: 'Workspace',
12
+ items: [
13
+ {
14
+ aliases: ['organization'],
15
+ description: 'Manage workspace profile and branding',
16
+ icon: TestIcon,
17
+ keywords: ['general'],
18
+ label: 'General',
19
+ name: 'workspace_general',
20
+ },
21
+ {
22
+ description: 'Invite people and manage roles',
23
+ icon: TestIcon,
24
+ keywords: ['team'],
25
+ label: 'Members',
26
+ name: 'workspace_members',
27
+ },
28
+ ],
29
+ },
30
+ {
31
+ label: 'Developer',
32
+ items: [
33
+ {
34
+ description: 'Secret keys for external apps',
35
+ icon: TestIcon,
36
+ label: 'API Keys',
37
+ name: 'api_keys',
38
+ searchLabels: ['sdk tokens'],
39
+ },
40
+ {
41
+ disabled: true,
42
+ icon: TestIcon,
43
+ label: 'Secrets',
44
+ name: 'secrets',
45
+ },
46
+ ],
47
+ },
48
+ ];
49
+
50
+ describe('createSettingsSearchEngine', () => {
51
+ it('matches labels, group labels, descriptions, aliases, and keywords', () => {
52
+ const engine = createSettingsSearchEngine(navItems);
53
+
54
+ expect(engine.search('members')[0]?.items.map((item) => item.name)).toEqual(
55
+ ['workspace_members']
56
+ );
57
+ expect(
58
+ engine.search('organization')[0]?.items.map((item) => item.name)
59
+ ).toEqual(['workspace_general']);
60
+ expect(engine.search('sdk')[0]?.items.map((item) => item.name)).toEqual([
61
+ 'api_keys',
62
+ ]);
63
+ expect(
64
+ engine.search('developer')[0]?.items.map((item) => item.name)
65
+ ).toEqual(['api_keys', 'secrets']);
66
+ });
67
+
68
+ it('normalizes accents and excludes disabled items from enabled traversal', () => {
69
+ const engine = createSettingsSearchEngine(navItems);
70
+
71
+ expect(engine.search('generál')[0]?.items.map((item) => item.name)).toEqual(
72
+ ['workspace_general']
73
+ );
74
+ expect(
75
+ engine.getEnabledItems('developer').map((item) => item.name)
76
+ ).toEqual(['api_keys']);
77
+ });
78
+ });
@@ -0,0 +1,76 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ const settingsDialogShellPath = [
6
+ join(
7
+ process.cwd(),
8
+ 'packages/ui/src/components/ui/custom/settings-dialog-shell.tsx'
9
+ ),
10
+ join(process.cwd(), 'src/components/ui/custom/settings-dialog-shell.tsx'),
11
+ ].find((path) => existsSync(path));
12
+
13
+ if (!settingsDialogShellPath) {
14
+ throw new Error('Unable to locate settings-dialog-shell.tsx');
15
+ }
16
+
17
+ const settingsDialogShellSource = readFileSync(settingsDialogShellPath, {
18
+ encoding: 'utf8',
19
+ });
20
+ const settingsDialogSearchLoaderPath = [
21
+ join(
22
+ process.cwd(),
23
+ 'packages/ui/src/components/ui/custom/settings-dialog-search-loader.js'
24
+ ),
25
+ join(
26
+ process.cwd(),
27
+ 'src/components/ui/custom/settings-dialog-search-loader.js'
28
+ ),
29
+ ].find((path) => existsSync(path));
30
+
31
+ if (!settingsDialogSearchLoaderPath) {
32
+ throw new Error('Unable to locate settings-dialog-search-loader.js');
33
+ }
34
+
35
+ const settingsDialogSearchLoaderSource = readFileSync(
36
+ settingsDialogSearchLoaderPath,
37
+ {
38
+ encoding: 'utf8',
39
+ }
40
+ );
41
+ const runtimeSource = settingsDialogShellSource.replace(
42
+ /^\s*import\s+type\b[\s\S]*?\sfrom\s+['"][^'"]+['"];?/gmu,
43
+ ''
44
+ );
45
+
46
+ function staticImportPattern(modulePath: string) {
47
+ const escapedModulePath = modulePath.replace(
48
+ /[.*+?^${}()|[\]\\]/gu,
49
+ String.raw`\$&`
50
+ );
51
+
52
+ return new RegExp(
53
+ String.raw`^\s*import\s+(?!type\b)[\s\S]*?\sfrom\s+['"]${escapedModulePath}['"];`,
54
+ 'mu'
55
+ );
56
+ }
57
+
58
+ describe('settings dialog shell compile graph', () => {
59
+ it('keeps the settings search engine behind a dynamic import', () => {
60
+ expect(runtimeSource).not.toMatch(
61
+ staticImportPattern('./settings-dialog-search')
62
+ );
63
+ expect(runtimeSource).not.toMatch(
64
+ staticImportPattern('@tuturuuu/utils/text-helper')
65
+ );
66
+ expect(settingsDialogSearchLoaderSource).toMatch(
67
+ /import\(['"]\.\/settings-dialog-search['"]\)/u
68
+ );
69
+ expect(settingsDialogShellSource).not.toContain(
70
+ 'settings-dialog-search.js'
71
+ );
72
+ expect(settingsDialogSearchLoaderSource).not.toContain(
73
+ 'settings-dialog-search.js'
74
+ );
75
+ });
76
+ });
@@ -92,10 +92,13 @@ describe('SettingsDialogShell keyboard navigation', () => {
92
92
  renderShell();
93
93
 
94
94
  const dialog = screen.getByRole('dialog');
95
+ const className = dialog.getAttribute('class') ?? '';
95
96
 
96
97
  expect(dialog).toHaveClass('h-dvh');
97
98
  expect(dialog).toHaveClass('w-screen');
99
+ expect(dialog).toHaveClass('bg-background');
98
100
  expect(dialog).toHaveClass('rounded-none');
101
+ expect(className).not.toMatch(/animate-in|fade-in|zoom-in|slide-in/);
99
102
  expect(
100
103
  screen.getAllByRole('button', { name: 'settings.back_to_app' }).length
101
104
  ).toBeGreaterThan(0);
@@ -1,6 +1,11 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
1
3
  import type { InternalApiWorkspaceSummary } from '@tuturuuu/types';
2
4
  import { describe, expect, it } from 'vitest';
3
- import { mergeWorkspaceSelectWorkspaces } from '../workspace-select-helpers';
5
+ import {
6
+ mergeWorkspaceSelectWorkspaces,
7
+ normalizeWorkspaceSwitchPath,
8
+ } from '../workspace-select-helpers';
4
9
 
5
10
  describe('mergeWorkspaceSelectWorkspaces', () => {
6
11
  it('uses the current workspace fallback when the workspace list is unavailable', () => {
@@ -36,4 +41,44 @@ describe('mergeWorkspaceSelectWorkspaces', () => {
36
41
  workspace,
37
42
  ]);
38
43
  });
44
+
45
+ it('keeps workspace fallback images outside Radix AvatarImage context', () => {
46
+ const workspaceSelectSource = readFileSync(
47
+ join(process.cwd(), 'src/components/ui/custom/workspace-select.tsx'),
48
+ 'utf8'
49
+ );
50
+ const workspaceIconSource = workspaceSelectSource.slice(
51
+ workspaceSelectSource.indexOf('function WorkspaceIcon'),
52
+ workspaceSelectSource.indexOf('export function WorkspaceSelect')
53
+ );
54
+
55
+ expect(workspaceIconSource).toContain('<AvatarFallback');
56
+ expect(workspaceIconSource).toContain('<Image');
57
+ expect(workspaceIconSource).not.toMatch(
58
+ /<AvatarFallback[\s\S]*<AvatarImage/u
59
+ );
60
+ });
61
+ });
62
+
63
+ describe('normalizeWorkspaceSwitchPath', () => {
64
+ it('lands on tasks when switching workspace from a task board detail route', () => {
65
+ expect(
66
+ normalizeWorkspaceSwitchPath('/personal/tasks/boards/board-1', 'personal')
67
+ ).toBe('/personal/tasks');
68
+ });
69
+
70
+ it('lands on tasks when switching workspace from the task boards index', () => {
71
+ expect(
72
+ normalizeWorkspaceSwitchPath('/personal/tasks/boards', 'personal')
73
+ ).toBe('/personal/tasks');
74
+ });
75
+
76
+ it('preserves existing UUID detail-route stripping for non-task-board routes', () => {
77
+ expect(
78
+ normalizeWorkspaceSwitchPath(
79
+ '/workspace-1/users/11111111-1111-4111-8111-111111111111',
80
+ 'workspace-1'
81
+ )
82
+ ).toBe('/workspace-1/users');
83
+ });
39
84
  });