MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / moveCardItem

Function moveCardItem

frontend/src/hooks/useCardDragMove.ts:27–44  ·  view source on GitHub ↗
(sourceId: string, targetId: string, newArea = false)

Source from the content-addressed store, hash-verified

25 };
26
27 const moveCardItem = (sourceId: string, targetId: string, newArea = false) => {
28 if (sourceId === targetId) return;
29 if (sourceId) {
30 const checkIndex = getIndexById("", sourceId);
31 let newIndex = getIndexById("", targetId);
32 if (checkIndex != -1) {
33 // Move from layout pool
34 const item = deleteLayoutItem("", sourceId);
35 if (!item) return;
36 if (!newArea) {
37 insertLayoutItem("", item, newIndex);
38 } else {
39 if (checkIndex > newIndex) newIndex += 1;
40 insertLayoutItem("", item, newIndex);
41 }
42 }
43 }
44 };
45
46 const dragover = (e: DragEvent, id: string) => {
47 if (!containerState.isDesignMode) return;

Callers 2

dropFunction · 0.70
dropToNewAreaFunction · 0.70

Calls 3

getIndexByIdFunction · 0.85
deleteLayoutItemFunction · 0.85
insertLayoutItemFunction · 0.85

Tested by

no test coverage detected