@@ -35,6 +35,7 @@ import {
35
35
isDupName ,
36
36
saveTreeData ,
37
37
} from "./mainPageSettingsUtils" ;
38
+ import { DragHandle } from "@mui/icons-material" ;
38
39
39
40
function validRegex ( value : string ) {
40
41
try {
@@ -62,7 +63,7 @@ function EditSectionDialog({
62
63
63
64
return (
64
65
< >
65
- < Button onClick = { ( ) => setOpen ( true ) } > Edit</ Button >
66
+ < Button onClick = { ( ) => { setOpen ( true ) } } > Edit</ Button >
66
67
< Dialog
67
68
open = { open }
68
69
closeAfterTransition = { false }
@@ -141,9 +142,6 @@ export default function SettingsModal({
141
142
142
143
const sensors = useSensors (
143
144
useSensor ( PointerSensor ) ,
144
- useSensor ( KeyboardSensor , {
145
- coordinateGetter : sortableKeyboardCoordinates ,
146
- } )
147
145
) ;
148
146
149
147
function addSection ( ) {
@@ -194,21 +192,16 @@ export default function SettingsModal({
194
192
} ;
195
193
196
194
return (
197
- < ListItem
198
- ref = { setNodeRef }
199
- style = { style }
200
- { ...attributes }
201
- { ...listeners }
202
- id = { data . name }
203
- >
195
+ < ListItem ref = { setNodeRef } style = { style } id = { data . name } >
204
196
< ListItemButton >
205
197
< Stack
206
198
direction = "row"
207
199
alignItems = "center"
208
200
justifyContent = "space-between"
209
201
flexGrow = { 1 }
210
202
>
211
- < Stack >
203
+ < Stack direction = "row" alignItems = { "center" } spacing = { 2 } >
204
+ < DragHandle { ...attributes } { ...listeners } />
212
205
< Typography style = { { fontWeight : "bold" } } >
213
206
{ data . name }
214
207
</ Typography >
@@ -220,15 +213,19 @@ export default function SettingsModal({
220
213
name = { data . name }
221
214
setGroup = { setItem }
222
215
/>
223
- < Button onClick = { ( e ) => removeSection ( data . name ) } > Delete</ Button >
216
+ < Button onClick = { ( ) => removeSection ( data . name ) } > Delete</ Button >
224
217
</ Stack >
225
218
</ Stack >
226
219
</ ListItemButton >
227
220
</ ListItem >
228
221
) ;
229
222
} ) ;
223
+
230
224
function handleDragEnd ( event : any ) {
231
225
const { active, over } = event ;
226
+ if ( active == null || over == null ) {
227
+ return ;
228
+ }
232
229
const priority =
233
230
orderBy === "display" ? "displayPriority" : "filterPriority" ;
234
231
const oldIndex = treeData . find ( ( node ) => node . name === active . id ) ! [
@@ -279,7 +276,6 @@ export default function SettingsModal({
279
276
maxWidth = "xl"
280
277
onClose = { handleClose }
281
278
onClick = { ( e ) => e . stopPropagation ( ) }
282
- style = { { zIndex : 400000 } }
283
279
>
284
280
< Stack
285
281
spacing = { 2 }
@@ -329,7 +325,7 @@ export default function SettingsModal({
329
325
strategy = { verticalListSortingStrategy }
330
326
>
331
327
{ treeDataOrdered . map ( ( id ) => (
332
- < Node key = { id . name } data = { id } />
328
+ < Node key = { id . name } data = { id } />
333
329
) ) }
334
330
</ SortableContext >
335
331
</ DndContext >
0 commit comments