Skip to content

Commit

Permalink
Enable visual customization (#81)
Browse files Browse the repository at this point in the history
* Enable visual customization

* update readme
  • Loading branch information
aine-etke authored Oct 22, 2024
1 parent 4f2cd38 commit abc922c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ The following changes are already implemented:
* [Fix footer causing vertical scrollbar](https://github.com/etkecc/synapse-admin/pull/60)
* [Custom Menu Items](https://github.com/etkecc/synapse-admin/pull/79)
* [Add user profile to the top menu](https://github.com/etkecc/synapse-admin/pull/80)
* [Enable visual customization](https://github.com/etkecc/synapse-admin/pull/81)

_the list will be updated as new changes are added_

Expand Down
9 changes: 7 additions & 2 deletions src/components/AdminLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppBar, Confirm, Layout, Logout, Menu, useLogout, UserMenu } from "react-admin";
import { AppBar, TitlePortal, InspectorButton, Confirm, Layout, Logout, Menu, useLogout, UserMenu } from "react-admin";
import { LoginMethod } from "../pages/LoginPage";
import { useEffect, useState, Suspense } from "react";
import { Icons, DefaultIcon } from "./icons";
Expand Down Expand Up @@ -44,7 +44,12 @@ const AdminUserMenu = () => {
);
};

const AdminAppBar = () => <AppBar userMenu={<AdminUserMenu />} />;
const AdminAppBar = () => {
return (<AppBar userMenu={<AdminUserMenu />}>
<TitlePortal />
<InspectorButton />
</AppBar>);
};

const AdminMenu = (props) => {
const [menu, setMenu] = useState([]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoginFormBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const LoginFormBox = styled(Box)(({ theme }) => ({
backgroundSize: "cover",

[`& .card`]: {
width: "30rem",
maxWidth: "30rem",
marginTop: "6rem",
marginBottom: "6rem",
},
Expand Down
5 changes: 3 additions & 2 deletions src/resources/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ErrorIcon from '@mui/icons-material/Error';
import {
Button,
Datagrid,
DatagridConfigurable,
DateField,
List,
ListProps,
Expand Down Expand Up @@ -123,14 +124,14 @@ export const DestinationList = (props: ListProps) => {
pagination={<DestinationPagination />}
sort={{ field: "destination", order: "ASC" }}
>
<Datagrid rowClick={id => `${id}/show/rooms`} bulkActionButtons={false}>
<DatagridConfigurable rowClick={id => `${id}/show/rooms`} bulkActionButtons={false}>
<FunctionField source="destination" render={destinationFieldRender} />
<DateField source="failure_ts" showTime options={DATE_FORMAT} />
<RetryDateField source="retry_last_ts" showTime options={DATE_FORMAT} />
<TextField source="retry_interval" />
<TextField source="last_successful_stream_ordering" />
<DestinationReconnectButton />
</Datagrid>
</DatagridConfigurable>
</List>
);
};
Expand Down
5 changes: 3 additions & 2 deletions src/resources/registration_tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Create,
CreateProps,
Datagrid,
DatagridConfigurable,
DateField,
DateTimeInput,
Edit,
Expand Down Expand Up @@ -39,13 +40,13 @@ export const RegistrationTokenList = (props: ListProps) => (
pagination={false}
perPage={500}
>
<Datagrid rowClick="edit">
<DatagridConfigurable rowClick="edit">
<TextField source="token" sortable={false} />
<NumberField source="uses_allowed" sortable={false} />
<NumberField source="pending" sortable={false} />
<NumberField source="completed" sortable={false} />
<DateField source="expiry_time" showTime options={DATE_FORMAT} sortable={false} />
</Datagrid>
</DatagridConfigurable>
</List>
);

Expand Down
5 changes: 3 additions & 2 deletions src/resources/reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ViewListIcon from "@mui/icons-material/ViewList";
import ReportIcon from "@mui/icons-material/Warning";
import {
Datagrid,
DatagridConfigurable,
DateField,
DeleteButton,
List,
Expand Down Expand Up @@ -90,13 +91,13 @@ const ReportShowActions = () => {

export const ReportList = (props: ListProps) => (
<List {...props} pagination={<ReportPagination />} sort={{ field: "received_ts", order: "DESC" }}>
<Datagrid rowClick="show" bulkActionButtons={false}>
<DatagridConfigurable rowClick="show" bulkActionButtons={false}>
<TextField source="id" sortable={false} />
<DateField source="received_ts" showTime options={DATE_FORMAT} sortable={true} />
<TextField sortable={false} source="user_id" />
<TextField sortable={false} source="name" />
<TextField sortable={false} source="score" />
</Datagrid>
</DatagridConfigurable>
</List>
);

Expand Down
5 changes: 3 additions & 2 deletions src/resources/user_media_statistics.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PermMediaIcon from "@mui/icons-material/PermMedia";
import {
Datagrid,
DatagridConfigurable,
ExportButton,
List,
ListProps,
Expand Down Expand Up @@ -37,12 +38,12 @@ export const UserMediaStatsList = (props: ListProps) => (
pagination={<UserMediaStatsPagination />}
sort={{ field: "media_length", order: "DESC" }}
>
<Datagrid rowClick={id => "/users/" + id + "/media"} bulkActionButtons={false}>
<DatagridConfigurable rowClick={id => "/users/" + id + "/media"} bulkActionButtons={false}>
<TextField source="user_id" label="resources.users.fields.id" />
<TextField source="displayname" label="resources.users.fields.displayname" />
<NumberField source="media_count" />
<NumberField source="media_length" />
</Datagrid>
</DatagridConfigurable>
</List>
);

Expand Down
5 changes: 3 additions & 2 deletions src/resources/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ArrayField,
Button,
Datagrid,
DatagridConfigurable,
DateField,
Create,
CreateProps,
Expand Down Expand Up @@ -156,7 +157,7 @@ export const UserList = (props: ListProps) => (
actions={<UserListActions />}
pagination={<UserPagination />}
>
<Datagrid
<DatagridConfigurable
rowClick={(id: Identifier, resource: string) => `/${resource}/${id}`}
bulkActionButtons={<UserBulkActionButtons />}
>
Expand All @@ -169,7 +170,7 @@ export const UserList = (props: ListProps) => (
<BooleanField source="locked" />
<BooleanField source="erased" sortable={false} />
<DateField source="creation_ts" label="resources.users.fields.creation_ts_ms" showTime options={DATE_FORMAT} />
</Datagrid>
</DatagridConfigurable>
</List>
);

Expand Down

0 comments on commit abc922c

Please sign in to comment.