@tuturuuu/ui 0.12.0 → 0.14.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.
- package/CHANGELOG.md +28 -0
- package/package.json +4 -4
- package/src/components/ui/calendar-app/components/habits-panel.tsx +5 -2
- package/src/components/ui/calendar-app/components/priority-view.tsx +15 -7
- package/src/components/ui/calendar-app/components/scheduling-dialog.tsx +7 -3
- package/src/components/ui/calendar-app/components/task-scheduler-panel.tsx +7 -3
- package/src/components/ui/calendar-app/components/time-tracker/index.tsx +14 -9
- package/src/components/ui/custom/settings/task-settings.tsx +61 -2
- package/src/components/ui/custom/tables/data-table.tsx +58 -8
- package/src/components/ui/tu-do/boards/boardId/board-column.tsx +4 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/auto-scroll.test.ts +118 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/auto-scroll.ts +144 -70
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.test.ts +63 -1
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +21 -10
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +6 -0
- package/src/components/ui/tu-do/boards/boardId/kanban.tsx +4 -2
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.test.ts +11 -1
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-open-options.ts +7 -3
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-resource-context.test.ts +113 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-resource-context.ts +50 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +65 -18
- package/src/components/ui/tu-do/boards/boardId/timeline-board.tsx +1 -1
- package/src/components/ui/tu-do/cycles/task-cycles-client.tsx +23 -14
- package/src/components/ui/tu-do/estimates/use-task-estimates.ts +9 -4
- package/src/components/ui/tu-do/habits/client.tsx +4 -1
- package/src/components/ui/tu-do/my-tasks/__tests__/use-task-context-actions.test.ts +6 -3
- package/src/components/ui/tu-do/my-tasks/task-list-with-completion.tsx +19 -11
- package/src/components/ui/tu-do/my-tasks/use-my-tasks-query.ts +15 -6
- package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +18 -13
- package/src/components/ui/tu-do/my-tasks/use-task-context-actions.ts +17 -10
- package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +70 -0
- package/src/components/ui/tu-do/shared/board-views.tsx +33 -3
- package/src/components/ui/tu-do/shared/fade-setting-initializer.tsx +3 -1
- package/src/components/ui/tu-do/shared/list-view.tsx +1 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/quick-settings-popover.tsx +6 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/__tests__/use-update-shared-task.test.ts +9 -5
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/task-api.ts +13 -8
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-task-overrides.ts +21 -9
- package/src/components/ui/tu-do/shared/task-edit-dialog/hooks/use-update-shared-task.ts +10 -5
- package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +4 -2
- package/src/components/ui/tu-do/shared/task-estimation-picker.tsx +5 -2
- package/src/components/ui/tu-do/shared/task-quick-create-target-list.ts +20 -0
- package/src/components/ui/tu-do/shared/task-row-actions-menu.tsx +1 -1
- package/src/hooks/__tests__/use-task-actions.test.tsx +51 -0
- package/src/hooks/task-actions-personal-external.ts +2 -3
- package/src/hooks/use-board-actions.ts +27 -17
- package/src/hooks/use-calendar.tsx +7 -3
- package/src/hooks/use-settings-dialog-shortcut.ts +51 -0
- package/src/hooks/use-user-config.ts +10 -2
- package/src/lib/task-personal-external.ts +49 -0
- package/src/lib/tasks-app-url.ts +85 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.0](https://github.com/tutur3u/platform/compare/ui-v0.13.0...ui-v0.14.0) (2026-07-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **tasks:** add quick-create targeting and edge autoscroll ([f03e932](https://github.com/tutur3u/platform/commit/f03e9324b0cce18e9f9974cc8fe251bb58b686bd))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **tasks:** scroll kanban board at drag edges ([1053f6c](https://github.com/tutur3u/platform/commit/1053f6cc6db9788b7e184ed8bc7febdb2adacf97))
|
|
14
|
+
|
|
15
|
+
## [0.13.0](https://github.com/tutur3u/platform/compare/ui-v0.12.0...ui-v0.13.0) (2026-07-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **satellite:** open settings on Cmd/Ctrl+, in satellite apps ([841f425](https://github.com/tutur3u/platform/commit/841f42557dd49eb31fd797900b1ec6ade6642dba))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **tasks:** harden satellite task route hydration ([9d51a38](https://github.com/tutur3u/platform/commit/9d51a38ad948ebb398bec794f082f2bbf8d466cc))
|
|
26
|
+
* **tasks:** keep personal board moves on workspace route ([60e29b0](https://github.com/tutur3u/platform/commit/60e29b093314b3b185f3f63a69042a665644ed3d))
|
|
27
|
+
* **tasks:** keep personal moves off placement API ([d8c41d7](https://github.com/tutur3u/platform/commit/d8c41d790f5edbe637b9ce71bbd5040b7fddbfa5))
|
|
28
|
+
* **tasks:** restore satellite resource access ([ec5e0a8](https://github.com/tutur3u/platform/commit/ec5e0a8d75398047e0151ae2ac3cd9a25a4fd675))
|
|
29
|
+
* **tasks:** route native personal task moves normally ([5bbba3c](https://github.com/tutur3u/platform/commit/5bbba3c3f193e722cc87cdfe2eb2734f61442cd0))
|
|
30
|
+
|
|
3
31
|
## [0.12.0](https://github.com/tutur3u/platform/compare/ui-v0.11.1...ui-v0.12.0) (2026-07-03)
|
|
4
32
|
|
|
5
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuturuuu/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"@tiptap/react": "3.27.1",
|
|
86
86
|
"@tiptap/starter-kit": "3.27.1",
|
|
87
87
|
"@tuturuuu/ai": "0.2.2",
|
|
88
|
-
"@tuturuuu/apis": "0.7.
|
|
88
|
+
"@tuturuuu/apis": "0.7.2",
|
|
89
89
|
"@tuturuuu/hooks": "0.0.2",
|
|
90
90
|
"@tuturuuu/icons": "0.0.6",
|
|
91
|
-
"@tuturuuu/internal-api": "0.
|
|
91
|
+
"@tuturuuu/internal-api": "0.15.0",
|
|
92
92
|
"@tuturuuu/supabase": "0.4.0",
|
|
93
|
-
"@tuturuuu/utils": "0.
|
|
93
|
+
"@tuturuuu/utils": "0.13.0",
|
|
94
94
|
"@types/debug": "^4.1.13",
|
|
95
95
|
"browser-image-compression": "^2.0.2",
|
|
96
96
|
"class-variance-authority": "^0.7.1",
|
|
@@ -15,6 +15,7 @@ import { getRecurrenceDescription } from '@tuturuuu/types/primitives/Habit';
|
|
|
15
15
|
import { cn } from '@tuturuuu/utils/format';
|
|
16
16
|
import Link from 'next/link';
|
|
17
17
|
import { useState } from 'react';
|
|
18
|
+
import { getTaskApiUrl, getTasksAppUrl } from '../../../../lib/tasks-app-url';
|
|
18
19
|
import { Badge } from '../../badge';
|
|
19
20
|
import { Button } from '../../button';
|
|
20
21
|
import { Card, CardContent } from '../../card';
|
|
@@ -65,7 +66,9 @@ export function HabitsPanel({ wsId }: HabitsPanelProps) {
|
|
|
65
66
|
} = useQuery({
|
|
66
67
|
queryKey: ['habits', wsId],
|
|
67
68
|
queryFn: async () => {
|
|
68
|
-
const response = await fetch(
|
|
69
|
+
const response = await fetch(
|
|
70
|
+
getTaskApiUrl(`/api/v1/workspaces/${wsId}/habits`)
|
|
71
|
+
);
|
|
69
72
|
if (!response.ok) {
|
|
70
73
|
throw new Error('Failed to fetch habits');
|
|
71
74
|
}
|
|
@@ -308,7 +311,7 @@ export function HabitsPanel({ wsId }: HabitsPanelProps) {
|
|
|
308
311
|
|
|
309
312
|
{/* Footer */}
|
|
310
313
|
<div className="border-t p-3">
|
|
311
|
-
<Link href={`/${wsId}/
|
|
314
|
+
<Link href={getTasksAppUrl(`/${wsId}/habits`)}>
|
|
312
315
|
<Button variant="outline" size="sm" className="w-full">
|
|
313
316
|
Manage Habits
|
|
314
317
|
</Button>
|
|
@@ -32,6 +32,7 @@ import { useRouter } from 'next/navigation';
|
|
|
32
32
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
33
33
|
import { useDebouncedCallback } from 'use-debounce';
|
|
34
34
|
import { useCalendar } from '../../../../hooks/use-calendar';
|
|
35
|
+
import { getTaskApiUrl } from '../../../../lib/tasks-app-url';
|
|
35
36
|
import { Progress } from '../../progress';
|
|
36
37
|
import { toast } from '../../sonner';
|
|
37
38
|
import type { ExtendedWorkspaceTask } from '../../time-tracker/types';
|
|
@@ -263,9 +264,11 @@ export default function PriorityView({
|
|
|
263
264
|
const results = await Promise.allSettled(
|
|
264
265
|
tasksToFetchSchedule.map(async (task) => {
|
|
265
266
|
const response = await fetch(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
getTaskApiUrl(
|
|
268
|
+
isPersonalWorkspace
|
|
269
|
+
? `/api/v1/users/me/tasks/${task.id}/schedule`
|
|
270
|
+
: `/api/v1/workspaces/${task.ws_id ?? wsId}/tasks/${task.id}/schedule`
|
|
271
|
+
),
|
|
269
272
|
{ cache: 'no-store' }
|
|
270
273
|
);
|
|
271
274
|
if (!response.ok) {
|
|
@@ -378,10 +381,15 @@ export default function PriorityView({
|
|
|
378
381
|
const task = combinedTasks.find((t) => t.id === taskId);
|
|
379
382
|
const taskWsId = task?.ws_id ?? wsId;
|
|
380
383
|
|
|
381
|
-
const response = await fetch(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
384
|
+
const response = await fetch(
|
|
385
|
+
getTaskApiUrl(`/api/${taskWsId}/task/${taskId}/edit`),
|
|
386
|
+
{
|
|
387
|
+
method: 'PATCH',
|
|
388
|
+
credentials: 'include',
|
|
389
|
+
headers: { 'Content-Type': 'application/json' },
|
|
390
|
+
body: JSON.stringify({ priority: newPriority }),
|
|
391
|
+
}
|
|
392
|
+
);
|
|
385
393
|
|
|
386
394
|
if (!response.ok) {
|
|
387
395
|
throw new Error('Failed to update task priority');
|
|
@@ -17,6 +17,7 @@ import { createClient } from '@tuturuuu/supabase/next/client';
|
|
|
17
17
|
import { cn } from '@tuturuuu/utils/format';
|
|
18
18
|
import { useRouter } from 'next/navigation';
|
|
19
19
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
20
|
+
import { getTaskApiUrl } from '../../../../lib/tasks-app-url';
|
|
20
21
|
import { Button } from '../../button';
|
|
21
22
|
import {
|
|
22
23
|
Dialog,
|
|
@@ -226,9 +227,12 @@ export function SchedulingDialog({
|
|
|
226
227
|
queryKey: ['task-personal-schedule', task?.id, open],
|
|
227
228
|
enabled: open && !!task?.id,
|
|
228
229
|
queryFn: async () => {
|
|
229
|
-
const res = await fetch(
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
const res = await fetch(
|
|
231
|
+
getTaskApiUrl(`/api/v1/users/me/tasks/${task!.id}/schedule`),
|
|
232
|
+
{
|
|
233
|
+
cache: 'no-store',
|
|
234
|
+
}
|
|
235
|
+
);
|
|
232
236
|
if (!res.ok) return null;
|
|
233
237
|
return (await res.json()) as null | {
|
|
234
238
|
task: {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import type { TaskWithScheduling } from '@tuturuuu/types';
|
|
16
16
|
import { cn } from '@tuturuuu/utils/format';
|
|
17
17
|
import { useState } from 'react';
|
|
18
|
+
import { getTaskApiUrl } from '../../../../lib/tasks-app-url';
|
|
18
19
|
import { Badge } from '../../badge';
|
|
19
20
|
import { Button } from '../../button';
|
|
20
21
|
import { Input } from '../../input';
|
|
@@ -147,11 +148,14 @@ export function TaskSchedulerPanel({
|
|
|
147
148
|
|
|
148
149
|
try {
|
|
149
150
|
const response = await fetch(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
getTaskApiUrl(
|
|
152
|
+
isPersonalWorkspace
|
|
153
|
+
? `/api/v1/users/me/tasks/${task.id}/schedule`
|
|
154
|
+
: `/api/v1/workspaces/${wsId}/tasks/${task.id}/schedule`
|
|
155
|
+
),
|
|
153
156
|
{
|
|
154
157
|
method: 'POST',
|
|
158
|
+
credentials: 'include',
|
|
155
159
|
headers: { 'Content-Type': 'application/json' },
|
|
156
160
|
}
|
|
157
161
|
);
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import type { TimeTrackingCategory } from '@tuturuuu/types';
|
|
18
18
|
import { cn } from '@tuturuuu/utils/format';
|
|
19
19
|
import { useCallback, useEffect, useState } from 'react';
|
|
20
|
+
import { getTaskApiUrl } from '../../../../../lib/tasks-app-url';
|
|
20
21
|
import { Badge } from '../../../badge';
|
|
21
22
|
import { Button } from '../../../button';
|
|
22
23
|
import { Card, CardContent, CardHeader, CardTitle } from '../../../card';
|
|
@@ -201,15 +202,19 @@ export default function TimeTracker({ wsId, tasks = [] }: TimeTrackerProps) {
|
|
|
201
202
|
setIsCreatingTask(true);
|
|
202
203
|
|
|
203
204
|
try {
|
|
204
|
-
const response = await fetch(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
const response = await fetch(
|
|
206
|
+
getTaskApiUrl(`/api/v1/workspaces/${wsId}/tasks`),
|
|
207
|
+
{
|
|
208
|
+
method: 'POST',
|
|
209
|
+
credentials: 'include',
|
|
210
|
+
headers: { 'Content-Type': 'application/json' },
|
|
211
|
+
body: JSON.stringify({
|
|
212
|
+
name: newTaskName,
|
|
213
|
+
description: newTaskDescription || null,
|
|
214
|
+
listId: selectedListId,
|
|
215
|
+
}),
|
|
216
|
+
}
|
|
217
|
+
);
|
|
213
218
|
|
|
214
219
|
if (!response.ok) throw new Error('Failed to create task');
|
|
215
220
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
TASK_NAVIGATION_LEADERBOARDS_CONFIG_ID,
|
|
8
8
|
TASK_NAVIGATION_PROGRESS_CONFIG_ID,
|
|
9
9
|
TASK_NAVIGATION_STATS_CONFIG_ID,
|
|
10
|
+
TASK_QUICK_CREATE_TARGET_LIST_CONFIG_ID,
|
|
10
11
|
} from '@tuturuuu/internal-api/users';
|
|
11
12
|
import type { Workspace } from '@tuturuuu/types';
|
|
12
13
|
import { SettingItemTab } from '@tuturuuu/ui/custom/settings-item-tab';
|
|
@@ -27,12 +28,18 @@ import { toast } from '@tuturuuu/ui/sonner';
|
|
|
27
28
|
import { Switch } from '@tuturuuu/ui/switch';
|
|
28
29
|
import { useTranslations } from 'next-intl';
|
|
29
30
|
import { useEffect } from 'react';
|
|
31
|
+
import { getTaskApiUrl } from '../../../../lib/tasks-app-url';
|
|
30
32
|
import {
|
|
31
33
|
normalizeTaskDialogPresentation,
|
|
32
34
|
TASK_DIALOG_DEFAULT_PRESENTATION_CONFIG_ID,
|
|
33
35
|
type TaskDialogPresentation,
|
|
34
36
|
} from '../../tu-do/shared/task-dialog-presentation';
|
|
35
37
|
import { TASKS_SHOW_REVIEW_DUE_DATES_CONFIG_ID } from '../../tu-do/shared/task-due-date-visibility';
|
|
38
|
+
import {
|
|
39
|
+
DEFAULT_TASK_QUICK_CREATE_TARGET_LIST,
|
|
40
|
+
normalizeTaskQuickCreateTargetList,
|
|
41
|
+
type TaskQuickCreateTargetList,
|
|
42
|
+
} from '../../tu-do/shared/task-quick-create-target-list';
|
|
36
43
|
import {
|
|
37
44
|
clampTaskSoundEffectsVolume,
|
|
38
45
|
DEFAULT_TASK_SOUND_EFFECTS_VOLUME,
|
|
@@ -141,11 +148,21 @@ export function TaskSettings({ workspace }: TaskSettingsProps) {
|
|
|
141
148
|
const { data: dialogPresentationRaw, isLoading: dialogPresentationLoading } =
|
|
142
149
|
useUserConfig(TASK_DIALOG_DEFAULT_PRESENTATION_CONFIG_ID, 'compact');
|
|
143
150
|
const updateDialogPresentation = useUpdateUserConfig();
|
|
151
|
+
const {
|
|
152
|
+
data: quickCreateTargetListRaw,
|
|
153
|
+
isLoading: quickCreateTargetListLoading,
|
|
154
|
+
} = useUserConfig(
|
|
155
|
+
TASK_QUICK_CREATE_TARGET_LIST_CONFIG_ID,
|
|
156
|
+
DEFAULT_TASK_QUICK_CREATE_TARGET_LIST
|
|
157
|
+
);
|
|
158
|
+
const updateQuickCreateTargetList = useUpdateUserConfig();
|
|
144
159
|
|
|
145
160
|
const { data: settings, isLoading } = useQuery({
|
|
146
161
|
queryKey: ['user-task-settings'],
|
|
147
162
|
queryFn: async (): Promise<TaskSettingsData> => {
|
|
148
|
-
const res = await fetch('/api/v1/users/task-settings')
|
|
163
|
+
const res = await fetch(getTaskApiUrl('/api/v1/users/task-settings'), {
|
|
164
|
+
credentials: 'include',
|
|
165
|
+
});
|
|
149
166
|
if (!res.ok) throw new Error('Failed to fetch task settings');
|
|
150
167
|
return res.json();
|
|
151
168
|
},
|
|
@@ -162,8 +179,9 @@ export function TaskSettings({ workspace }: TaskSettingsProps) {
|
|
|
162
179
|
|
|
163
180
|
const updateSettings = useMutation({
|
|
164
181
|
mutationFn: async (data: Partial<TaskSettingsData>) => {
|
|
165
|
-
const res = await fetch('/api/v1/users/task-settings', {
|
|
182
|
+
const res = await fetch(getTaskApiUrl('/api/v1/users/task-settings'), {
|
|
166
183
|
method: 'PATCH',
|
|
184
|
+
credentials: 'include',
|
|
167
185
|
headers: { 'Content-Type': 'application/json' },
|
|
168
186
|
body: JSON.stringify(data),
|
|
169
187
|
});
|
|
@@ -207,6 +225,9 @@ export function TaskSettings({ workspace }: TaskSettingsProps) {
|
|
|
207
225
|
const dialogPresentation = normalizeTaskDialogPresentation(
|
|
208
226
|
dialogPresentationRaw
|
|
209
227
|
);
|
|
228
|
+
const quickCreateTargetList = normalizeTaskQuickCreateTargetList(
|
|
229
|
+
quickCreateTargetListRaw
|
|
230
|
+
);
|
|
210
231
|
|
|
211
232
|
const handleDialogPresentationChange = (value: string) => {
|
|
212
233
|
const nextValue: TaskDialogPresentation = normalizeTaskDialogPresentation(
|
|
@@ -219,6 +240,15 @@ export function TaskSettings({ workspace }: TaskSettingsProps) {
|
|
|
219
240
|
});
|
|
220
241
|
};
|
|
221
242
|
|
|
243
|
+
const handleQuickCreateTargetListChange = (value: string) => {
|
|
244
|
+
const nextValue: TaskQuickCreateTargetList =
|
|
245
|
+
normalizeTaskQuickCreateTargetList(value);
|
|
246
|
+
updateQuickCreateTargetList.mutate({
|
|
247
|
+
configId: TASK_QUICK_CREATE_TARGET_LIST_CONFIG_ID,
|
|
248
|
+
value: nextValue,
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
222
252
|
return (
|
|
223
253
|
<div className="space-y-8">
|
|
224
254
|
<div className="grid gap-6">
|
|
@@ -326,6 +356,35 @@ export function TaskSettings({ workspace }: TaskSettingsProps) {
|
|
|
326
356
|
</Select>
|
|
327
357
|
</SettingItemTab>
|
|
328
358
|
<Separator />
|
|
359
|
+
<SettingItemTab
|
|
360
|
+
title={t('quick_create_target_list')}
|
|
361
|
+
description={t('quick_create_target_list_description')}
|
|
362
|
+
>
|
|
363
|
+
<Select
|
|
364
|
+
value={quickCreateTargetList}
|
|
365
|
+
onValueChange={handleQuickCreateTargetListChange}
|
|
366
|
+
disabled={
|
|
367
|
+
quickCreateTargetListLoading ||
|
|
368
|
+
updateQuickCreateTargetList.isPending
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
<SelectTrigger
|
|
372
|
+
aria-label={t('quick_create_target_list')}
|
|
373
|
+
className="w-44"
|
|
374
|
+
>
|
|
375
|
+
<SelectValue />
|
|
376
|
+
</SelectTrigger>
|
|
377
|
+
<SelectContent>
|
|
378
|
+
<SelectItem value="default_list">
|
|
379
|
+
{t('quick_create_target_list_default')}
|
|
380
|
+
</SelectItem>
|
|
381
|
+
<SelectItem value="hovered_list">
|
|
382
|
+
{t('quick_create_target_list_hovered')}
|
|
383
|
+
</SelectItem>
|
|
384
|
+
</SelectContent>
|
|
385
|
+
</Select>
|
|
386
|
+
</SettingItemTab>
|
|
387
|
+
<Separator />
|
|
329
388
|
<SettingItemTab
|
|
330
389
|
title={t('draft_mode')}
|
|
331
390
|
description={t('draft_mode_description')}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getFacetedUniqueValues,
|
|
10
10
|
getFilteredRowModel,
|
|
11
11
|
getSortedRowModel,
|
|
12
|
+
type Row,
|
|
12
13
|
type SortingState,
|
|
13
14
|
useReactTable,
|
|
14
15
|
type VisibilityState,
|
|
@@ -27,6 +28,15 @@ import {
|
|
|
27
28
|
import { DataTablePagination } from './data-table-pagination';
|
|
28
29
|
import { DataTableToolbar } from './data-table-toolbar';
|
|
29
30
|
|
|
31
|
+
function isInteractiveTarget(target: EventTarget | null) {
|
|
32
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
33
|
+
return Boolean(
|
|
34
|
+
target.closest(
|
|
35
|
+
'a, button, input, select, textarea, label, [role="menuitem"], [data-no-row-activate]'
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
/**
|
|
31
41
|
* Options for column generator functions.
|
|
32
42
|
* Using named parameters improves readability and maintainability.
|
|
@@ -79,6 +89,8 @@ export interface DataTableProps<TData, TValue> {
|
|
|
79
89
|
/** Custom toolbar actions rendered directly (not wrapped in dialogs) */
|
|
80
90
|
toolbarActions?: ReactNode;
|
|
81
91
|
className?: string;
|
|
92
|
+
tableCardClassName?: string;
|
|
93
|
+
tableClassName?: string;
|
|
82
94
|
preserveParams?: string[];
|
|
83
95
|
onRefresh?: () => void;
|
|
84
96
|
selectedRowsActions?: (selectedRows: TData[]) => ReactNode;
|
|
@@ -87,6 +99,7 @@ export interface DataTableProps<TData, TValue> {
|
|
|
87
99
|
|
|
88
100
|
onRowClick?: (row: TData) => void;
|
|
89
101
|
onRowDoubleClick?: (row: TData) => void;
|
|
102
|
+
getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;
|
|
90
103
|
|
|
91
104
|
setParams?: (params: {
|
|
92
105
|
page?: number;
|
|
@@ -127,11 +140,14 @@ export function DataTable<TData, TValue>({
|
|
|
127
140
|
toolbarExportContent,
|
|
128
141
|
toolbarActions,
|
|
129
142
|
className,
|
|
143
|
+
tableCardClassName,
|
|
144
|
+
tableClassName,
|
|
130
145
|
onRefresh,
|
|
131
146
|
selectedRowsActions,
|
|
132
147
|
onSearch,
|
|
133
148
|
onRowClick,
|
|
134
149
|
onRowDoubleClick,
|
|
150
|
+
getRowId,
|
|
135
151
|
setParams,
|
|
136
152
|
resetParams,
|
|
137
153
|
columnGenerator,
|
|
@@ -169,6 +185,7 @@ export function DataTable<TData, TValue>({
|
|
|
169
185
|
: undefined,
|
|
170
186
|
enableRowSelection: true,
|
|
171
187
|
autoResetPageIndex: true,
|
|
188
|
+
getRowId,
|
|
172
189
|
onRowSelectionChange: setRowSelection,
|
|
173
190
|
onSortingChange: enableServerSideSorting
|
|
174
191
|
? (updaterOrValue) => {
|
|
@@ -232,16 +249,23 @@ export function DataTable<TData, TValue>({
|
|
|
232
249
|
toolbarActions={toolbarActions}
|
|
233
250
|
/>
|
|
234
251
|
)}
|
|
235
|
-
<Card>
|
|
236
|
-
<Table>
|
|
252
|
+
<Card className={tableCardClassName}>
|
|
253
|
+
<Table className={tableClassName}>
|
|
237
254
|
<TableHeader>
|
|
238
255
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
239
256
|
<TableRow key={headerGroup.id}>
|
|
240
257
|
{headerGroup.headers.map((header) => {
|
|
258
|
+
const meta = header.column.columnDef.meta as
|
|
259
|
+
| { className?: string }
|
|
260
|
+
| undefined;
|
|
261
|
+
|
|
241
262
|
return (
|
|
242
263
|
<TableHead
|
|
243
264
|
key={header.id}
|
|
244
|
-
className=
|
|
265
|
+
className={cn(
|
|
266
|
+
'bg-foreground/5 font-semibold text-foreground/70 first:rounded-tl-xl last:rounded-tr-xl',
|
|
267
|
+
meta?.className
|
|
268
|
+
)}
|
|
245
269
|
>
|
|
246
270
|
{header.isPlaceholder
|
|
247
271
|
? null
|
|
@@ -258,16 +282,42 @@ export function DataTable<TData, TValue>({
|
|
|
258
282
|
<TableBody>
|
|
259
283
|
{table.getRowModel().rows?.length ? (
|
|
260
284
|
table.getRowModel().rows.map((row) => {
|
|
285
|
+
const isInteractiveRow = Boolean(
|
|
286
|
+
onRowClick || onRowDoubleClick
|
|
287
|
+
);
|
|
261
288
|
const tableRow = (
|
|
262
289
|
<TableRow
|
|
263
290
|
key={`${namespace}-${row.id}`}
|
|
264
291
|
data-state={row.getIsSelected() && 'selected'}
|
|
265
|
-
className=
|
|
266
|
-
onClick={() =>
|
|
267
|
-
|
|
292
|
+
className={cn(isInteractiveRow && 'cursor-pointer')}
|
|
293
|
+
onClick={(event) => {
|
|
294
|
+
if (isInteractiveTarget(event.target)) return;
|
|
295
|
+
onRowClick?.(row.original);
|
|
296
|
+
}}
|
|
297
|
+
onDoubleClick={(event) => {
|
|
298
|
+
if (isInteractiveTarget(event.target)) return;
|
|
299
|
+
onRowDoubleClick?.(row.original);
|
|
300
|
+
}}
|
|
301
|
+
onKeyDown={(event) => {
|
|
302
|
+
if (!onRowClick) return;
|
|
303
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
304
|
+
if (isInteractiveTarget(event.target)) return;
|
|
305
|
+
event.preventDefault();
|
|
306
|
+
onRowClick(row.original);
|
|
307
|
+
}}
|
|
308
|
+
tabIndex={onRowClick ? 0 : undefined}
|
|
268
309
|
>
|
|
269
310
|
{row.getVisibleCells().map((cell) => (
|
|
270
|
-
<TableCell
|
|
311
|
+
<TableCell
|
|
312
|
+
key={`${namespace}-${cell.id}`}
|
|
313
|
+
className={
|
|
314
|
+
(
|
|
315
|
+
cell.column.columnDef.meta as
|
|
316
|
+
| { cellClassName?: string }
|
|
317
|
+
| undefined
|
|
318
|
+
)?.cellClassName
|
|
319
|
+
}
|
|
320
|
+
>
|
|
271
321
|
{flexRender(
|
|
272
322
|
cell.column.columnDef.cell,
|
|
273
323
|
cell.getContext()
|
|
@@ -293,7 +343,7 @@ export function DataTable<TData, TValue>({
|
|
|
293
343
|
>
|
|
294
344
|
{data
|
|
295
345
|
? `${t?.('common.no-results')}.`
|
|
296
|
-
: `${t?.('common.loading')}
|
|
346
|
+
: `${t?.('common.loading')}…`}
|
|
297
347
|
</TableCell>
|
|
298
348
|
</TableRow>
|
|
299
349
|
)}
|
|
@@ -182,6 +182,7 @@ interface BoardColumnProps {
|
|
|
182
182
|
specialPinned?: boolean;
|
|
183
183
|
specialStickyOffset?: string;
|
|
184
184
|
onSpecialPinnedChange?: (pinned: boolean) => void;
|
|
185
|
+
onHoverTaskList?: (listId: string) => void;
|
|
185
186
|
readOnly?: boolean;
|
|
186
187
|
}
|
|
187
188
|
|
|
@@ -214,6 +215,7 @@ export function BoardColumn({
|
|
|
214
215
|
specialPinned = false,
|
|
215
216
|
specialStickyOffset,
|
|
216
217
|
onSpecialPinnedChange,
|
|
218
|
+
onHoverTaskList,
|
|
217
219
|
readOnly = false,
|
|
218
220
|
}: BoardColumnProps) {
|
|
219
221
|
const t = useTranslations('common');
|
|
@@ -530,6 +532,7 @@ export function BoardColumn({
|
|
|
530
532
|
data-kanban-pinned-special={specialStickyOffset ? 'true' : undefined}
|
|
531
533
|
data-kanban-column-id={column.id}
|
|
532
534
|
data-kanban-real-column={isExternalStaging ? undefined : 'true'}
|
|
535
|
+
onPointerEnter={() => onHoverTaskList?.(column.id)}
|
|
533
536
|
className={cn(
|
|
534
537
|
'group flex h-full w-14 shrink-0 snap-start flex-col items-center rounded-xl border border-dashed transition-all duration-200',
|
|
535
538
|
'touch-none select-none overflow-hidden hover:shadow-md',
|
|
@@ -583,6 +586,7 @@ export function BoardColumn({
|
|
|
583
586
|
data-kanban-pinned-special={specialStickyOffset ? 'true' : undefined}
|
|
584
587
|
data-kanban-column-id={column.id}
|
|
585
588
|
data-kanban-real-column={isExternalStaging ? undefined : 'true'}
|
|
589
|
+
onPointerEnter={() => onHoverTaskList?.(column.id)}
|
|
586
590
|
className={cn(
|
|
587
591
|
'group flex h-full w-[var(--kanban-column-width)] shrink-0 snap-start flex-col rounded-xl transition-all duration-200 last:snap-end',
|
|
588
592
|
'touch-none select-none',
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { DragMoveEvent } from '@dnd-kit/core';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import {
|
|
4
|
+
getKanbanDragAutoScrollPointerX,
|
|
5
|
+
getKanbanEdgeAutoScrollAmount,
|
|
6
|
+
} from './auto-scroll';
|
|
7
|
+
|
|
8
|
+
const rect = {
|
|
9
|
+
left: 100,
|
|
10
|
+
right: 500,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function createDragMoveEvent({
|
|
14
|
+
deltaX = 0,
|
|
15
|
+
initialLeft = 200,
|
|
16
|
+
pointerStartX,
|
|
17
|
+
translatedLeft = initialLeft,
|
|
18
|
+
width = 80,
|
|
19
|
+
}: {
|
|
20
|
+
deltaX?: number;
|
|
21
|
+
initialLeft?: number;
|
|
22
|
+
pointerStartX?: number;
|
|
23
|
+
translatedLeft?: number | null;
|
|
24
|
+
width?: number;
|
|
25
|
+
}) {
|
|
26
|
+
return {
|
|
27
|
+
active: {
|
|
28
|
+
rect: {
|
|
29
|
+
current: {
|
|
30
|
+
initial: {
|
|
31
|
+
left: initialLeft,
|
|
32
|
+
width,
|
|
33
|
+
},
|
|
34
|
+
translated:
|
|
35
|
+
translatedLeft === null
|
|
36
|
+
? null
|
|
37
|
+
: {
|
|
38
|
+
left: translatedLeft,
|
|
39
|
+
width,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
activatorEvent:
|
|
45
|
+
pointerStartX === undefined
|
|
46
|
+
? ({ type: 'keydown' } as Event)
|
|
47
|
+
: ({ clientX: pointerStartX } as unknown as Event),
|
|
48
|
+
delta: {
|
|
49
|
+
x: deltaX,
|
|
50
|
+
y: 0,
|
|
51
|
+
},
|
|
52
|
+
} as unknown as DragMoveEvent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('getKanbanEdgeAutoScrollAmount', () => {
|
|
56
|
+
it('scrolls left when the drag center is near the left edge', () => {
|
|
57
|
+
expect(
|
|
58
|
+
getKanbanEdgeAutoScrollAmount(125, rect, {
|
|
59
|
+
threshold: 100,
|
|
60
|
+
speed: 10,
|
|
61
|
+
maxSpeed: 30,
|
|
62
|
+
})
|
|
63
|
+
).toBeLessThan(0);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('scrolls right when the drag center is near the right edge', () => {
|
|
67
|
+
expect(
|
|
68
|
+
getKanbanEdgeAutoScrollAmount(475, rect, {
|
|
69
|
+
threshold: 100,
|
|
70
|
+
speed: 10,
|
|
71
|
+
maxSpeed: 30,
|
|
72
|
+
})
|
|
73
|
+
).toBeGreaterThan(0);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('does nothing away from horizontal edges or without a drag center', () => {
|
|
77
|
+
expect(getKanbanEdgeAutoScrollAmount(300, rect)).toBe(0);
|
|
78
|
+
expect(getKanbanEdgeAutoScrollAmount(null, rect)).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('uses pointer position for edge auto-scroll instead of card center', () => {
|
|
82
|
+
const pointerX = getKanbanDragAutoScrollPointerX(
|
|
83
|
+
createDragMoveEvent({
|
|
84
|
+
deltaX: 215,
|
|
85
|
+
pointerStartX: 260,
|
|
86
|
+
translatedLeft: 190,
|
|
87
|
+
width: 80,
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
expect(pointerX).toBe(475);
|
|
92
|
+
expect(
|
|
93
|
+
getKanbanEdgeAutoScrollAmount(pointerX, rect, {
|
|
94
|
+
threshold: 100,
|
|
95
|
+
speed: 10,
|
|
96
|
+
maxSpeed: 30,
|
|
97
|
+
})
|
|
98
|
+
).toBeGreaterThan(0);
|
|
99
|
+
expect(
|
|
100
|
+
getKanbanEdgeAutoScrollAmount(230, rect, {
|
|
101
|
+
threshold: 100,
|
|
102
|
+
speed: 10,
|
|
103
|
+
maxSpeed: 30,
|
|
104
|
+
})
|
|
105
|
+
).toBe(0);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('falls back to the active card center without pointer coordinates', () => {
|
|
109
|
+
expect(
|
|
110
|
+
getKanbanDragAutoScrollPointerX(
|
|
111
|
+
createDragMoveEvent({
|
|
112
|
+
translatedLeft: 370,
|
|
113
|
+
width: 100,
|
|
114
|
+
})
|
|
115
|
+
)
|
|
116
|
+
).toBe(420);
|
|
117
|
+
});
|
|
118
|
+
});
|