@btst/stack 1.11.0 → 1.12.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 (163) hide show
  1. package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.cjs +1 -1
  2. package/dist/node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@dnd-kit/core/dist/core.esm.mjs +1 -1
  3. package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.cjs +77 -0
  4. package/dist/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@dnd-kit/sortable/dist/sortable.esm.mjs +79 -3
  5. package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.cjs +140 -0
  6. package/dist/node_modules/.pnpm/@radix-ui_react-avatar@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_850cfbef1935a6e49a6ad6c93c7ca70d/node_modules/@radix-ui/react-avatar/dist/index.mjs +119 -0
  7. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +80 -0
  8. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs +64 -0
  9. package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.cjs +18 -0
  10. package/dist/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs +16 -0
  11. package/dist/packages/better-stack/src/plugins/kanban/api/plugin.cjs +846 -0
  12. package/dist/packages/better-stack/src/plugins/kanban/api/plugin.mjs +844 -0
  13. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.cjs +85 -0
  14. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/board-form.mjs +83 -0
  15. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.cjs +72 -0
  16. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/column-form.mjs +70 -0
  17. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.cjs +200 -0
  18. package/dist/packages/better-stack/src/plugins/kanban/client/components/forms/task-form.mjs +198 -0
  19. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.cjs +47 -0
  20. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/board-skeleton.mjs +45 -0
  21. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.cjs +30 -0
  22. package/dist/packages/better-stack/src/plugins/kanban/client/components/loading/boards-list-skeleton.mjs +28 -0
  23. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.cjs +27 -0
  24. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/404-page.mjs +25 -0
  25. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.cjs +31 -0
  26. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.cjs +458 -0
  27. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.internal.mjs +456 -0
  28. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/board-page.mjs +29 -0
  29. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.cjs +30 -0
  30. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.cjs +72 -0
  31. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.internal.mjs +70 -0
  32. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/boards-list-page.mjs +28 -0
  33. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.cjs +30 -0
  34. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.cjs +51 -0
  35. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.internal.mjs +49 -0
  36. package/dist/packages/better-stack/src/plugins/kanban/client/components/pages/new-board-page.mjs +28 -0
  37. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.cjs +76 -0
  38. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/column-content.mjs +74 -0
  39. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.cjs +27 -0
  40. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/default-error.mjs +25 -0
  41. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.cjs +32 -0
  42. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/empty-state.mjs +30 -0
  43. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.cjs +78 -0
  44. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/kanban-board.mjs +76 -0
  45. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.cjs +15 -0
  46. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/page-wrapper.mjs +13 -0
  47. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.cjs +68 -0
  48. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/task-card.mjs +66 -0
  49. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.cjs +32 -0
  50. package/dist/packages/better-stack/src/plugins/kanban/client/components/shared/user-avatar.mjs +30 -0
  51. package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.cjs +391 -0
  52. package/dist/packages/better-stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +381 -0
  53. package/dist/packages/better-stack/src/plugins/kanban/client/plugin.cjs +290 -0
  54. package/dist/packages/better-stack/src/plugins/kanban/client/plugin.mjs +288 -0
  55. package/dist/packages/better-stack/src/plugins/kanban/db.cjs +125 -0
  56. package/dist/packages/better-stack/src/plugins/kanban/db.mjs +123 -0
  57. package/dist/packages/better-stack/src/plugins/kanban/schemas.cjs +117 -0
  58. package/dist/packages/better-stack/src/plugins/kanban/schemas.mjs +102 -0
  59. package/dist/packages/better-stack/src/plugins/kanban/utils.cjs +49 -0
  60. package/dist/packages/better-stack/src/plugins/kanban/utils.mjs +45 -0
  61. package/dist/packages/ui/src/components/avatar.cjs +58 -0
  62. package/dist/packages/ui/src/components/avatar.mjs +54 -0
  63. package/dist/packages/ui/src/components/command.cjs +3 -3
  64. package/dist/packages/ui/src/components/command.mjs +3 -3
  65. package/dist/packages/ui/src/components/form-builder/index.mjs +2 -2
  66. package/dist/packages/ui/src/components/kanban.cjs +835 -0
  67. package/dist/packages/ui/src/components/kanban.mjs +805 -0
  68. package/dist/packages/ui/src/components/popover.cjs +8 -3
  69. package/dist/packages/ui/src/components/popover.mjs +9 -4
  70. package/dist/packages/ui/src/components/search-select.cjs +75 -0
  71. package/dist/packages/ui/src/components/search-select.mjs +73 -0
  72. package/dist/packages/ui/src/lib/compose-refs.cjs +56 -0
  73. package/dist/packages/ui/src/lib/compose-refs.mjs +39 -0
  74. package/dist/plugins/blog/api/index.d.cts +1 -1
  75. package/dist/plugins/blog/api/index.d.mts +1 -1
  76. package/dist/plugins/blog/api/index.d.ts +1 -1
  77. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  78. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  79. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  80. package/dist/plugins/blog/client/index.d.cts +1 -1
  81. package/dist/plugins/blog/client/index.d.mts +1 -1
  82. package/dist/plugins/blog/client/index.d.ts +1 -1
  83. package/dist/plugins/blog/query-keys.d.cts +2 -2
  84. package/dist/plugins/blog/query-keys.d.mts +2 -2
  85. package/dist/plugins/blog/query-keys.d.ts +2 -2
  86. package/dist/plugins/kanban/api/index.cjs +7 -0
  87. package/dist/plugins/kanban/api/index.d.cts +403 -0
  88. package/dist/plugins/kanban/api/index.d.mts +403 -0
  89. package/dist/plugins/kanban/api/index.d.ts +403 -0
  90. package/dist/plugins/kanban/api/index.mjs +1 -0
  91. package/dist/plugins/kanban/client/components/index.cjs +35 -0
  92. package/dist/plugins/kanban/client/components/index.d.cts +102 -0
  93. package/dist/plugins/kanban/client/components/index.d.mts +102 -0
  94. package/dist/plugins/kanban/client/components/index.d.ts +102 -0
  95. package/dist/plugins/kanban/client/components/index.mjs +15 -0
  96. package/dist/plugins/kanban/client/hooks/index.cjs +15 -0
  97. package/dist/plugins/kanban/client/hooks/index.d.cts +143 -0
  98. package/dist/plugins/kanban/client/hooks/index.d.mts +143 -0
  99. package/dist/plugins/kanban/client/hooks/index.d.ts +143 -0
  100. package/dist/plugins/kanban/client/hooks/index.mjs +1 -0
  101. package/dist/plugins/kanban/client/index.cjs +7 -0
  102. package/dist/plugins/kanban/client/index.d.cts +196 -0
  103. package/dist/plugins/kanban/client/index.d.mts +196 -0
  104. package/dist/plugins/kanban/client/index.d.ts +196 -0
  105. package/dist/plugins/kanban/client/index.mjs +1 -0
  106. package/dist/plugins/kanban/client.css +68 -0
  107. package/dist/plugins/kanban/query-keys.cjs +105 -0
  108. package/dist/plugins/kanban/query-keys.d.cts +59 -0
  109. package/dist/plugins/kanban/query-keys.d.mts +59 -0
  110. package/dist/plugins/kanban/query-keys.d.ts +59 -0
  111. package/dist/plugins/kanban/query-keys.mjs +103 -0
  112. package/dist/plugins/kanban/style.css +7 -0
  113. package/dist/plugins/ui-builder/style.css +6 -0
  114. package/dist/shared/stack.DKDMI-QO.d.cts +70 -0
  115. package/dist/shared/stack.DKDMI-QO.d.mts +70 -0
  116. package/dist/shared/stack.DKDMI-QO.d.ts +70 -0
  117. package/dist/shared/stack.FeaWkglm.d.cts +190 -0
  118. package/dist/shared/stack.FeaWkglm.d.mts +190 -0
  119. package/dist/shared/stack.FeaWkglm.d.ts +190 -0
  120. package/package.json +56 -2
  121. package/src/plugins/kanban/api/index.ts +6 -0
  122. package/src/plugins/kanban/api/plugin.ts +1245 -0
  123. package/src/plugins/kanban/client/components/forms/board-form.tsx +108 -0
  124. package/src/plugins/kanban/client/components/forms/column-form.tsx +97 -0
  125. package/src/plugins/kanban/client/components/forms/task-form.tsx +274 -0
  126. package/src/plugins/kanban/client/components/index.tsx +21 -0
  127. package/src/plugins/kanban/client/components/loading/board-skeleton.tsx +49 -0
  128. package/src/plugins/kanban/client/components/loading/boards-list-skeleton.tsx +34 -0
  129. package/src/plugins/kanban/client/components/loading/index.tsx +2 -0
  130. package/src/plugins/kanban/client/components/pages/404-page.tsx +28 -0
  131. package/src/plugins/kanban/client/components/pages/board-page.internal.tsx +575 -0
  132. package/src/plugins/kanban/client/components/pages/board-page.tsx +31 -0
  133. package/src/plugins/kanban/client/components/pages/boards-list-page.internal.tsx +101 -0
  134. package/src/plugins/kanban/client/components/pages/boards-list-page.tsx +26 -0
  135. package/src/plugins/kanban/client/components/pages/new-board-page.internal.tsx +65 -0
  136. package/src/plugins/kanban/client/components/pages/new-board-page.tsx +26 -0
  137. package/src/plugins/kanban/client/components/shared/column-content.tsx +108 -0
  138. package/src/plugins/kanban/client/components/shared/default-error.tsx +32 -0
  139. package/src/plugins/kanban/client/components/shared/empty-state.tsx +37 -0
  140. package/src/plugins/kanban/client/components/shared/kanban-board.tsx +87 -0
  141. package/src/plugins/kanban/client/components/shared/page-wrapper.tsx +20 -0
  142. package/src/plugins/kanban/client/components/shared/task-card.tsx +79 -0
  143. package/src/plugins/kanban/client/components/shared/user-avatar.tsx +63 -0
  144. package/src/plugins/kanban/client/hooks/index.tsx +11 -0
  145. package/src/plugins/kanban/client/hooks/kanban-hooks.tsx +560 -0
  146. package/src/plugins/kanban/client/index.ts +8 -0
  147. package/src/plugins/kanban/client/localization/index.ts +28 -0
  148. package/src/plugins/kanban/client/localization/kanban-common.ts +69 -0
  149. package/src/plugins/kanban/client/localization/kanban-forms.ts +70 -0
  150. package/src/plugins/kanban/client/localization/kanban-list.ts +36 -0
  151. package/src/plugins/kanban/client/overrides.ts +145 -0
  152. package/src/plugins/kanban/client/plugin.tsx +463 -0
  153. package/src/plugins/kanban/client.css +68 -0
  154. package/src/plugins/kanban/db.ts +125 -0
  155. package/src/plugins/kanban/query-keys.ts +154 -0
  156. package/src/plugins/kanban/schemas.ts +143 -0
  157. package/src/plugins/kanban/style.css +7 -0
  158. package/src/plugins/kanban/types.ts +106 -0
  159. package/src/plugins/kanban/utils.ts +107 -0
  160. package/src/plugins/ui-builder/style.css +6 -0
  161. package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.cts} +1 -1
  162. package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.mts} +1 -1
  163. package/dist/shared/{stack.DLhzx1-D.d.ts → stack.CcI4sYJP.d.ts} +1 -1
@@ -0,0 +1,456 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useState, useCallback, useMemo, useEffect } from 'react';
4
+ import { ArrowLeft, Settings, Plus, Pencil, Trash2 } from 'lucide-react';
5
+ import { toast } from 'sonner';
6
+ import { Button } from '../../../../../../../ui/src/components/button.mjs';
7
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '../../../../../../../ui/src/components/dropdown-menu.mjs';
8
+ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '../../../../../../../ui/src/components/dialog.mjs';
9
+ import { AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '../../../../../../../ui/src/components/alert-dialog.mjs';
10
+ import { useSuspenseBoard, useBoardMutations, useColumnMutations, useTaskMutations } from '../../hooks/kanban-hooks.mjs';
11
+ import { usePluginOverrides } from '@btst/stack/context';
12
+ import { KanbanBoard } from '../shared/kanban-board.mjs';
13
+ import { ColumnForm } from '../forms/column-form.mjs';
14
+ import { BoardForm } from '../forms/board-form.mjs';
15
+ import { TaskForm } from '../forms/task-form.mjs';
16
+ import { PageWrapper } from '../shared/page-wrapper.mjs';
17
+ import { EmptyState } from '../shared/empty-state.mjs';
18
+
19
+ function BoardPage({ boardId }) {
20
+ const { data: board, error, refetch, isFetching } = useSuspenseBoard(boardId);
21
+ if (error && !isFetching) {
22
+ throw error;
23
+ }
24
+ const { Link: OverrideLink, navigate: overrideNavigate } = usePluginOverrides("kanban");
25
+ const navigate = overrideNavigate || ((path) => {
26
+ window.location.href = path;
27
+ });
28
+ const Link = OverrideLink || "a";
29
+ const { deleteBoard, isDeleting } = useBoardMutations();
30
+ const { deleteColumn, reorderColumns } = useColumnMutations();
31
+ const { deleteTask, moveTask, reorderTasks } = useTaskMutations();
32
+ const [modalState, setModalState] = useState({ type: "none" });
33
+ const computeKanbanData = useCallback(
34
+ (columns) => {
35
+ if (!columns) return {};
36
+ return columns.reduce(
37
+ (acc, column) => {
38
+ acc[column.id] = column.tasks || [];
39
+ return acc;
40
+ },
41
+ {}
42
+ );
43
+ },
44
+ []
45
+ );
46
+ const [kanbanState, setKanbanState] = useState(() => computeKanbanData(board?.columns));
47
+ const serverKanbanData = useMemo(
48
+ () => computeKanbanData(board?.columns),
49
+ [board?.columns, computeKanbanData]
50
+ );
51
+ useEffect(() => {
52
+ setKanbanState(serverKanbanData);
53
+ }, [serverKanbanData]);
54
+ const closeModal = useCallback(() => {
55
+ setModalState({ type: "none" });
56
+ }, []);
57
+ const handleDeleteBoard = useCallback(async () => {
58
+ try {
59
+ await deleteBoard(boardId);
60
+ closeModal();
61
+ navigate("/pages/kanban");
62
+ if (typeof window !== "undefined") {
63
+ setTimeout(() => {
64
+ if (window.location.pathname.includes(boardId)) {
65
+ window.location.href = "/pages/kanban";
66
+ }
67
+ }, 100);
68
+ }
69
+ } catch (error2) {
70
+ const message = error2 instanceof Error ? error2.message : "Failed to delete board";
71
+ toast.error(message);
72
+ }
73
+ }, [deleteBoard, boardId, navigate, closeModal]);
74
+ const handleKanbanChange = useCallback(
75
+ async (newData) => {
76
+ if (!board) return;
77
+ let previousState = {};
78
+ setKanbanState((current) => {
79
+ previousState = current;
80
+ return newData;
81
+ });
82
+ try {
83
+ const oldKeys = Object.keys(previousState);
84
+ const newKeys = Object.keys(newData);
85
+ const isColumnMove = oldKeys.length === newKeys.length && oldKeys.join("") !== newKeys.join("");
86
+ if (isColumnMove) {
87
+ await reorderColumns(board.id, newKeys);
88
+ } else {
89
+ const crossColumnMoves = [];
90
+ const columnsToReorder = /* @__PURE__ */ new Map();
91
+ const targetColumnsOfCrossMove = /* @__PURE__ */ new Set();
92
+ for (const [columnId, tasks] of Object.entries(newData)) {
93
+ const oldTasks = previousState[columnId] || [];
94
+ let hasOrderChanges = false;
95
+ for (let i = 0; i < tasks.length; i++) {
96
+ const task = tasks[i];
97
+ if (!task) continue;
98
+ if (task.columnId !== columnId) {
99
+ crossColumnMoves.push({
100
+ taskId: task.id,
101
+ targetColumnId: columnId,
102
+ targetOrder: i
103
+ });
104
+ targetColumnsOfCrossMove.add(columnId);
105
+ } else if (task.order !== i) {
106
+ hasOrderChanges = true;
107
+ }
108
+ }
109
+ const newTaskIds = new Set(tasks.map((t) => t.id));
110
+ const tasksRemoved = oldTasks.some((t) => !newTaskIds.has(t.id));
111
+ if (hasOrderChanges && !targetColumnsOfCrossMove.has(columnId) && !tasksRemoved) {
112
+ columnsToReorder.set(
113
+ columnId,
114
+ tasks.map((t) => t.id)
115
+ );
116
+ }
117
+ }
118
+ for (const move of crossColumnMoves) {
119
+ await moveTask(move.taskId, move.targetColumnId, move.targetOrder);
120
+ }
121
+ for (const [columnId, taskIds] of columnsToReorder) {
122
+ await reorderTasks(columnId, taskIds);
123
+ }
124
+ for (const targetColumnId of targetColumnsOfCrossMove) {
125
+ const tasks = newData[targetColumnId];
126
+ if (tasks) {
127
+ await reorderTasks(
128
+ targetColumnId,
129
+ tasks.map((t) => t.id)
130
+ );
131
+ }
132
+ }
133
+ }
134
+ refetch();
135
+ } catch (error2) {
136
+ refetch();
137
+ throw error2;
138
+ }
139
+ },
140
+ [board, reorderColumns, moveTask, reorderTasks, refetch]
141
+ );
142
+ const orderedColumns = useMemo(() => {
143
+ if (!board?.columns) return [];
144
+ const columnMap = new Map(board.columns.map((c) => [c.id, c]));
145
+ return Object.keys(kanbanState).map((columnId) => {
146
+ const column = columnMap.get(columnId);
147
+ if (!column) return null;
148
+ return {
149
+ ...column,
150
+ tasks: kanbanState[columnId] || []
151
+ };
152
+ }).filter(
153
+ (c) => c !== null
154
+ );
155
+ }, [board?.columns, kanbanState]);
156
+ if (!board) {
157
+ return /* @__PURE__ */ jsx(
158
+ EmptyState,
159
+ {
160
+ title: "Board not found",
161
+ description: "The board you're looking for doesn't exist or you don't have access to it.",
162
+ action: /* @__PURE__ */ jsxs(Button, { onClick: () => navigate("/pages/kanban"), children: [
163
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }),
164
+ "Back to Boards"
165
+ ] })
166
+ }
167
+ );
168
+ }
169
+ return /* @__PURE__ */ jsxs(
170
+ PageWrapper,
171
+ {
172
+ "data-testid": "board-page",
173
+ className: "flex flex-col items-center",
174
+ children: [
175
+ /* @__PURE__ */ jsxs("div", { className: "w-full flex items-center justify-between mb-8", children: [
176
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
177
+ /* @__PURE__ */ jsx(
178
+ Link,
179
+ {
180
+ href: "/pages/kanban",
181
+ className: "text-muted-foreground hover:text-foreground",
182
+ children: /* @__PURE__ */ jsx(ArrowLeft, { className: "h-5 w-5" })
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsxs("div", { children: [
186
+ /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold", "data-testid": "page-header", children: board.name }),
187
+ board.description && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children: board.description })
188
+ ] })
189
+ ] }),
190
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
191
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", children: [
192
+ /* @__PURE__ */ jsx(Settings, { className: "mr-2 h-4 w-4" }),
193
+ "Actions"
194
+ ] }) }),
195
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
196
+ /* @__PURE__ */ jsxs(
197
+ DropdownMenuItem,
198
+ {
199
+ onClick: () => setModalState({ type: "addColumn" }),
200
+ children: [
201
+ /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
202
+ "Add Column"
203
+ ]
204
+ }
205
+ ),
206
+ /* @__PURE__ */ jsxs(
207
+ DropdownMenuItem,
208
+ {
209
+ onClick: () => setModalState({ type: "editBoard" }),
210
+ children: [
211
+ /* @__PURE__ */ jsx(Pencil, { className: "mr-2 h-4 w-4" }),
212
+ "Edit Board"
213
+ ]
214
+ }
215
+ ),
216
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
217
+ /* @__PURE__ */ jsxs(
218
+ DropdownMenuItem,
219
+ {
220
+ onClick: () => setModalState({ type: "deleteBoard" }),
221
+ className: "text-red-600 focus:text-red-600",
222
+ children: [
223
+ /* @__PURE__ */ jsx(Trash2, { className: "mr-2 h-4 w-4" }),
224
+ "Delete Board"
225
+ ]
226
+ }
227
+ )
228
+ ] })
229
+ ] })
230
+ ] }),
231
+ orderedColumns.length > 0 ? /* @__PURE__ */ jsx(
232
+ KanbanBoard,
233
+ {
234
+ columns: orderedColumns,
235
+ kanbanState,
236
+ onKanbanChange: handleKanbanChange,
237
+ onAddTask: (columnId) => setModalState({ type: "addTask", columnId }),
238
+ onEditTask: (columnId, taskId) => setModalState({ type: "editTask", columnId, taskId }),
239
+ onEditColumn: (columnId) => setModalState({ type: "editColumn", columnId }),
240
+ onDeleteColumn: (columnId) => setModalState({ type: "deleteColumn", columnId })
241
+ }
242
+ ) : /* @__PURE__ */ jsx(
243
+ EmptyState,
244
+ {
245
+ title: "No columns yet",
246
+ description: "Create your first column to start organizing tasks.",
247
+ action: /* @__PURE__ */ jsxs(Button, { onClick: () => setModalState({ type: "addColumn" }), children: [
248
+ /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
249
+ "Add Column"
250
+ ] })
251
+ }
252
+ ),
253
+ /* @__PURE__ */ jsx(
254
+ Dialog,
255
+ {
256
+ open: modalState.type === "addColumn",
257
+ onOpenChange: (open) => !open && closeModal(),
258
+ children: /* @__PURE__ */ jsxs(DialogContent, { children: [
259
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
260
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Add Column" }),
261
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Add a new column to this board." })
262
+ ] }),
263
+ /* @__PURE__ */ jsx(
264
+ ColumnForm,
265
+ {
266
+ boardId,
267
+ onClose: closeModal,
268
+ onSuccess: () => {
269
+ closeModal();
270
+ refetch();
271
+ }
272
+ }
273
+ )
274
+ ] })
275
+ }
276
+ ),
277
+ /* @__PURE__ */ jsx(
278
+ Dialog,
279
+ {
280
+ open: modalState.type === "editColumn",
281
+ onOpenChange: (open) => !open && closeModal(),
282
+ children: /* @__PURE__ */ jsxs(DialogContent, { children: [
283
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
284
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Edit Column" }),
285
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Update the column details." })
286
+ ] }),
287
+ modalState.type === "editColumn" && /* @__PURE__ */ jsx(
288
+ ColumnForm,
289
+ {
290
+ boardId,
291
+ columnId: modalState.columnId,
292
+ column: board.columns?.find((c) => c.id === modalState.columnId),
293
+ onClose: closeModal,
294
+ onSuccess: () => {
295
+ closeModal();
296
+ refetch();
297
+ }
298
+ }
299
+ )
300
+ ] })
301
+ }
302
+ ),
303
+ /* @__PURE__ */ jsx(
304
+ AlertDialog,
305
+ {
306
+ open: modalState.type === "deleteColumn",
307
+ onOpenChange: (open) => !open && closeModal(),
308
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
309
+ /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
310
+ /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete Column" }),
311
+ /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Are you sure you want to delete this column? All tasks in this column will be permanently removed." })
312
+ ] }),
313
+ /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
314
+ /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Cancel" }),
315
+ /* @__PURE__ */ jsx(
316
+ AlertDialogAction,
317
+ {
318
+ onClick: async () => {
319
+ if (modalState.type === "deleteColumn") {
320
+ try {
321
+ await deleteColumn(modalState.columnId);
322
+ closeModal();
323
+ refetch();
324
+ } catch (error2) {
325
+ const message = error2 instanceof Error ? error2.message : "Failed to delete column";
326
+ toast.error(message);
327
+ }
328
+ }
329
+ },
330
+ className: "bg-red-600 hover:bg-red-700",
331
+ children: "Delete"
332
+ }
333
+ )
334
+ ] })
335
+ ] })
336
+ }
337
+ ),
338
+ /* @__PURE__ */ jsx(
339
+ Dialog,
340
+ {
341
+ open: modalState.type === "editBoard",
342
+ onOpenChange: (open) => !open && closeModal(),
343
+ children: /* @__PURE__ */ jsxs(DialogContent, { children: [
344
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
345
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Edit Board" }),
346
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Update board details." })
347
+ ] }),
348
+ /* @__PURE__ */ jsx(
349
+ BoardForm,
350
+ {
351
+ board,
352
+ onClose: closeModal,
353
+ onSuccess: () => {
354
+ closeModal();
355
+ refetch();
356
+ }
357
+ }
358
+ )
359
+ ] })
360
+ }
361
+ ),
362
+ /* @__PURE__ */ jsx(
363
+ AlertDialog,
364
+ {
365
+ open: modalState.type === "deleteBoard",
366
+ onOpenChange: (open) => !open && closeModal(),
367
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
368
+ /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
369
+ /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete Board" }),
370
+ /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Are you sure you want to delete this board? This action cannot be undone. All columns and tasks will be permanently removed." })
371
+ ] }),
372
+ /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
373
+ /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Cancel" }),
374
+ /* @__PURE__ */ jsx(
375
+ Button,
376
+ {
377
+ onClick: handleDeleteBoard,
378
+ disabled: isDeleting,
379
+ className: "bg-red-600 hover:bg-red-700",
380
+ children: isDeleting ? "Deleting..." : "Delete"
381
+ }
382
+ )
383
+ ] })
384
+ ] })
385
+ }
386
+ ),
387
+ /* @__PURE__ */ jsx(
388
+ Dialog,
389
+ {
390
+ open: modalState.type === "addTask",
391
+ onOpenChange: (open) => !open && closeModal(),
392
+ children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-3xl! max-h-screen overflow-y-auto", children: [
393
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
394
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Add Task" }),
395
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Create a new task." })
396
+ ] }),
397
+ modalState.type === "addTask" && /* @__PURE__ */ jsx(
398
+ TaskForm,
399
+ {
400
+ columnId: modalState.columnId,
401
+ boardId,
402
+ columns: board.columns || [],
403
+ onClose: closeModal,
404
+ onSuccess: () => {
405
+ closeModal();
406
+ refetch();
407
+ }
408
+ }
409
+ )
410
+ ] })
411
+ }
412
+ ),
413
+ /* @__PURE__ */ jsx(
414
+ Dialog,
415
+ {
416
+ open: modalState.type === "editTask",
417
+ onOpenChange: (open) => !open && closeModal(),
418
+ children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-3xl! max-h-screen overflow-y-auto", children: [
419
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
420
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Edit Task" }),
421
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Update task details." })
422
+ ] }),
423
+ modalState.type === "editTask" && /* @__PURE__ */ jsx(
424
+ TaskForm,
425
+ {
426
+ columnId: modalState.columnId,
427
+ boardId,
428
+ taskId: modalState.taskId,
429
+ task: board.columns?.find((c) => c.id === modalState.columnId)?.tasks?.find((t) => t.id === modalState.taskId),
430
+ columns: board.columns || [],
431
+ onClose: closeModal,
432
+ onSuccess: () => {
433
+ closeModal();
434
+ refetch();
435
+ },
436
+ onDelete: async () => {
437
+ try {
438
+ await deleteTask(modalState.taskId);
439
+ closeModal();
440
+ refetch();
441
+ } catch (error2) {
442
+ const message = error2 instanceof Error ? error2.message : "Failed to delete task";
443
+ toast.error(message);
444
+ }
445
+ }
446
+ }
447
+ )
448
+ ] })
449
+ }
450
+ )
451
+ ]
452
+ }
453
+ );
454
+ }
455
+
456
+ export { BoardPage };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { lazy } from 'react';
4
+ import { ComposedRoute } from '@btst/stack/client/components';
5
+ import { DefaultError } from '../shared/default-error.mjs';
6
+ import { BoardSkeleton } from '../loading/board-skeleton.mjs';
7
+ import { NotFoundPage } from './404-page.mjs';
8
+
9
+ const BoardPage = lazy(
10
+ () => import('./board-page.internal.mjs').then((m) => ({
11
+ default: m.BoardPage
12
+ }))
13
+ );
14
+ function BoardPageComponent({ boardId }) {
15
+ return /* @__PURE__ */ jsx(
16
+ ComposedRoute,
17
+ {
18
+ path: `/kanban/${boardId}`,
19
+ PageComponent: BoardPage,
20
+ ErrorComponent: DefaultError,
21
+ LoadingComponent: BoardSkeleton,
22
+ NotFoundComponent: NotFoundPage,
23
+ props: { boardId },
24
+ onError: (error) => console.error("BoardPage error:", error)
25
+ }
26
+ );
27
+ }
28
+
29
+ export { BoardPageComponent };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const React = require('react');
6
+ const components = require('@btst/stack/client/components');
7
+ const defaultError = require('../shared/default-error.cjs');
8
+ const boardsListSkeleton = require('../loading/boards-list-skeleton.cjs');
9
+ const _404Page = require('./404-page.cjs');
10
+
11
+ const BoardsListPage = React.lazy(
12
+ () => import('./boards-list-page.internal.cjs').then((m) => ({
13
+ default: m.BoardsListPage
14
+ }))
15
+ );
16
+ function BoardsListPageComponent() {
17
+ return /* @__PURE__ */ jsxRuntime.jsx(
18
+ components.ComposedRoute,
19
+ {
20
+ path: "/kanban",
21
+ PageComponent: BoardsListPage,
22
+ ErrorComponent: defaultError.DefaultError,
23
+ LoadingComponent: boardsListSkeleton.BoardsListSkeleton,
24
+ NotFoundComponent: _404Page.NotFoundPage,
25
+ onError: (error) => console.error("BoardsListPage error:", error)
26
+ }
27
+ );
28
+ }
29
+
30
+ exports.BoardsListPageComponent = BoardsListPageComponent;
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const LucideIcons = require('lucide-react');
6
+ const button = require('../../../../../../../ui/src/components/button.cjs');
7
+ const card = require('../../../../../../../ui/src/components/card.cjs');
8
+ const kanbanHooks = require('../../hooks/kanban-hooks.cjs');
9
+ const context = require('@btst/stack/context');
10
+ const emptyState = require('../shared/empty-state.cjs');
11
+ const pageWrapper = require('../shared/page-wrapper.cjs');
12
+ const dateFns = require('date-fns');
13
+
14
+ function BoardsListPage() {
15
+ const { data: boards, error, isFetching } = kanbanHooks.useSuspenseBoards();
16
+ if (error && !isFetching) {
17
+ throw error;
18
+ }
19
+ const { Link: OverrideLink, navigate: overrideNavigate } = context.usePluginOverrides("kanban");
20
+ const Link = OverrideLink || "a";
21
+ const navigate = overrideNavigate || ((path) => {
22
+ window.location.href = path;
23
+ });
24
+ const handleNewBoard = () => {
25
+ navigate("/pages/kanban/new");
26
+ };
27
+ return /* @__PURE__ */ jsxRuntime.jsxs(pageWrapper.PageWrapper, { "data-testid": "boards-list-page", children: [
28
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex items-center justify-between mb-8", children: [
29
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
30
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold", "data-testid": "page-header", children: "Kanban Boards" }),
31
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1", children: "Manage your projects and tasks" })
32
+ ] }),
33
+ /* @__PURE__ */ jsxRuntime.jsxs(button.Button, { onClick: handleNewBoard, children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.Plus, { className: "mr-2 h-4 w-4" }),
35
+ "New Board"
36
+ ] })
37
+ ] }),
38
+ boards.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: boards.map((board) => /* @__PURE__ */ jsxRuntime.jsx(
39
+ Link,
40
+ {
41
+ href: `/pages/kanban/${board.id}`,
42
+ className: "block group",
43
+ children: /* @__PURE__ */ jsxRuntime.jsxs(card.Card, { className: "h-full transition-shadow hover:shadow-md cursor-pointer", children: [
44
+ /* @__PURE__ */ jsxRuntime.jsxs(card.CardHeader, { children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx(card.CardTitle, { className: "group-hover:text-primary transition-colors", children: board.name }),
46
+ board.description && /* @__PURE__ */ jsxRuntime.jsx(card.CardDescription, { className: "line-clamp-2", children: board.description })
47
+ ] }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(card.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [
49
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
50
+ board.columns?.length || 0,
51
+ " columns"
52
+ ] }),
53
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: dateFns.format(new Date(board.createdAt), "MMM d, yyyy") })
54
+ ] }) })
55
+ ] })
56
+ },
57
+ board.id
58
+ )) }) : /* @__PURE__ */ jsxRuntime.jsx(
59
+ emptyState.EmptyState,
60
+ {
61
+ title: "No boards yet",
62
+ description: "Create your first kanban board to start organizing your tasks.",
63
+ action: /* @__PURE__ */ jsxRuntime.jsxs(button.Button, { onClick: handleNewBoard, children: [
64
+ /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.Plus, { className: "mr-2 h-4 w-4" }),
65
+ "Create Board"
66
+ ] })
67
+ }
68
+ )
69
+ ] });
70
+ }
71
+
72
+ exports.BoardsListPage = BoardsListPage;
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { Plus } from 'lucide-react';
4
+ import { Button } from '../../../../../../../ui/src/components/button.mjs';
5
+ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '../../../../../../../ui/src/components/card.mjs';
6
+ import { useSuspenseBoards } from '../../hooks/kanban-hooks.mjs';
7
+ import { usePluginOverrides } from '@btst/stack/context';
8
+ import { EmptyState } from '../shared/empty-state.mjs';
9
+ import { PageWrapper } from '../shared/page-wrapper.mjs';
10
+ import { format } from 'date-fns';
11
+
12
+ function BoardsListPage() {
13
+ const { data: boards, error, isFetching } = useSuspenseBoards();
14
+ if (error && !isFetching) {
15
+ throw error;
16
+ }
17
+ const { Link: OverrideLink, navigate: overrideNavigate } = usePluginOverrides("kanban");
18
+ const Link = OverrideLink || "a";
19
+ const navigate = overrideNavigate || ((path) => {
20
+ window.location.href = path;
21
+ });
22
+ const handleNewBoard = () => {
23
+ navigate("/pages/kanban/new");
24
+ };
25
+ return /* @__PURE__ */ jsxs(PageWrapper, { "data-testid": "boards-list-page", children: [
26
+ /* @__PURE__ */ jsxs("div", { className: "w-full flex items-center justify-between mb-8", children: [
27
+ /* @__PURE__ */ jsxs("div", { children: [
28
+ /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold", "data-testid": "page-header", children: "Kanban Boards" }),
29
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children: "Manage your projects and tasks" })
30
+ ] }),
31
+ /* @__PURE__ */ jsxs(Button, { onClick: handleNewBoard, children: [
32
+ /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
33
+ "New Board"
34
+ ] })
35
+ ] }),
36
+ boards.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: boards.map((board) => /* @__PURE__ */ jsx(
37
+ Link,
38
+ {
39
+ href: `/pages/kanban/${board.id}`,
40
+ className: "block group",
41
+ children: /* @__PURE__ */ jsxs(Card, { className: "h-full transition-shadow hover:shadow-md cursor-pointer", children: [
42
+ /* @__PURE__ */ jsxs(CardHeader, { children: [
43
+ /* @__PURE__ */ jsx(CardTitle, { className: "group-hover:text-primary transition-colors", children: board.name }),
44
+ board.description && /* @__PURE__ */ jsx(CardDescription, { className: "line-clamp-2", children: board.description })
45
+ ] }),
46
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [
47
+ /* @__PURE__ */ jsxs("span", { children: [
48
+ board.columns?.length || 0,
49
+ " columns"
50
+ ] }),
51
+ /* @__PURE__ */ jsx("span", { children: format(new Date(board.createdAt), "MMM d, yyyy") })
52
+ ] }) })
53
+ ] })
54
+ },
55
+ board.id
56
+ )) }) : /* @__PURE__ */ jsx(
57
+ EmptyState,
58
+ {
59
+ title: "No boards yet",
60
+ description: "Create your first kanban board to start organizing your tasks.",
61
+ action: /* @__PURE__ */ jsxs(Button, { onClick: handleNewBoard, children: [
62
+ /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
63
+ "Create Board"
64
+ ] })
65
+ }
66
+ )
67
+ ] });
68
+ }
69
+
70
+ export { BoardsListPage };