@emberai-engg/task-board 0.3.4 → 0.3.6
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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -297,6 +297,7 @@ function useTaskBoard(isDragging) {
|
|
|
297
297
|
tasks,
|
|
298
298
|
setTasks,
|
|
299
299
|
columnTotals,
|
|
300
|
+
setColumnTotals,
|
|
300
301
|
columnUnreads,
|
|
301
302
|
setColumnUnreads,
|
|
302
303
|
boardLoading,
|
|
@@ -312,7 +313,7 @@ function useTaskBoard(isDragging) {
|
|
|
312
313
|
|
|
313
314
|
// src/hooks/useTaskActions.ts
|
|
314
315
|
import { useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
315
|
-
function useTaskActions(tasks, setTasks, fetchTasks, isDragging) {
|
|
316
|
+
function useTaskActions(tasks, setTasks, fetchTasks, isDragging, setColumnTotals) {
|
|
316
317
|
const { service, config } = useTaskBoardContext();
|
|
317
318
|
const internalDragging = useRef2(false);
|
|
318
319
|
const draggingRef = isDragging ?? internalDragging;
|
|
@@ -366,6 +367,13 @@ function useTaskActions(tasks, setTasks, fetchTasks, isDragging) {
|
|
|
366
367
|
}
|
|
367
368
|
return newTasks;
|
|
368
369
|
});
|
|
370
|
+
if (sourceStatus !== destStatus && setColumnTotals) {
|
|
371
|
+
setColumnTotals((prev) => ({
|
|
372
|
+
...prev,
|
|
373
|
+
[sourceStatus]: Math.max(0, (prev[sourceStatus] || 0) - 1),
|
|
374
|
+
[destStatus]: (prev[destStatus] || 0) + 1
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
369
377
|
try {
|
|
370
378
|
await service.updateTask(taskId, { status: destStatus, position: newPosition });
|
|
371
379
|
} catch {
|
|
@@ -373,7 +381,7 @@ function useTaskActions(tasks, setTasks, fetchTasks, isDragging) {
|
|
|
373
381
|
} finally {
|
|
374
382
|
draggingRef.current = false;
|
|
375
383
|
}
|
|
376
|
-
}, [setTasks, service, fetchTasks]);
|
|
384
|
+
}, [setTasks, setColumnTotals, service, fetchTasks]);
|
|
377
385
|
return { createTask, updateTask, deleteTask, markTaskRead, moveTask };
|
|
378
386
|
}
|
|
379
387
|
|
|
@@ -466,11 +474,15 @@ function formatDateTime(dateStr) {
|
|
|
466
474
|
minute: "2-digit"
|
|
467
475
|
});
|
|
468
476
|
}
|
|
477
|
+
function stripMentionMarkup(text) {
|
|
478
|
+
return text.replace(/@\[(.*?)\]\(.*?\)/g, "@$1");
|
|
479
|
+
}
|
|
469
480
|
function getDescriptionPreview(desc) {
|
|
470
481
|
if (!desc) return "";
|
|
471
|
-
if (typeof desc === "string") return desc;
|
|
482
|
+
if (typeof desc === "string") return stripMentionMarkup(desc);
|
|
472
483
|
for (const section of DESCRIPTION_SECTIONS) {
|
|
473
|
-
|
|
484
|
+
const val = desc[section.key]?.trim();
|
|
485
|
+
if (val) return stripMentionMarkup(val);
|
|
474
486
|
}
|
|
475
487
|
return "";
|
|
476
488
|
}
|
|
@@ -615,18 +627,20 @@ var TaskCard = memo(function TaskCard2({ task, index, onClick, onShare, copied }
|
|
|
615
627
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
616
628
|
function LoadMoreSentinel({ loading, onLoadMore, remaining }) {
|
|
617
629
|
const sentinelRef = useRef3(null);
|
|
630
|
+
const onLoadMoreRef = useRef3(onLoadMore);
|
|
631
|
+
onLoadMoreRef.current = onLoadMore;
|
|
618
632
|
useEffect2(() => {
|
|
619
633
|
const el = sentinelRef.current;
|
|
620
634
|
if (!el) return;
|
|
621
635
|
const observer = new IntersectionObserver(
|
|
622
636
|
([entry]) => {
|
|
623
|
-
if (entry.isIntersecting && !loading)
|
|
637
|
+
if (entry.isIntersecting && !loading) onLoadMoreRef.current();
|
|
624
638
|
},
|
|
625
639
|
{ threshold: 0.1 }
|
|
626
640
|
);
|
|
627
641
|
observer.observe(el);
|
|
628
642
|
return () => observer.disconnect();
|
|
629
|
-
}, [loading
|
|
643
|
+
}, [loading]);
|
|
630
644
|
const skeletonCount = loading ? Math.min(remaining, 10) : 0;
|
|
631
645
|
return /* @__PURE__ */ jsx8("div", { ref: sentinelRef, className: "space-y-2 pt-2", children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx8(SkeletonCard, {}, i)) });
|
|
632
646
|
}
|
|
@@ -2021,7 +2035,7 @@ function TaskBoard({
|
|
|
2021
2035
|
const { columns, features, service } = useTaskBoardContext();
|
|
2022
2036
|
const isDraggingRef = useRef8(false);
|
|
2023
2037
|
const board = useTaskBoard(isDraggingRef);
|
|
2024
|
-
const actions = useTaskActions(board.tasks, board.setTasks, board.fetchTasks, isDraggingRef);
|
|
2038
|
+
const actions = useTaskActions(board.tasks, board.setTasks, board.fetchTasks, isDraggingRef, board.setColumnTotals);
|
|
2025
2039
|
const { copiedTaskId, copyShareLink } = useShareLink();
|
|
2026
2040
|
const [selectedTask, setSelectedTask] = useState9(null);
|
|
2027
2041
|
const [createForStatus, setCreateForStatus] = useState9("");
|