(event: React.DragEvent)
| 114 | } |
| 115 | |
| 116 | const onDrop = (event: React.DragEvent) => { |
| 117 | const node = event.currentTarget; |
| 118 | const from = currentId; |
| 119 | const to = node.getAttribute('data-id'); |
| 120 | const row = event.currentTarget.closest('tr'); |
| 121 | if (row) { |
| 122 | row.classList.remove(styles.highlighted); |
| 123 | } |
| 124 | setChannels((channels: SerializedChannel[]) => { |
| 125 | const reorderedChannels = reorderChannels(channels, from, to); |
| 126 | debouncedReorderChannels({ |
| 127 | accountId: currentCommunity.id, |
| 128 | channels: reorderedChannels.map(({ id, displayOrder }) => { |
| 129 | return { id, displayOrder }; |
| 130 | }), |
| 131 | }); |
| 132 | return reorderedChannels; |
| 133 | }); |
| 134 | |
| 135 | setUserChannels(from, to); |
| 136 | setCurrentId(''); |
| 137 | }; |
| 138 | |
| 139 | function reorderChannels( |
| 140 | channels: SerializedChannel[], |
no test coverage detected