MCPcopy Create free account
hub / github.com/EsperoTech/yaade / drop

Function drop

client/src/components/collectionView/MoveableScript.tsx:143–166  ·  view source on GitHub ↗
(item: ScriptDragItem)

Source from the content-addressed store, hash-verified

141 };
142 },
143 drop(item: ScriptDragItem) {
144 let newRank: number;
145 if (isTopHovered) {
146 newRank = calculateTopHoveredRank(
147 index,
148 item.index,
149 script.collectionId,
150 item.collectionId,
151 );
152 } else if (isBottomHovered) {
153 newRank = calculateBottomHoveredRank(
154 index,
155 item.index,
156 script.collectionId,
157 item.collectionId,
158 );
159 } else {
160 return;
161 }
162 if (item.index === newRank && item.collectionId === script.collectionId) {
163 return;
164 }
165 moveScript(item.id, newRank, script.collectionId);
166 },
167 });
168
169 const [{ isDragging }, drag] = useDrag({

Callers 1

MoveableScriptFunction · 0.70

Calls 3

calculateTopHoveredRankFunction · 0.70
moveScriptFunction · 0.50

Tested by

no test coverage detected