Skip to content

Commit abc922c

Browse files
authored
Enable visual customization (#81)
* Enable visual customization * update readme
1 parent 4f2cd38 commit abc922c

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ The following changes are already implemented:
7070
* [Fix footer causing vertical scrollbar](https://github.com/etkecc/synapse-admin/pull/60)
7171
* [Custom Menu Items](https://github.com/etkecc/synapse-admin/pull/79)
7272
* [Add user profile to the top menu](https://github.com/etkecc/synapse-admin/pull/80)
73+
* [Enable visual customization](https://github.com/etkecc/synapse-admin/pull/81)
7374

7475
_the list will be updated as new changes are added_
7576

src/components/AdminLayout.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppBar, Confirm, Layout, Logout, Menu, useLogout, UserMenu } from "react-admin";
1+
import { AppBar, TitlePortal, InspectorButton, Confirm, Layout, Logout, Menu, useLogout, UserMenu } from "react-admin";
22
import { LoginMethod } from "../pages/LoginPage";
33
import { useEffect, useState, Suspense } from "react";
44
import { Icons, DefaultIcon } from "./icons";
@@ -44,7 +44,12 @@ const AdminUserMenu = () => {
4444
);
4545
};
4646

47-
const AdminAppBar = () => <AppBar userMenu={<AdminUserMenu />} />;
47+
const AdminAppBar = () => {
48+
return (<AppBar userMenu={<AdminUserMenu />}>
49+
<TitlePortal />
50+
<InspectorButton />
51+
</AppBar>);
52+
};
4853

4954
const AdminMenu = (props) => {
5055
const [menu, setMenu] = useState([]);

src/components/LoginFormBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const LoginFormBox = styled(Box)(({ theme }) => ({
1313
backgroundSize: "cover",
1414

1515
[`& .card`]: {
16-
width: "30rem",
16+
maxWidth: "30rem",
1717
marginTop: "6rem",
1818
marginBottom: "6rem",
1919
},

src/resources/destinations.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ErrorIcon from '@mui/icons-material/Error';
88
import {
99
Button,
1010
Datagrid,
11+
DatagridConfigurable,
1112
DateField,
1213
List,
1314
ListProps,
@@ -123,14 +124,14 @@ export const DestinationList = (props: ListProps) => {
123124
pagination={<DestinationPagination />}
124125
sort={{ field: "destination", order: "ASC" }}
125126
>
126-
<Datagrid rowClick={id => `${id}/show/rooms`} bulkActionButtons={false}>
127+
<DatagridConfigurable rowClick={id => `${id}/show/rooms`} bulkActionButtons={false}>
127128
<FunctionField source="destination" render={destinationFieldRender} />
128129
<DateField source="failure_ts" showTime options={DATE_FORMAT} />
129130
<RetryDateField source="retry_last_ts" showTime options={DATE_FORMAT} />
130131
<TextField source="retry_interval" />
131132
<TextField source="last_successful_stream_ordering" />
132133
<DestinationReconnectButton />
133-
</Datagrid>
134+
</DatagridConfigurable>
134135
</List>
135136
);
136137
};

src/resources/registration_tokens.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Create,
55
CreateProps,
66
Datagrid,
7+
DatagridConfigurable,
78
DateField,
89
DateTimeInput,
910
Edit,
@@ -39,13 +40,13 @@ export const RegistrationTokenList = (props: ListProps) => (
3940
pagination={false}
4041
perPage={500}
4142
>
42-
<Datagrid rowClick="edit">
43+
<DatagridConfigurable rowClick="edit">
4344
<TextField source="token" sortable={false} />
4445
<NumberField source="uses_allowed" sortable={false} />
4546
<NumberField source="pending" sortable={false} />
4647
<NumberField source="completed" sortable={false} />
4748
<DateField source="expiry_time" showTime options={DATE_FORMAT} sortable={false} />
48-
</Datagrid>
49+
</DatagridConfigurable>
4950
</List>
5051
);
5152

src/resources/reports.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ViewListIcon from "@mui/icons-material/ViewList";
33
import ReportIcon from "@mui/icons-material/Warning";
44
import {
55
Datagrid,
6+
DatagridConfigurable,
67
DateField,
78
DeleteButton,
89
List,
@@ -90,13 +91,13 @@ const ReportShowActions = () => {
9091

9192
export const ReportList = (props: ListProps) => (
9293
<List {...props} pagination={<ReportPagination />} sort={{ field: "received_ts", order: "DESC" }}>
93-
<Datagrid rowClick="show" bulkActionButtons={false}>
94+
<DatagridConfigurable rowClick="show" bulkActionButtons={false}>
9495
<TextField source="id" sortable={false} />
9596
<DateField source="received_ts" showTime options={DATE_FORMAT} sortable={true} />
9697
<TextField sortable={false} source="user_id" />
9798
<TextField sortable={false} source="name" />
9899
<TextField sortable={false} source="score" />
99-
</Datagrid>
100+
</DatagridConfigurable>
100101
</List>
101102
);
102103

src/resources/user_media_statistics.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import PermMediaIcon from "@mui/icons-material/PermMedia";
22
import {
33
Datagrid,
4+
DatagridConfigurable,
45
ExportButton,
56
List,
67
ListProps,
@@ -37,12 +38,12 @@ export const UserMediaStatsList = (props: ListProps) => (
3738
pagination={<UserMediaStatsPagination />}
3839
sort={{ field: "media_length", order: "DESC" }}
3940
>
40-
<Datagrid rowClick={id => "/users/" + id + "/media"} bulkActionButtons={false}>
41+
<DatagridConfigurable rowClick={id => "/users/" + id + "/media"} bulkActionButtons={false}>
4142
<TextField source="user_id" label="resources.users.fields.id" />
4243
<TextField source="displayname" label="resources.users.fields.displayname" />
4344
<NumberField source="media_count" />
4445
<NumberField source="media_length" />
45-
</Datagrid>
46+
</DatagridConfigurable>
4647
</List>
4748
);
4849

src/resources/users.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
ArrayField,
1616
Button,
1717
Datagrid,
18+
DatagridConfigurable,
1819
DateField,
1920
Create,
2021
CreateProps,
@@ -156,7 +157,7 @@ export const UserList = (props: ListProps) => (
156157
actions={<UserListActions />}
157158
pagination={<UserPagination />}
158159
>
159-
<Datagrid
160+
<DatagridConfigurable
160161
rowClick={(id: Identifier, resource: string) => `/${resource}/${id}`}
161162
bulkActionButtons={<UserBulkActionButtons />}
162163
>
@@ -169,7 +170,7 @@ export const UserList = (props: ListProps) => (
169170
<BooleanField source="locked" />
170171
<BooleanField source="erased" sortable={false} />
171172
<DateField source="creation_ts" label="resources.users.fields.creation_ts_ms" showTime options={DATE_FORMAT} />
172-
</Datagrid>
173+
</DatagridConfigurable>
173174
</List>
174175
);
175176

0 commit comments

Comments
 (0)