diff --git a/apps/web/package.json b/apps/web/package.json index a241576..12a54fe 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -12,6 +12,7 @@ "test": "vitest run" }, "dependencies": { + "@dnd-kit/dom": "^0.5.0", "@dnd-kit/helpers": "^0.5.0", "@dnd-kit/react": "^0.5.0", "@goforlift/contracts": "workspace:*", diff --git a/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx b/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx index 7b7963e..c8086ba 100644 --- a/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx +++ b/apps/web/src/features/routines/create/editor/routine-exercise-list.tsx @@ -1,4 +1,9 @@ /** Displays configured exercises in the routine draft. */ +import { + KeyboardSensor, + PointerActivationConstraints, + PointerSensor, +} from '@dnd-kit/dom'; import { DragDropProvider } from '@dnd-kit/react'; import { isSortable, useSortable } from '@dnd-kit/react/sortable'; import { Dumbbell, GripVertical, MoreHorizontal } from 'lucide-react'; @@ -13,6 +18,15 @@ import { import { cn } from '@/lib/utils'; import type { RoutineDraftExerciseFormValues } from '../routine-draft-form'; +const reorderSensors = [ + PointerSensor.configure({ + activationConstraints: [ + new PointerActivationConstraints.Distance({ value: 4 }), + ], + }), + KeyboardSensor, +]; + export function RoutineExerciseList({ exercises, onEdit, @@ -51,6 +65,7 @@ export function RoutineExerciseList({ onReorder(source.initialIndex, source.index); } }} + sensors={reorderSensors} >