MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / onDrop

Function onDrop

apps/web/ui/ChannelsView/index.tsx:116–137  ·  view source on GitHub ↗
(event: React.DragEvent)

Source from the content-addressed store, hash-verified

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[],

Callers 4

handleDropFunction · 0.50
handleDropFunction · 0.50
handleDropFunction · 0.50
ChatFunction · 0.50

Calls 4

reorderChannelsFunction · 0.85
setUserChannelsFunction · 0.85
mapMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected