diff --git a/packages/desktop-client/package.json b/packages/desktop-client/package.json
index 9f6d03494b1..b56f38147aa 100644
--- a/packages/desktop-client/package.json
+++ b/packages/desktop-client/package.json
@@ -6,6 +6,10 @@
"build"
],
"devDependencies": {
+ "@dnd-kit/core": "^6.1.0",
+ "@dnd-kit/modifiers": "^7.0.0",
+ "@dnd-kit/sortable": "^8.0.0",
+ "@dnd-kit/utilities": "^3.2.2",
"@juggle/resize-observer": "^3.1.2",
"@playwright/test": "^1.41.1",
"@reach/listbox": "^0.18.0",
@@ -45,8 +49,6 @@
"memoize-one": "^6.0.0",
"pikaday": "1.8.2",
"react": "18.2.0",
- "react-dnd": "^16.0.1",
- "react-dnd-html5-backend": "^16.0.1",
"react-dom": "18.2.0",
"react-error-boundary": "^4.0.11",
"react-markdown": "^8.0.7",
diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsx
index 29c241a14da..3cbd1c51907 100644
--- a/packages/desktop-client/src/components/FinancesApp.tsx
+++ b/packages/desktop-client/src/components/FinancesApp.tsx
@@ -1,7 +1,5 @@
// @ts-strict-ignore
import React, { type ReactElement, useEffect, useMemo } from 'react';
-import { DndProvider } from 'react-dnd';
-import { HTML5Backend as Backend } from 'react-dnd-html5-backend';
import {
Route,
Routes,
@@ -267,9 +265,7 @@ export function FinancesApp() {
-
- {app}
-
+ {app}
diff --git a/packages/desktop-client/src/components/accounts/MobileAccounts.jsx b/packages/desktop-client/src/components/accounts/MobileAccounts.jsx
index 158dbec52fa..fb1a4173868 100644
--- a/packages/desktop-client/src/components/accounts/MobileAccounts.jsx
+++ b/packages/desktop-client/src/components/accounts/MobileAccounts.jsx
@@ -1,7 +1,27 @@
import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
+import {
+ DndContext,
+ MouseSensor,
+ TouchSensor,
+ closestCenter,
+ useSensor,
+ useSensors,
+} from '@dnd-kit/core';
+import {
+ restrictToParentElement,
+ restrictToVerticalAxis,
+} from '@dnd-kit/modifiers';
+import {
+ SortableContext,
+ useSortable,
+ verticalListSortingStrategy,
+} from '@dnd-kit/sortable';
+import { CSS } from '@dnd-kit/utilities';
+
import * as queries from 'loot-core/src/client/queries';
+import { send } from 'loot-core/src/platform/client/fetch';
import { useActions } from '../../hooks/useActions';
import { useCategories } from '../../hooks/useCategories';
@@ -16,6 +36,7 @@ import { View } from '../common/View';
import { Page } from '../Page';
import { PullToRefresh } from '../responsive/PullToRefresh';
import { CellValue } from '../spreadsheet/CellValue';
+import { findSortDown, getDropPosition } from '../util/sort';
function AccountHeader({ name, amount, style = {} }) {
return (
@@ -52,8 +73,26 @@ function AccountHeader({ name, amount, style = {} }) {
}
function AccountCard({ account, updated, getBalanceQuery, onSelect }) {
+ const {
+ isDragging,
+ attributes,
+ listeners,
+ setNodeRef,
+ transform,
+ transition,
+ } = useSortable({ id: account.id });
+
+ const dndStyle = {
+ opacity: isDragging ? 0.5 : undefined,
+ transform: CSS.Transform.toString(transform),
+ transition,
+ };
+
return (