feat: reordering tweets now works in frontend

This commit is contained in:
overflowerror 2021-08-22 17:09:33 +02:00
parent 974d1c4c2d
commit 1eedd5e609

View file

@ -80,10 +80,19 @@ const Index: FunctionComponent<ThreadFormProps> = (
}}
/>
</Grid>
<DragDropContext onDragEnd={() => {
<DragDropContext onDragEnd={(result) => {
if (!result.destination) {
return
}
const tweet = thread.tweets.splice(result.source.index, 1)
thread.tweets.splice(result.destination!.index, 0, ...tweet)
setThread({
...thread
})
}}>
<Droppable droppableId={"1"}>
{(provided, snapshot) => (
{(provided) => (
<Grid
container
item