File tree Expand file tree Collapse file tree 4 files changed +32
-7
lines changed
Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { ReferenceField , ReferenceFieldProps , TextField } from 'react-admin' ;
3+
4+ export const GroupField : React . FC < Omit < ReferenceFieldProps , 'reference' > > =
5+ React . memo ( ( props ) => {
6+ return (
7+ < ReferenceField link = "show" { ...props } reference = "groups" >
8+ < TextField source = "name" />
9+ </ ReferenceField >
10+ ) ;
11+ } ) ;
12+ GroupField . displayName = 'GroupField' ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { Box } from '@mui/material' ;
3+
4+ export const PostListActionToolbar = ( { children, ...props } ) => (
5+ < Box sx = { { alignItems : 'center' , display : 'flex' } } > { children } </ Box >
6+ ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,17 @@ import {
44 Datagrid ,
55 DateField ,
66 List ,
7- ReferenceField ,
87 TextField ,
98 SearchInput ,
109 useTranslate ,
1110 BulkDeleteButton ,
11+ ShowButton ,
12+ EditButton ,
13+ ReferenceInput ,
14+ SelectInput ,
1215} from 'react-admin' ;
16+ import { GroupField } from '../components/GroupField' ;
17+ import { PostListActionToolbar } from '../components/PostListActionToolbar' ;
1318import { UserField } from '../components/UserField' ;
1419
1520export const MessageList : React . FC = ( ) => {
@@ -24,6 +29,9 @@ export const MessageList: React.FC = () => {
2429 alwaysOn
2530 placeholder = { translate ( 'custom.users.search' ) }
2631 /> ,
32+ < ReferenceInput key = "groupID" source = "groupId" reference = "groups" >
33+ < SelectInput optionText = "name" />
34+ </ ReferenceInput > ,
2735 ] }
2836 >
2937 < Datagrid
@@ -33,11 +41,14 @@ export const MessageList: React.FC = () => {
3341 < TextField source = "id" sortable = { true } sortByOrder = "DESC" />
3442 < TextField source = "content" />
3543 < UserField source = "author" />
36- < ReferenceField source = "groupId" reference = "groups " />
44+ < GroupField source = "groupId" />
3745 < TextField source = "converseId" />
3846 < BooleanField source = "hasRecall" />
3947 < TextField source = "reactions" />
4048 < DateField source = "createdAt" />
49+ < PostListActionToolbar >
50+ < ShowButton />
51+ </ PostListActionToolbar >
4152 </ Datagrid >
4253 </ List >
4354 ) ;
Original file line number Diff line number Diff line change @@ -21,13 +21,9 @@ import {
2121 Labeled ,
2222} from 'react-admin' ;
2323import React from 'react' ;
24- import { Box } from '@mui/material' ;
2524import { DangerButton } from '../components/DangerButton' ;
2625import { ButtonWithConfirm } from '../components/ButtonWithConfirm' ;
27-
28- const PostListActionToolbar = ( { children, ...props } ) => (
29- < Box sx = { { alignItems : 'center' , display : 'flex' } } > { children } </ Box >
30- ) ;
26+ import { PostListActionToolbar } from '../components/PostListActionToolbar' ;
3127
3228export const UserList : React . FC = ( ) => {
3329 const translate = useTranslate ( ) ;
You can’t perform that action at this time.
0 commit comments