(item: ScriptDragItem)
| 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({ |
no test coverage detected