diff --git a/.vscode/settings.json b/.vscode/settings.json
index b7e02b5..497ca10 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -5,6 +5,6 @@
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
- "typescript.tsdk": ".yarn/sdks/typescript/lib",
+ "typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
diff --git a/.yarnrc.yml b/.yarnrc.yml
deleted file mode 100644
index e65419a..0000000
--- a/.yarnrc.yml
+++ /dev/null
@@ -1 +0,0 @@
-yarnPath: .yarn/releases/yarn-4.1.1.cjs
diff --git a/README.md b/README.md
index a0c1be2..856f525 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ The following changes are already implemented:
* [Fix required fields check on Bulk registration CSV upload](https://github.com/etkecc/synapse-admin/pull/32)
* [Fix requests with invalid MXIDs on Bulk registration](https://github.com/etkecc/synapse-admin/pull/33)
* [Expose user avatar URL field in the UI](https://github.com/etkecc/synapse-admin/pull/27)
+* [Upgrade react-admin to v5](https://github.com/etkecc/synapse-admin/pull/40)
_the list will be updated as new changes are added_
diff --git a/package.json b/package.json
index 06d81b5..371a46d 100644
--- a/package.json
+++ b/package.json
@@ -10,21 +10,20 @@
"type": "git",
"url": "https://github.com/etkecc/synapse-admin"
},
- "packageManager": "yarn@4.1.1",
"devDependencies": {
"@eslint/js": "^9.7.0",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
- "@types/jest": "^29.5.12",
+ "@types/jest": "^29.5.13",
"@types/lodash": "^4.17.7",
"@types/node": "^20.14.12",
"@types/papaparse": "^5.3.14",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
- "@vitejs/plugin-react": "^4.0.0",
+ "@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
@@ -37,11 +36,11 @@
"jest-fetch-mock": "^3.0.3",
"prettier": "^3.3.3",
"react-test-renderer": "^18.3.1",
- "ts-jest": "^29.2.3",
+ "ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.16.1",
- "vite": "^5.3.4",
+ "vite": "^5.4.6",
"vite-plugin-version-mark": "^0.1.0"
},
"dependencies": {
@@ -49,27 +48,26 @@
"@emotion/styled": "^11.13.0",
"@haleos/ra-language-german": "^1.0.0",
"@haxqer/ra-language-chinese": "^4.16.2",
- "@mui/icons-material": "^5.16.4",
- "@mui/material": "^5.16.4",
+ "@mui/icons-material": "^6.1.1",
+ "@mui/material": "^6.1.1",
+ "@tanstack/react-query": "^5.56.2",
"history": "^5.3.0",
"lodash": "^4.17.21",
"papaparse": "^5.4.1",
- "query-string": "^7.1.3",
- "ra-core": "^4.16.20",
- "ra-i18n-polyglot": "^4.16.20",
- "ra-language-english": "^4.16.20",
- "ra-language-farsi": "^4.2.0",
- "ra-language-french": "^4.16.20",
+ "ra-core": "^5.2.0",
+ "ra-i18n-polyglot": "^5.2.0",
+ "ra-language-english": "^5.2.0",
+ "ra-language-farsi": "^5.0.0",
+ "ra-language-french": "^5.2.0",
"ra-language-italian": "^3.13.1",
"ra-language-russian": "^4.14.2",
"react": "^18.3.1",
- "react-admin": "^4.16.20",
+ "react-admin": "^5.2.0",
"react-dom": "^18.3.1",
- "react-hook-form": "^7.52.1",
+ "react-hook-form": "^7.53.0",
"react-is": "^18.3.1",
- "react-query": "^3.39.3",
- "react-router": "^6.25.1",
- "react-router-dom": "^6.25.1"
+ "react-router": "^6.26.2",
+ "react-router-dom": "^6.26.2"
},
"scripts": {
"start": "vite serve",
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 3a82f7a..3da4e42 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,4 +1,6 @@
-import { render, screen } from "@testing-library/react";
+import { render, screen, waitFor } from "@testing-library/react";
+import fetchMock from "jest-fetch-mock";
+fetchMock.enableMocks();
import App from "./App";
@@ -7,4 +9,4 @@ describe("App", () => {
render();
await screen.findAllByText("Welcome to Synapse-admin");
});
-});
+});
\ No newline at end of file
diff --git a/src/App.tsx b/src/App.tsx
index 91bfc12..5e01fec 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -53,7 +53,6 @@ const App = () => (
authProvider={authProvider}
dataProvider={dataProvider}
i18nProvider={i18nProvider}
- darkTheme={{ palette: { mode: "dark" } }}
>
} />
diff --git a/src/components/DeleteRoomButton.tsx b/src/components/DeleteRoomButton.tsx
index e21c2f2..83a9a72 100644
--- a/src/components/DeleteRoomButton.tsx
+++ b/src/components/DeleteRoomButton.tsx
@@ -74,7 +74,6 @@ const DeleteRoomButton: React.FC = (props) => {
{translate(props.confirmContent)}
) => setBlock(event.target.checked)}
diff --git a/src/components/ServerNotices.tsx b/src/components/ServerNotices.tsx
index f269a7f..a929835 100644
--- a/src/components/ServerNotices.tsx
+++ b/src/components/ServerNotices.tsx
@@ -20,7 +20,7 @@ import {
useTranslate,
useUnselectAll,
} from "react-admin";
-import { useMutation } from "react-query";
+import { useMutation } from "@tanstack/react-query";
const ServerNoticeDialog = ({ open, onClose, onSubmit }) => {
const translate = useTranslate();
@@ -43,7 +43,6 @@ const ServerNoticeDialog = ({ open, onClose, onSubmit }) => {
{
const handleDialogOpen = () => setOpen(true);
const handleDialogClose = () => setOpen(false);
+ if (!record) {
+ return null;
+ }
+
const handleSend = (values: Partial) => {
create(
"servernotices",
@@ -100,28 +103,26 @@ export const ServerNoticeBulkButton = () => {
const unselectAllUsers = useUnselectAll("users");
const dataProvider = useDataProvider();
- const { mutate: sendNotices, isLoading } = useMutation(
- data =>
+ const { mutate: sendNotices, isPending } = useMutation({
+ mutationFn: (data) =>
dataProvider.createMany("servernotices", {
ids: selectedIds,
data: data,
}),
- {
- onSuccess: () => {
- notify("resources.servernotices.action.send_success");
- unselectAllUsers();
- closeDialog();
- },
- onError: () =>
- notify("resources.servernotices.action.send_failure", {
- type: "error",
- }),
- }
- );
+ onSuccess: () => {
+ notify("resources.servernotices.action.send_success");
+ unselectAllUsers();
+ closeDialog();
+ },
+ onError: () =>
+ notify("resources.servernotices.action.send_failure", {
+ type: "error",
+ }),
+ });
return (
<>
-