Skip to content

Commit e64d174

Browse files
committed
Finish upgrade
1 parent 89d0ed6 commit e64d174

File tree

13 files changed

+1747
-1077
lines changed

13 files changed

+1747
-1077
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@
1111
"url": "https://github.com/etkecc/synapse-admin"
1212
},
1313
"devDependencies": {
14+
"@babel/preset-env": "^7.25.4",
15+
"@babel/preset-react": "^7.24.7",
16+
"@babel/preset-typescript": "^7.24.7",
1417
"@eslint/js": "^9.7.0",
1518
"@testing-library/dom": "^10.0.0",
1619
"@testing-library/jest-dom": "^6.0.0",
1720
"@testing-library/react": "^16.0.0",
1821
"@testing-library/user-event": "^14.5.2",
19-
"@types/jest": "^29.5.12",
22+
"@types/jest": "^29.5.13",
2023
"@types/lodash": "^4.17.7",
2124
"@types/node": "^20.14.12",
2225
"@types/papaparse": "^5.3.14",
2326
"@types/react": "^18.3.3",
2427
"@typescript-eslint/eslint-plugin": "^7.16.1",
2528
"@typescript-eslint/parser": "^7.16.1",
2629
"@vitejs/plugin-react": "^4.3.1",
30+
"babel-jest": "^29.7.0",
2731
"eslint": "^8.57.0",
2832
"eslint-config-prettier": "^9.1.0",
2933
"eslint-plugin-import": "^2.29.1",
@@ -36,7 +40,7 @@
3640
"jest-fetch-mock": "^3.0.3",
3741
"prettier": "^3.3.3",
3842
"react-test-renderer": "^18.3.1",
39-
"ts-jest": "^29.2.3",
43+
"ts-jest": "^29.2.5",
4044
"ts-node": "^10.9.2",
4145
"typescript": "^5.4.5",
4246
"typescript-eslint": "^7.16.1",
@@ -50,10 +54,10 @@
5054
"@haxqer/ra-language-chinese": "^4.16.2",
5155
"@mui/icons-material": "^6.1.1",
5256
"@mui/material": "^6.1.1",
57+
"@tanstack/react-query": "^5.56.2",
5358
"history": "^5.3.0",
5459
"lodash": "^4.17.21",
5560
"papaparse": "^5.4.1",
56-
"query-string": "^9.1.0",
5761
"ra-core": "^5.2.0",
5862
"ra-i18n-polyglot": "^5.2.0",
5963
"ra-language-english": "^5.2.0",
@@ -66,7 +70,6 @@
6670
"react-dom": "^18.3.1",
6771
"react-hook-form": "^7.53.0",
6872
"react-is": "^18.3.1",
69-
"@tanstack/react-query": "^5.56.2",
7073
"react-router": "^6.26.2",
7174
"react-router-dom": "^6.26.2"
7275
},

src/App.test.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
import { render, screen } from "@testing-library/react";
1+
import { render, screen, waitFor } from "@testing-library/react";
2+
import fetchMock from "jest-fetch-mock";
3+
fetchMock.enableMocks();
24

35
import App from "./App";
46

57
describe("App", () => {
68
it("renders", async () => {
79
render(<App />);
810
await screen.findAllByText("Welcome to Synapse-admin");
11+
// await waitFor(() => {
12+
// expect(screen.getByText("Welcome to Synapse-admin")).toBeInTheDocument();
13+
// }, { timeout: 5000 });
914
});
10-
});
15+
});

src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const App = () => (
5353
authProvider={authProvider}
5454
dataProvider={dataProvider}
5555
i18nProvider={i18nProvider}
56-
darkTheme={{ palette: { mode: "dark" } }}
5756
>
5857
<CustomRoutes>
5958
<Route path="/import_users" element={<ImportFeature />} />

src/components/DeleteRoomButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ const DeleteRoomButton: React.FC<DeleteRoomButtonProps> = (props) => {
7474
<DialogContentText>{translate(props.confirmContent)}</DialogContentText>
7575
<SimpleForm toolbar={false}>
7676
<BooleanInput
77-
fullWidth
7877
source="block"
7978
value={block}
8079
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setBlock(event.target.checked)}

src/components/ServerNotices.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const ServerNoticeDialog = ({ open, onClose, onSubmit }) => {
4343
<TextInput
4444
source="body"
4545
label="resources.servernotices.fields.body"
46-
fullWidth
4746
multiline
4847
rows="4"
4948
resettable

src/components/media.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,19 @@ const DeleteMediaDialog = ({ open, onClose, onSubmit }) => {
5555
<DialogContentText>{translate("delete_media.helper.send")}</DialogContentText>
5656
<SimpleForm toolbar={<DeleteMediaToolbar />} onSubmit={onSubmit}>
5757
<DateTimeInput
58-
fullWidth
5958
source="before_ts"
6059
label="delete_media.fields.before_ts"
6160
defaultValue={0}
6261
parse={dateParser}
6362
/>
6463
<NumberInput
65-
fullWidth
6664
source="size_gt"
6765
label="delete_media.fields.size_gt"
6866
defaultValue={0}
6967
min={0}
7068
step={1024}
7169
/>
7270
<BooleanInput
73-
fullWidth
7471
source="keep_profiles"
7572
label="delete_media.fields.keep_profiles"
7673
defaultValue={true}

src/pages/LoginPage.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ const LoginPage = () => {
222222
disabled={loading || !supportPassAuth}
223223
onBlur={handleUsernameChange}
224224
resettable
225-
fullWidth
226225
validate={required()}
227226
/>
228227
</Box>
@@ -234,7 +233,6 @@ const LoginPage = () => {
234233
autoComplete="current-password"
235234
disabled={loading || !supportPassAuth}
236235
resettable
237-
fullWidth
238236
validate={required()}
239237
/>
240238
</Box>
@@ -247,7 +245,6 @@ const LoginPage = () => {
247245
disabled={loading}
248246
readOnly={allowSingleBaseUrl}
249247
resettable={allowAnyBaseUrl}
250-
fullWidth
251248
validate={[required(), validateBaseUrl]}
252249
>
253250
{allowMultipleBaseUrls &&
@@ -280,9 +277,9 @@ const LoginPage = () => {
280277
<Box className="hint">{translate("synapseadmin.auth.welcome")}</Box>
281278
<Box className="form">
282279
<Select
280+
fullWidth
283281
value={locale}
284282
onChange={e => setLocale(e.target.value)}
285-
fullWidth
286283
disabled={loading}
287284
className="select"
288285
>
@@ -299,7 +296,6 @@ const LoginPage = () => {
299296
type="submit"
300297
color="primary"
301298
disabled={loading || !supportPassAuth}
302-
fullWidth
303299
>
304300
{translate("ra.auth.sign_in")}
305301
</Button>
@@ -308,7 +304,6 @@ const LoginPage = () => {
308304
color="secondary"
309305
onClick={handleSSO}
310306
disabled={loading || ssoBaseUrl === ""}
311-
fullWidth
312307
>
313308
{translate("synapseadmin.auth.sso_sign_in")}
314309
</Button>

src/resources/rooms.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ const RoomTitle = () => {
6767

6868
const RoomShowActions = () => {
6969
const record = useRecordContext();
70+
if (!record) {
71+
return null;
72+
}
7073
const publishButton = record?.public ? <RoomDirectoryUnpublishButton /> : <RoomDirectoryPublishButton />;
7174
// FIXME: refresh after (un)publish
7275
return (

src/resources/users.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,20 @@ export const UserEdit = (props: EditProps) => {
287287
const translate = useTranslate();
288288

289289
return (
290-
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />}>
290+
<Edit {...props} title={<UserTitle />} actions={<UserEditActions />} mutationMode="pessimistic">
291291
<TabbedForm toolbar={<UserEditToolbar />}>
292292
<FormTab label={translate("resources.users.name", { smart_count: 1 })} icon={<PersonPinIcon />}>
293293
<AvatarField source="avatar_src" sortable={false} sx={{ height: "120px", width: "120px" }} />
294294
<BooleanInput source="avatar_erase" label="resources.users.action.erase_avatar" />
295-
<ImageInput source="avatar_file" label="resources.users.fields.avatar" accept={{ 'image/*': [] }}>
296-
<ImageField source="src" title="Avatar" />
295+
<ImageInput
296+
source="avatar_file"
297+
label="resources.users.fields.avatar"
298+
// @ts-ignore
299+
accept={{ "image/*": [".png", ".jpg"] }}
300+
>
301+
<ImageField source="src" title="Avatar" />
297302
</ImageInput>
298-
<TextInput source="id" disabled />
303+
<TextInput source="id" readOnly />
299304
<TextInput source="displayname" />
300305
<PasswordInput source="password" autoComplete="new-password" helperText="resources.users.helper.password" />
301306
<SelectInput source="user_type" choices={choices_type} translateChoice={false} resettable />

src/synapse/dataProvider.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import fetchMock from "jest-fetch-mock";
33
import dataProvider from "./dataProvider";
44
import storage from "../storage";
55

6+
67
fetchMock.enableMocks();
78

89
beforeEach(() => {

0 commit comments

Comments
 (0)