Skip to content

Commit 998d381

Browse files
authored
Add rooms' avatars (#158)
* Add room avatars * update readme
1 parent abca842 commit 998d381

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ The following changes are already implemented:
9898
* 🔍 [Allow providing login form details via GET params](https://github.com/etkecc/synapse-admin/pull/140)
9999
* 🎨 [Add preferred theme colors to login page and footer](https://github.com/etkecc/synapse-admin/pull/155)
100100
* 🔰 [Add "Assign Admin" button to the rooms](https://github.com/etkecc/synapse-admin/pull/156)
101+
* 🖼️ [Add rooms' avatars](https://github.com/etkecc/synapse-admin/pull/158)
101102

102103
_the list will be updated as new changes are added_
103104

src/resources/rooms.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export const RoomShow = (props: ShowProps) => {
216216
<Tab label="synapseadmin.rooms.tabs.members" icon={<UserIcon />} path="members">
217217
<MakeAdminBtn />
218218
<ReferenceManyField reference="room_members" target="room_id" label={false}>
219-
<Datagrid style={{ width: "100%" }} rowClick={id => "/users/" + id} bulkActionButtons={false}>
219+
<Datagrid sx={{ width: "100%" }} rowClick={id => "/users/" + id} bulkActionButtons={false}>
220220
<RaTextField source="id" sortable={false} label="resources.users.fields.id" />
221221
<ReferenceField
222222
label="resources.users.fields.displayname"
@@ -284,7 +284,7 @@ export const RoomShow = (props: ShowProps) => {
284284

285285
<Tab label={translate("resources.room_state.name", { smart_count: 2 })} icon={<EventIcon />} path="state">
286286
<ReferenceManyField reference="room_state" target="room_id" label={false}>
287-
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
287+
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
288288
<RaTextField source="type" sortable={false} />
289289
<DateField source="origin_server_ts" showTime options={DATE_FORMAT} sortable={false} />
290290
<FunctionField source="content" sortable={false} render={record => `${JSON.stringify(record.content, null, 2)}`} />
@@ -305,7 +305,7 @@ export const RoomShow = (props: ShowProps) => {
305305
{translate("resources.rooms.helper.forward_extremities")}
306306
</Box>
307307
<ReferenceManyField reference="forward_extremities" target="room_id" label={false}>
308-
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
308+
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
309309
<RaTextField source="id" sortable={false} />
310310
<DateField source="received_ts" showTime options={DATE_FORMAT} sortable={false} />
311311
<NumberField source="depth" sortable={false} />
@@ -358,6 +358,9 @@ export const RoomList = (props: ListProps) => {
358358
bulkActionButtons={<RoomBulkActionButtons />}
359359
omit={["joined_local_members", "state_events", "version", "federatable"]}
360360
>
361+
<ReferenceField reference="rooms" source="id" label={false} link={false} sortable={false}>
362+
<AvatarField source="avatar" sx={{ height: "40px", width: "40px" }} />
363+
</ReferenceField>
361364
<BooleanField
362365
source="is_encrypted"
363366
sortBy="encryption"

src/resources/users.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export const UserEdit = (props: EditProps) => {
464464

465465
<FormTab label={translate("resources.devices.name", { smart_count: 2 })} icon={<DevicesIcon />} path="devices">
466466
<ReferenceManyField reference="devices" target="user_id" label={false}>
467-
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
467+
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
468468
<TextField source="device_id" sortable={false} />
469469
<TextField source="display_name" sortable={false} />
470470
<TextField source="last_seen_ip" sortable={false} />
@@ -477,7 +477,7 @@ export const UserEdit = (props: EditProps) => {
477477
<FormTab label="resources.connections.name" icon={<SettingsInputComponentIcon />} path="connections">
478478
<ReferenceField reference="connections" source="id" label={false} link={false}>
479479
<ArrayField source="devices[].sessions[0].connections" label="resources.connections.name">
480-
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
480+
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
481481
<TextField source="ip" sortable={false} />
482482
<DateField source="last_seen" showTime options={DATE_FORMAT} sortable={false} />
483483
<TextField source="user_agent" sortable={false} style={{ width: "100%" }} />
@@ -499,7 +499,7 @@ export const UserEdit = (props: EditProps) => {
499499
perPage={50}
500500
sort={{ field: "created_ts", order: "DESC" }}
501501
>
502-
<Datagrid style={{ width: "100%" }}>
502+
<Datagrid sx={{ width: "100%" }}>
503503
<MediaIDField source="media_id" />
504504
<DateField source="created_ts" showTime options={DATE_FORMAT} />
505505
<DateField source="last_access_ts" showTime options={DATE_FORMAT} />
@@ -516,19 +516,19 @@ export const UserEdit = (props: EditProps) => {
516516

517517
<FormTab label={translate("resources.rooms.name", { smart_count: 2 })} icon={<ViewListIcon />} path="rooms">
518518
<ReferenceManyField reference="joined_rooms" target="user_id" label={false}>
519-
<Datagrid style={{ width: "100%" }} rowClick={id => "/rooms/" + id + "/show"} bulkActionButtons={false}>
520-
<TextField source="id" sortable={false} label="resources.rooms.fields.room_id" />
521-
<ReferenceField
522-
label="resources.rooms.fields.name"
523-
source="id"
524-
reference="rooms"
525-
sortable={false}
526-
link=""
527-
>
528-
<TextField source="name" sortable={false} />
529-
</ReferenceField>
530-
<MakeAdminBtn />
531-
</Datagrid>
519+
<Datagrid sx={{ width: "100%" }} rowClick={id => "/rooms/" + id + "/show"} bulkActionButtons={false}>
520+
<ReferenceField reference="rooms" source="id" label={false} link={false} sortable={false}>
521+
<AvatarField source="avatar" sx={{ height: "40px", width: "40px" }} />
522+
</ReferenceField>
523+
<TextField source="id" label="resources.rooms.fields.room_id" sortable={false}/>
524+
<ReferenceField reference="rooms" source="id" label="resources.rooms.fields.name" link={false} sortable={false}>
525+
<TextField source="name" />
526+
</ReferenceField>
527+
<ReferenceField reference="rooms" source="id" label="resources.rooms.fields.joined_members" link={false} sortable={false}>
528+
<TextField source="joined_members" sortable={false} />
529+
</ReferenceField>
530+
<MakeAdminBtn />
531+
</Datagrid>
532532
</ReferenceManyField>
533533
</FormTab>
534534

@@ -538,7 +538,7 @@ export const UserEdit = (props: EditProps) => {
538538
path="pushers"
539539
>
540540
<ReferenceManyField reference="pushers" target="user_id" label={false}>
541-
<Datagrid style={{ width: "100%" }} bulkActionButtons={false}>
541+
<Datagrid sx={{ width: "100%" }} bulkActionButtons={false}>
542542
<TextField source="kind" sortable={false} />
543543
<TextField source="app_display_name" sortable={false} />
544544
<TextField source="app_id" sortable={false} />

0 commit comments

Comments
 (0)