@tuturuuu/ui 0.8.0 → 0.9.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 +40 -0
- package/biome.json +1 -1
- package/package.json +73 -71
- package/src/components/ui/accordion.tsx +1 -1
- package/src/components/ui/breadcrumb.tsx +1 -1
- package/src/components/ui/calendar-app/calendar-page-shell.tsx +4 -0
- package/src/components/ui/calendar-app/components/calendar-connections-settings-content.tsx +239 -33
- package/src/components/ui/calendar-app/components/load-smart-scheduling-tasks.tsx +143 -0
- package/src/components/ui/calendar-app/components/priority-view.tsx +10 -3
- package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +4 -116
- package/src/components/ui/calendar-app/components/use-calendar-connections-manager.ts +67 -2
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/carousel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-setup-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.tsx +2 -2
- package/src/components/ui/chat/chat-agent-details-utils.test.ts +1 -1
- package/src/components/ui/chat/chat-agent-details-utils.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-zalo-personal-panel.tsx +2 -2
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/context-menu.tsx +5 -1
- package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +3 -0
- package/src/components/ui/custom/__tests__/workspace-select-helpers.test.ts +19 -0
- package/src/components/ui/custom/combobox.test.tsx +195 -0
- package/src/components/ui/custom/combobox.tsx +273 -156
- package/src/components/ui/custom/education/modules/youtube/delete-link-button.tsx +5 -13
- package/src/components/ui/custom/facebook-mockup/facebook-mockup.tsx +7 -1
- package/src/components/ui/custom/facebook-mockup/form.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/image-upload-field.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/preview.tsx +1 -1
- package/src/components/ui/custom/settings-dialog-shell.tsx +2 -1
- package/src/components/ui/custom/theme-toggle.tsx +1 -1
- package/src/components/ui/custom/workspace-select.tsx +8 -3
- package/src/components/ui/dialog.test.tsx +52 -0
- package/src/components/ui/dialog.tsx +6 -2
- package/src/components/ui/dropdown-menu.tsx +5 -1
- package/src/components/ui/finance/debts/debt-loan-form.tsx +12 -5
- package/src/components/ui/finance/debts/debt-loan-summary.tsx +3 -2
- package/src/components/ui/finance/debts/debts-page.test.tsx +54 -5
- package/src/components/ui/finance/debts/debts-page.tsx +15 -2
- package/src/components/ui/finance/invoices/components/subscription-group-selector.tsx +3 -5
- package/src/components/ui/finance/invoices/new-invoice-page.test.tsx +25 -5
- package/src/components/ui/finance/invoices/new-invoice-page.tsx +7 -2
- package/src/components/ui/finance/invoices/standard-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/subscription-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/utils.ts +3 -1
- package/src/components/ui/finance/transactions/form-content-dialog.tsx +3 -0
- package/src/components/ui/finance/transactions/form-types.ts +1 -0
- package/src/components/ui/finance/transactions/form.tsx +2 -0
- package/src/components/ui/finance/transactions/infinite-transactions-list.tsx +2 -0
- package/src/components/ui/finance/transactions/period-charts/category-breakdown-dialog.tsx +1 -1
- package/src/components/ui/finance/transactions/transaction-edit-dialog.tsx +1 -4
- package/src/components/ui/finance/transactions/transactions-create-summary.tsx +3 -0
- package/src/components/ui/finance/transactions/transactions-page.tsx +4 -1
- package/src/components/ui/finance/wallets/form.test.tsx +51 -3
- package/src/components/ui/finance/wallets/form.tsx +15 -4
- package/src/components/ui/finance/wallets/walletId/wallet-details-actions.tsx +4 -0
- package/src/components/ui/finance/wallets/walletId/wallet-details-page.tsx +4 -2
- package/src/components/ui/finance/wallets/wallets-data-table.tsx +1 -0
- package/src/components/ui/finance/wallets/wallets-page.tsx +5 -2
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/legacy/calendar/all-day-event-bar.tsx +28 -39
- package/src/components/ui/legacy/calendar/calendar-cell.tsx +2 -0
- package/src/components/ui/legacy/calendar/calendar-content.tsx +10 -6
- package/src/components/ui/legacy/calendar/calendar-header.tsx +23 -3
- package/src/components/ui/legacy/calendar/calendar-loading-skeleton.tsx +135 -0
- package/src/components/ui/legacy/calendar/calendar-matrix.tsx +175 -237
- package/src/components/ui/legacy/calendar/event-card.test.tsx +177 -0
- package/src/components/ui/legacy/calendar/event-card.tsx +220 -131
- package/src/components/ui/legacy/calendar/event-modal.tsx +17 -17
- package/src/components/ui/legacy/calendar/event-provider-display.tsx +69 -0
- package/src/components/ui/legacy/calendar/smart-calendar.test.tsx +86 -4
- package/src/components/ui/legacy/calendar/smart-calendar.tsx +32 -2
- package/src/components/ui/legacy/meet/create-plan-dialog.tsx +19 -10
- package/src/components/ui/navigation-menu.tsx +1 -1
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/select.tsx +5 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/storefront/cart-popover.tsx +61 -0
- package/src/components/ui/storefront/cart-summary-parts.tsx +290 -0
- package/src/components/ui/storefront/cart-summary.tsx +93 -154
- package/src/components/ui/storefront/checkout-overlay.tsx +4 -5
- package/src/components/ui/storefront/listing-card.tsx +1 -1
- package/src/components/ui/storefront/merch-sections.tsx +70 -0
- package/src/components/ui/storefront/product-detail.tsx +1 -1
- package/src/components/ui/storefront/storefront-surface.test.tsx +106 -11
- package/src/components/ui/storefront/storefront-surface.tsx +101 -166
- package/src/components/ui/storefront/types.ts +4 -0
- package/src/components/ui/storefront/utils.ts +6 -0
- package/src/components/ui/text-editor/__tests__/extensions.test.ts +123 -0
- package/src/components/ui/text-editor/background-color-extension.ts +62 -0
- package/src/components/ui/text-editor/color-controls.tsx +284 -0
- package/src/components/ui/text-editor/editor.tsx +69 -14
- package/src/components/ui/text-editor/extensions.ts +8 -2
- package/src/components/ui/text-editor/highlight-extension.ts +22 -0
- package/src/components/ui/text-editor/tool-bar.tsx +9 -16
- package/src/components/ui/toast.tsx +1 -1
- package/src/components/ui/tu-do/boards/__tests__/board-share-dialog.test.tsx +270 -0
- package/src/components/ui/tu-do/boards/board-public-link-section.tsx +231 -0
- package/src/components/ui/tu-do/boards/board-share-dialog.tsx +222 -109
- package/src/components/ui/tu-do/boards/boardId/board-column.tsx +112 -43
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +2 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +5 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +50 -2
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +17 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +4 -1
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +38 -9
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +2 -8
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-sort-key.ts +47 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +81 -30
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/__tests__/kanban-planner-island.test.tsx +380 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/kanban-planner-dialog.tsx +204 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-digest-panel.tsx +61 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-item-strip.tsx +54 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-plan-toolbar.tsx +251 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-scope-badge.tsx +27 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-section.tsx +58 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-share-dialog.tsx +238 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-target-controls.tsx +143 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-utils.ts +65 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/use-kanban-planner-state.ts +234 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +397 -2
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +103 -13
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +443 -19
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +94 -32
- package/src/components/ui/tu-do/boards/boardId/kanban.tsx +213 -106
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.test.tsx +26 -4
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +5 -2
- package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +3 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +191 -28
- package/src/components/ui/tu-do/boards/boardId/task-filter.test.tsx +152 -0
- package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +555 -545
- package/src/components/ui/tu-do/boards/boardId/task-list.tsx +7 -0
- package/src/components/ui/tu-do/boards/share-section.tsx +100 -0
- package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +10 -12
- package/src/components/ui/tu-do/drafts/drafts-page.tsx +33 -16
- package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +56 -88
- package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +26 -2
- package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +55 -8
- package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +1 -4
- package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +25 -0
- package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +341 -38
- package/src/components/ui/tu-do/shared/__tests__/board-switcher.test.tsx +253 -0
- package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +203 -2
- package/src/components/ui/tu-do/shared/__tests__/task-board-loading-state.test.tsx +17 -0
- package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +16 -0
- package/src/components/ui/tu-do/shared/board-client.tsx +2 -7
- package/src/components/ui/tu-do/shared/board-config-storage.ts +7 -1
- package/src/components/ui/tu-do/shared/board-header.tsx +464 -975
- package/src/components/ui/tu-do/shared/board-layout-settings.tsx +165 -136
- package/src/components/ui/tu-do/shared/board-switcher.tsx +209 -217
- package/src/components/ui/tu-do/shared/board-views.tsx +587 -75
- package/src/components/ui/tu-do/shared/list-view.tsx +227 -1
- package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +142 -94
- package/src/components/ui/tu-do/shared/special-task-list-pins.ts +51 -0
- package/src/components/ui/tu-do/shared/task-board-loading-state.tsx +28 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +3 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.test.tsx +91 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +123 -78
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +7 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +8 -3
- package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +2 -1
- package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +2 -9
- package/src/declarations.d.ts +1 -0
- package/src/hooks/__tests__/use-calendar-readonly.test.tsx +322 -2
- package/src/hooks/__tests__/use-calendar-sync.test.tsx +446 -0
- package/src/hooks/use-calendar-sync.tsx +247 -243
- package/src/hooks/use-calendar.tsx +323 -138
- package/src/hooks/use-task-actions.ts +24 -0
- package/src/hooks/use-user-workspace-config.ts +75 -0
- package/src/hooks/use-workspace-currency.ts +8 -3
- package/src/hooks/useBoardRealtimeEventHandler.ts +11 -0
|
@@ -88,6 +88,7 @@ interface Props {
|
|
|
88
88
|
preserveTaskOrder?: boolean;
|
|
89
89
|
searchQuery?: string;
|
|
90
90
|
weekStartsOn?: 0 | 1 | 6;
|
|
91
|
+
readOnly?: boolean;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
interface ColumnVisibility {
|
|
@@ -105,7 +106,232 @@ type TaskMenuState = {
|
|
|
105
106
|
point?: { x: number; y: number } | null;
|
|
106
107
|
};
|
|
107
108
|
|
|
108
|
-
export function ListView({
|
|
109
|
+
export function ListView(props: Props) {
|
|
110
|
+
if (props.readOnly) {
|
|
111
|
+
return <ReadOnlyListView {...props} />;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return <InteractiveListView {...props} />;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function ReadOnlyListView({
|
|
118
|
+
tasks,
|
|
119
|
+
lists,
|
|
120
|
+
isPersonalWorkspace = false,
|
|
121
|
+
preserveTaskOrder = false,
|
|
122
|
+
searchQuery,
|
|
123
|
+
}: Props) {
|
|
124
|
+
const t = useTranslations();
|
|
125
|
+
const tc = useTranslations('common');
|
|
126
|
+
const locale = useLocale();
|
|
127
|
+
const dateLocale = locale === 'vi' ? vi : enUS;
|
|
128
|
+
const [sortField, setSortField] = useState<ListViewSortField>('created_at');
|
|
129
|
+
const [sortOrder, setSortOrder] = useState<ListViewSortOrder>('desc');
|
|
130
|
+
const listsById = useMemo(
|
|
131
|
+
() => new Map(lists.map((list) => [list.id, list])),
|
|
132
|
+
[lists]
|
|
133
|
+
);
|
|
134
|
+
const sortedTasks = useMemo(
|
|
135
|
+
() =>
|
|
136
|
+
sortListViewTasks(tasks, {
|
|
137
|
+
preserveTaskOrder,
|
|
138
|
+
searchQuery,
|
|
139
|
+
sortField,
|
|
140
|
+
sortOrder,
|
|
141
|
+
}),
|
|
142
|
+
[preserveTaskOrder, searchQuery, sortField, sortOrder, tasks]
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
function handleSort(field: ListViewSortField) {
|
|
146
|
+
if (field === sortField) {
|
|
147
|
+
setSortOrder(sortOrder === 'asc' ? 'desc' : 'asc');
|
|
148
|
+
} else {
|
|
149
|
+
setSortField(field);
|
|
150
|
+
setSortOrder('asc');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function getSortIcon(field: ListViewSortField) {
|
|
155
|
+
if (sortField !== field) {
|
|
156
|
+
return <ArrowDownUp className="ml-2 h-3 w-3 text-muted-foreground" />;
|
|
157
|
+
}
|
|
158
|
+
return sortOrder === 'asc' ? (
|
|
159
|
+
<ArrowUp className="ml-2 h-3 w-3 text-foreground" />
|
|
160
|
+
) : (
|
|
161
|
+
<ArrowDown className="ml-2 h-3 w-3 text-foreground" />
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function formatDate(date: string) {
|
|
166
|
+
return format(new Date(date), 'MMM dd', { locale: dateLocale });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<div className="flex h-full flex-col">
|
|
171
|
+
{sortedTasks.length === 0 ? (
|
|
172
|
+
<div className="flex flex-1 items-center justify-center">
|
|
173
|
+
<p className="text-muted-foreground text-sm">{tc('no_tasks')}</p>
|
|
174
|
+
</div>
|
|
175
|
+
) : (
|
|
176
|
+
<div className="relative flex-1 overflow-auto">
|
|
177
|
+
<Table>
|
|
178
|
+
<TableHeader className="sticky top-0 z-10 border-b bg-background">
|
|
179
|
+
<TableRow className="hover:bg-transparent">
|
|
180
|
+
<TableHead className="h-9 min-w-62.5 px-3">
|
|
181
|
+
<Button
|
|
182
|
+
variant="ghost"
|
|
183
|
+
className={cn(
|
|
184
|
+
'-ml-2 h-6 justify-start gap-1 px-2 font-medium text-[10px] uppercase tracking-wider transition-colors hover:bg-muted/50',
|
|
185
|
+
sortField === 'name'
|
|
186
|
+
? 'text-foreground'
|
|
187
|
+
: 'text-muted-foreground'
|
|
188
|
+
)}
|
|
189
|
+
onClick={() => handleSort('name')}
|
|
190
|
+
>
|
|
191
|
+
{tc('task_header')}
|
|
192
|
+
{getSortIcon('name')}
|
|
193
|
+
</Button>
|
|
194
|
+
</TableHead>
|
|
195
|
+
<TableHead className="h-9 w-32 px-2">
|
|
196
|
+
<span className="font-medium text-[10px] text-muted-foreground uppercase tracking-wider">
|
|
197
|
+
{tc('status')}
|
|
198
|
+
</span>
|
|
199
|
+
</TableHead>
|
|
200
|
+
<TableHead className="h-9 w-24 px-2">
|
|
201
|
+
<Button
|
|
202
|
+
variant="ghost"
|
|
203
|
+
className={cn(
|
|
204
|
+
'-ml-2 h-6 justify-start gap-1 px-2 font-medium text-[10px] uppercase tracking-wider transition-colors hover:bg-muted/50',
|
|
205
|
+
sortField === 'priority'
|
|
206
|
+
? 'text-foreground'
|
|
207
|
+
: 'text-muted-foreground'
|
|
208
|
+
)}
|
|
209
|
+
onClick={() => handleSort('priority')}
|
|
210
|
+
>
|
|
211
|
+
{tc('priority')}
|
|
212
|
+
{getSortIcon('priority')}
|
|
213
|
+
</Button>
|
|
214
|
+
</TableHead>
|
|
215
|
+
<TableHead className="h-9 w-28 px-2">
|
|
216
|
+
<Button
|
|
217
|
+
variant="ghost"
|
|
218
|
+
className={cn(
|
|
219
|
+
'-ml-2 h-6 justify-start gap-1 px-2 font-medium text-[10px] uppercase tracking-wider transition-colors hover:bg-muted/50',
|
|
220
|
+
sortField === 'end_date'
|
|
221
|
+
? 'text-foreground'
|
|
222
|
+
: 'text-muted-foreground'
|
|
223
|
+
)}
|
|
224
|
+
onClick={() => handleSort('end_date')}
|
|
225
|
+
>
|
|
226
|
+
{tc('due')}
|
|
227
|
+
{getSortIcon('end_date')}
|
|
228
|
+
</Button>
|
|
229
|
+
</TableHead>
|
|
230
|
+
{!isPersonalWorkspace && (
|
|
231
|
+
<TableHead className="h-9 w-32 px-2">
|
|
232
|
+
<span className="font-medium text-[10px] text-muted-foreground uppercase tracking-wider">
|
|
233
|
+
{tc('assignee')}
|
|
234
|
+
</span>
|
|
235
|
+
</TableHead>
|
|
236
|
+
)}
|
|
237
|
+
</TableRow>
|
|
238
|
+
</TableHeader>
|
|
239
|
+
<TableBody>
|
|
240
|
+
{sortedTasks.map((task) => {
|
|
241
|
+
const list = listsById.get(task.list_id);
|
|
242
|
+
return (
|
|
243
|
+
<TableRow key={task.id} className="h-12 border-b">
|
|
244
|
+
<TableCell className="px-3 py-2">
|
|
245
|
+
<div className="min-w-0 space-y-1">
|
|
246
|
+
<div
|
|
247
|
+
className={cn(
|
|
248
|
+
'truncate font-medium text-sm',
|
|
249
|
+
(task.completed_at || task.closed_at) &&
|
|
250
|
+
'text-muted-foreground line-through'
|
|
251
|
+
)}
|
|
252
|
+
>
|
|
253
|
+
{task.name}
|
|
254
|
+
</div>
|
|
255
|
+
{(task.labels?.length || task.projects?.length) && (
|
|
256
|
+
<div className="flex flex-wrap items-center gap-1">
|
|
257
|
+
{task.labels?.slice(0, 3).map((label) => (
|
|
258
|
+
<Badge
|
|
259
|
+
key={label.id}
|
|
260
|
+
variant="outline"
|
|
261
|
+
className="h-4 gap-1 px-1.5 font-normal text-[10px]"
|
|
262
|
+
>
|
|
263
|
+
<span
|
|
264
|
+
aria-hidden="true"
|
|
265
|
+
className="h-2 w-2 rounded-full"
|
|
266
|
+
style={{ backgroundColor: label.color }}
|
|
267
|
+
/>
|
|
268
|
+
{label.name}
|
|
269
|
+
</Badge>
|
|
270
|
+
))}
|
|
271
|
+
{task.projects?.slice(0, 2).map((project) => (
|
|
272
|
+
<Badge
|
|
273
|
+
key={project.id}
|
|
274
|
+
variant="secondary"
|
|
275
|
+
className="h-4 px-1.5 font-normal text-[10px]"
|
|
276
|
+
>
|
|
277
|
+
{project.name}
|
|
278
|
+
</Badge>
|
|
279
|
+
))}
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
</TableCell>
|
|
284
|
+
<TableCell className="px-2 py-2">
|
|
285
|
+
<Badge variant="outline" className="font-normal">
|
|
286
|
+
{list?.name ?? tc('untitled')}
|
|
287
|
+
</Badge>
|
|
288
|
+
</TableCell>
|
|
289
|
+
<TableCell className="px-2 py-2">
|
|
290
|
+
{task.priority && (
|
|
291
|
+
<Badge variant="secondary" className="font-normal">
|
|
292
|
+
{t(`tasks.priority_${task.priority}`)}
|
|
293
|
+
</Badge>
|
|
294
|
+
)}
|
|
295
|
+
</TableCell>
|
|
296
|
+
<TableCell className="px-2 py-2">
|
|
297
|
+
{task.end_date && (
|
|
298
|
+
<span className="text-muted-foreground text-xs">
|
|
299
|
+
{formatDate(task.end_date)}
|
|
300
|
+
</span>
|
|
301
|
+
)}
|
|
302
|
+
</TableCell>
|
|
303
|
+
{!isPersonalWorkspace && (
|
|
304
|
+
<TableCell className="px-2 py-2">
|
|
305
|
+
{task.assignees && task.assignees.length > 0 && (
|
|
306
|
+
<div className="flex flex-wrap gap-1">
|
|
307
|
+
{task.assignees.slice(0, 2).map((assignee) => (
|
|
308
|
+
<Badge
|
|
309
|
+
key={assignee.id}
|
|
310
|
+
variant="secondary"
|
|
311
|
+
className="font-normal"
|
|
312
|
+
>
|
|
313
|
+
{assignee.display_name ||
|
|
314
|
+
assignee.email ||
|
|
315
|
+
assignee.handle ||
|
|
316
|
+
tc('assignee')}
|
|
317
|
+
</Badge>
|
|
318
|
+
))}
|
|
319
|
+
</div>
|
|
320
|
+
)}
|
|
321
|
+
</TableCell>
|
|
322
|
+
)}
|
|
323
|
+
</TableRow>
|
|
324
|
+
);
|
|
325
|
+
})}
|
|
326
|
+
</TableBody>
|
|
327
|
+
</Table>
|
|
328
|
+
</div>
|
|
329
|
+
)}
|
|
330
|
+
</div>
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function InteractiveListView({
|
|
109
335
|
workspaceId,
|
|
110
336
|
boardId,
|
|
111
337
|
tasks,
|
|
@@ -73,14 +73,24 @@ interface RecycleBinPanelProps {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
open
|
|
78
|
-
|
|
76
|
+
interface RecycleBinContentProps
|
|
77
|
+
extends Omit<RecycleBinPanelProps, 'open' | 'onOpenChange'> {
|
|
78
|
+
active?: boolean;
|
|
79
|
+
className?: string;
|
|
80
|
+
onParentOpenChange?: (open: boolean) => void;
|
|
81
|
+
showHeader?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function RecycleBinContent({
|
|
85
|
+
active = true,
|
|
86
|
+
className,
|
|
87
|
+
onParentOpenChange,
|
|
88
|
+
showHeader = true,
|
|
79
89
|
wsId,
|
|
80
90
|
boardId,
|
|
81
91
|
lists,
|
|
82
92
|
translations,
|
|
83
|
-
}:
|
|
93
|
+
}: RecycleBinContentProps) {
|
|
84
94
|
// Use provided translations or fall back to English defaults
|
|
85
95
|
const t = useMemo(
|
|
86
96
|
() => ({
|
|
@@ -143,7 +153,7 @@ export function RecycleBinPanel({
|
|
|
143
153
|
boardId,
|
|
144
154
|
wsId,
|
|
145
155
|
{
|
|
146
|
-
enabled:
|
|
156
|
+
enabled: active,
|
|
147
157
|
staleTime: 60000,
|
|
148
158
|
}
|
|
149
159
|
);
|
|
@@ -193,20 +203,20 @@ export function RecycleBinPanel({
|
|
|
193
203
|
(isOpen: boolean) => {
|
|
194
204
|
setRestoreDialogOpen(isOpen);
|
|
195
205
|
if (isOpen) {
|
|
196
|
-
|
|
206
|
+
onParentOpenChange?.(false); // Close Sheet when dialog opens
|
|
197
207
|
}
|
|
198
208
|
},
|
|
199
|
-
[
|
|
209
|
+
[onParentOpenChange]
|
|
200
210
|
);
|
|
201
211
|
|
|
202
212
|
const handleDeleteDialogOpenChange = useCallback(
|
|
203
213
|
(isOpen: boolean) => {
|
|
204
214
|
setDeleteDialogOpen(isOpen);
|
|
205
215
|
if (isOpen) {
|
|
206
|
-
|
|
216
|
+
onParentOpenChange?.(false); // Close Sheet when dialog opens
|
|
207
217
|
}
|
|
208
218
|
},
|
|
209
|
-
[
|
|
219
|
+
[onParentOpenChange]
|
|
210
220
|
);
|
|
211
221
|
|
|
212
222
|
const handleRestore = useCallback(async () => {
|
|
@@ -254,97 +264,96 @@ export function RecycleBinPanel({
|
|
|
254
264
|
|
|
255
265
|
return (
|
|
256
266
|
<>
|
|
257
|
-
<
|
|
258
|
-
|
|
259
|
-
<
|
|
260
|
-
<
|
|
267
|
+
<div className={cn('flex min-h-0 flex-1 flex-col', className)}>
|
|
268
|
+
{showHeader && (
|
|
269
|
+
<div className="border-b p-4">
|
|
270
|
+
<h2 className="flex items-center gap-2 font-semibold text-lg">
|
|
261
271
|
<Trash2 className="h-5 w-5" />
|
|
262
272
|
{t.recycleBin}
|
|
263
|
-
</
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
</h2>
|
|
274
|
+
<p className="mt-1 text-muted-foreground text-sm">
|
|
275
|
+
{t.recycleBinDescription}
|
|
276
|
+
</p>
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
{/* Header with select all */}
|
|
280
|
+
{deletedTasks.length > 0 && (
|
|
281
|
+
<div className="flex items-center gap-3 border-b p-3">
|
|
282
|
+
<Checkbox
|
|
283
|
+
checked={allSelected}
|
|
284
|
+
onCheckedChange={handleSelectAll}
|
|
285
|
+
aria-label={t.selectAllTasks}
|
|
286
|
+
/>
|
|
287
|
+
<span className="text-foreground text-sm">
|
|
288
|
+
{someSelected
|
|
289
|
+
? t.selectedOfTotal
|
|
290
|
+
.replace('{selected}', String(selectedTasks.size))
|
|
291
|
+
.replace('{total}', String(deletedTasks.length))
|
|
292
|
+
: t.deletedTasksCount.replace(
|
|
293
|
+
'{count}',
|
|
294
|
+
String(deletedTasks.length)
|
|
295
|
+
)}
|
|
296
|
+
</span>
|
|
297
|
+
</div>
|
|
298
|
+
)}
|
|
299
|
+
|
|
300
|
+
{/* Task list */}
|
|
301
|
+
<div className="flex-1 overflow-y-auto p-3">
|
|
302
|
+
{isLoading ? (
|
|
303
|
+
<div className="flex items-center justify-center py-12">
|
|
304
|
+
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
|
305
|
+
</div>
|
|
306
|
+
) : deletedTasks.length === 0 ? (
|
|
307
|
+
<div className="flex flex-col items-center justify-center py-12 text-center">
|
|
308
|
+
<Trash2 className="mb-3 h-12 w-12 text-muted-foreground/50" />
|
|
309
|
+
<p className="text-muted-foreground">{t.noDeletedTasks}</p>
|
|
310
|
+
<p className="mt-1 text-muted-foreground/70 text-xs">
|
|
311
|
+
{t.deletedTasksWillAppearHere}
|
|
312
|
+
</p>
|
|
313
|
+
</div>
|
|
314
|
+
) : (
|
|
315
|
+
<div className="space-y-2">
|
|
316
|
+
{deletedTasks.map((task: Task) => (
|
|
317
|
+
<RecycleBinTaskRow
|
|
318
|
+
key={task.id}
|
|
319
|
+
task={task}
|
|
320
|
+
listName={listMap.get(task.list_id)}
|
|
321
|
+
isSelected={selectedTasks.has(task.id)}
|
|
322
|
+
onSelect={(checked) => handleSelectTask(task.id, checked)}
|
|
323
|
+
disabled={isWorking}
|
|
324
|
+
translations={t}
|
|
275
325
|
/>
|
|
276
|
-
|
|
277
|
-
{someSelected
|
|
278
|
-
? t.selectedOfTotal
|
|
279
|
-
.replace('{selected}', String(selectedTasks.size))
|
|
280
|
-
.replace('{total}', String(deletedTasks.length))
|
|
281
|
-
: t.deletedTasksCount.replace(
|
|
282
|
-
'{count}',
|
|
283
|
-
String(deletedTasks.length)
|
|
284
|
-
)}
|
|
285
|
-
</span>
|
|
286
|
-
</div>
|
|
287
|
-
)}
|
|
288
|
-
|
|
289
|
-
{/* Task list */}
|
|
290
|
-
<div className="flex-1 overflow-y-auto p-3">
|
|
291
|
-
{isLoading ? (
|
|
292
|
-
<div className="flex items-center justify-center py-12">
|
|
293
|
-
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
|
294
|
-
</div>
|
|
295
|
-
) : deletedTasks.length === 0 ? (
|
|
296
|
-
<div className="flex flex-col items-center justify-center py-12 text-center">
|
|
297
|
-
<Trash2 className="mb-3 h-12 w-12 text-muted-foreground/50" />
|
|
298
|
-
<p className="text-muted-foreground">{t.noDeletedTasks}</p>
|
|
299
|
-
<p className="mt-1 text-muted-foreground/70 text-xs">
|
|
300
|
-
{t.deletedTasksWillAppearHere}
|
|
301
|
-
</p>
|
|
302
|
-
</div>
|
|
303
|
-
) : (
|
|
304
|
-
<div className="space-y-2">
|
|
305
|
-
{deletedTasks.map((task: Task) => (
|
|
306
|
-
<RecycleBinTaskRow
|
|
307
|
-
key={task.id}
|
|
308
|
-
task={task}
|
|
309
|
-
listName={listMap.get(task.list_id)}
|
|
310
|
-
isSelected={selectedTasks.has(task.id)}
|
|
311
|
-
onSelect={(checked) => handleSelectTask(task.id, checked)}
|
|
312
|
-
disabled={isWorking}
|
|
313
|
-
translations={t}
|
|
314
|
-
/>
|
|
315
|
-
))}
|
|
316
|
-
</div>
|
|
317
|
-
)}
|
|
326
|
+
))}
|
|
318
327
|
</div>
|
|
328
|
+
)}
|
|
329
|
+
</div>
|
|
319
330
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
</div>
|
|
344
|
-
)}
|
|
331
|
+
{/* Action bar */}
|
|
332
|
+
{someSelected && (
|
|
333
|
+
<div className="flex items-center gap-2 border-t px-3 py-4">
|
|
334
|
+
<Button
|
|
335
|
+
variant="outline"
|
|
336
|
+
size="sm"
|
|
337
|
+
className="flex-1"
|
|
338
|
+
onClick={() => handleRestoreDialogOpenChange(true)}
|
|
339
|
+
disabled={isWorking}
|
|
340
|
+
>
|
|
341
|
+
<RotateCcw className="mr-2 h-4 w-4" />
|
|
342
|
+
{t.restore} ({selectedTasks.size})
|
|
343
|
+
</Button>
|
|
344
|
+
<Button
|
|
345
|
+
variant="destructive"
|
|
346
|
+
size="sm"
|
|
347
|
+
className="flex-1"
|
|
348
|
+
onClick={() => handleDeleteDialogOpenChange(true)}
|
|
349
|
+
disabled={isWorking}
|
|
350
|
+
>
|
|
351
|
+
<Trash2 className="mr-2 h-4 w-4" />
|
|
352
|
+
{t.delete} ({selectedTasks.size})
|
|
353
|
+
</Button>
|
|
345
354
|
</div>
|
|
346
|
-
|
|
347
|
-
</
|
|
355
|
+
)}
|
|
356
|
+
</div>
|
|
348
357
|
|
|
349
358
|
{/* Restore Confirmation Dialog */}
|
|
350
359
|
<AlertDialog
|
|
@@ -433,6 +442,45 @@ export function RecycleBinPanel({
|
|
|
433
442
|
);
|
|
434
443
|
}
|
|
435
444
|
|
|
445
|
+
export function RecycleBinPanel({
|
|
446
|
+
open,
|
|
447
|
+
onOpenChange,
|
|
448
|
+
wsId,
|
|
449
|
+
boardId,
|
|
450
|
+
lists,
|
|
451
|
+
translations,
|
|
452
|
+
}: RecycleBinPanelProps) {
|
|
453
|
+
const t = {
|
|
454
|
+
recycleBin: translations?.recycleBin ?? 'Recycle Bin',
|
|
455
|
+
recycleBinDescription:
|
|
456
|
+
translations?.recycleBinDescription ??
|
|
457
|
+
'Restore or permanently delete tasks that were previously removed.',
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
return (
|
|
461
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
462
|
+
<SheetContent side="right" className="flex w-full flex-col sm:max-w-md">
|
|
463
|
+
<SheetHeader>
|
|
464
|
+
<SheetTitle className="flex items-center gap-2">
|
|
465
|
+
<Trash2 className="h-5 w-5" />
|
|
466
|
+
{t.recycleBin}
|
|
467
|
+
</SheetTitle>
|
|
468
|
+
<SheetDescription>{t.recycleBinDescription}</SheetDescription>
|
|
469
|
+
</SheetHeader>
|
|
470
|
+
<RecycleBinContent
|
|
471
|
+
active={open}
|
|
472
|
+
boardId={boardId}
|
|
473
|
+
lists={lists}
|
|
474
|
+
onParentOpenChange={onOpenChange}
|
|
475
|
+
showHeader={false}
|
|
476
|
+
translations={translations}
|
|
477
|
+
wsId={wsId}
|
|
478
|
+
/>
|
|
479
|
+
</SheetContent>
|
|
480
|
+
</Sheet>
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
436
484
|
interface RecycleBinTaskRowProps {
|
|
437
485
|
task: Task;
|
|
438
486
|
listName?: string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type SpecialTaskListPin =
|
|
2
|
+
| 'closed_tasks'
|
|
3
|
+
| 'external_tasks'
|
|
4
|
+
| 'overdue'
|
|
5
|
+
| 'upcoming';
|
|
6
|
+
|
|
7
|
+
export const SPECIAL_TASK_LIST_PIN_VALUES: readonly SpecialTaskListPin[] = [
|
|
8
|
+
'overdue',
|
|
9
|
+
'upcoming',
|
|
10
|
+
'external_tasks',
|
|
11
|
+
'closed_tasks',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const SPECIAL_TASK_LIST_PIN_SET = new Set<string>(SPECIAL_TASK_LIST_PIN_VALUES);
|
|
15
|
+
|
|
16
|
+
export type SpecialTaskListPinState = Partial<
|
|
17
|
+
Record<SpecialTaskListPin, boolean>
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export function parseSpecialTaskListPins(
|
|
21
|
+
raw: string | null | undefined
|
|
22
|
+
): SpecialTaskListPinState {
|
|
23
|
+
if (!raw) return {};
|
|
24
|
+
|
|
25
|
+
const parseValues = (value: unknown) => {
|
|
26
|
+
if (!Array.isArray(value)) return [];
|
|
27
|
+
return value.filter((item): item is SpecialTaskListPin => {
|
|
28
|
+
return typeof item === 'string' && SPECIAL_TASK_LIST_PIN_SET.has(item);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
let values: SpecialTaskListPin[] = [];
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
values = parseValues(JSON.parse(raw));
|
|
36
|
+
} catch {
|
|
37
|
+
values = parseValues(raw.split(',').map((item) => item.trim()));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return values.reduce<SpecialTaskListPinState>((acc, pin) => {
|
|
41
|
+
acc[pin] = true;
|
|
42
|
+
return acc;
|
|
43
|
+
}, {});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function serializeSpecialTaskListPins(
|
|
47
|
+
state: SpecialTaskListPinState
|
|
48
|
+
): string | null {
|
|
49
|
+
const pins = SPECIAL_TASK_LIST_PIN_VALUES.filter((pin) => state[pin]);
|
|
50
|
+
return pins.length > 0 ? JSON.stringify(pins) : null;
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@tuturuuu/utils/format';
|
|
4
|
+
import { KanbanSkeleton } from '../boards/boardId/kanban/rendering/kanban-skeleton';
|
|
5
|
+
|
|
6
|
+
export function TaskBoardLoadingState({
|
|
7
|
+
className,
|
|
8
|
+
root = false,
|
|
9
|
+
}: {
|
|
10
|
+
className?: string;
|
|
11
|
+
root?: boolean;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
aria-busy="true"
|
|
16
|
+
className={cn(
|
|
17
|
+
'w-full overflow-hidden bg-transparent',
|
|
18
|
+
root
|
|
19
|
+
? '-m-4 h-[calc(100dvh+2rem)] min-h-[calc(32rem+2rem)]'
|
|
20
|
+
: 'h-[calc(100dvh-1rem)] min-h-[32rem]',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
data-testid="task-board-loading-state"
|
|
24
|
+
>
|
|
25
|
+
<KanbanSkeleton />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -373,8 +373,9 @@ function DescriptionDiff({
|
|
|
373
373
|
</>
|
|
374
374
|
);
|
|
375
375
|
|
|
376
|
-
//
|
|
377
|
-
|
|
376
|
+
// Show the full viewer whenever either side has content so users can inspect
|
|
377
|
+
// content-only, empty/content, and structural editor changes.
|
|
378
|
+
if (hasSnapshot || hasCurrent || hasTextChanges) {
|
|
378
379
|
return (
|
|
379
380
|
<div className="text-sm">
|
|
380
381
|
<div className="flex items-center gap-2">
|