@@ -12,6 +12,7 @@ type AdminListProps = {
1212 resource : string ;
1313 hideCreatedAt ?: boolean ;
1414 hideUpdatedAt ?: boolean ;
15+ hideCreateNew ?: boolean ;
1516} ;
1617
1718type ListRowType = {
@@ -23,7 +24,7 @@ type ListRowType = {
2324
2425const InnerAdminList : React . FC < AdminListProps > = ErrorBoundary . with (
2526 { fallback : Common . Components . ErrorFallback } ,
26- Suspense . with ( { fallback : < CircularProgress /> } , ( { app, resource, hideCreatedAt, hideUpdatedAt } ) => {
27+ Suspense . with ( { fallback : < CircularProgress /> } , ( { app, resource, hideCreatedAt, hideUpdatedAt, hideCreateNew } ) => {
2728 const navigate = useNavigate ( ) ;
2829 const backendAdminClient = Common . Hooks . BackendAdminAPI . useBackendAdminClient ( ) ;
2930 const listQuery = Common . Hooks . BackendAdminAPI . useListQuery < ListRowType > ( backendAdminClient , app , resource ) ;
@@ -35,9 +36,11 @@ const InnerAdminList: React.FC<AdminListProps> = ErrorBoundary.with(
3536 </ Typography >
3637 < br />
3738 < Box >
38- < Button variant = "contained" onClick = { ( ) => navigate ( `/${ app } /${ resource } /create` ) } startIcon = { < Add /> } >
39- 새 객체 추가
40- </ Button >
39+ { ! hideCreateNew && (
40+ < Button variant = "contained" onClick = { ( ) => navigate ( `/${ app } /${ resource } /create` ) } startIcon = { < Add /> } >
41+ 새 객체 추가
42+ </ Button >
43+ ) }
4144 </ Box >
4245 < Table >
4346 < TableHead >
@@ -57,8 +60,8 @@ const InnerAdminList: React.FC<AdminListProps> = ErrorBoundary.with(
5760 < TableCell >
5861 < Link to = { `/${ app } /${ resource } /${ item . id } ` } > { item . str_repr } </ Link >
5962 </ TableCell >
60- { hideCreatedAt === true && < TableCell > { new Date ( item . created_at ) . toLocaleString ( ) } </ TableCell > }
61- { hideUpdatedAt === true && < TableCell > { new Date ( item . updated_at ) . toLocaleString ( ) } </ TableCell > }
63+ { ! hideCreatedAt && < TableCell > { new Date ( item . created_at ) . toLocaleString ( ) } </ TableCell > }
64+ { ! hideUpdatedAt && < TableCell > { new Date ( item . updated_at ) . toLocaleString ( ) } </ TableCell > }
6265 </ TableRow >
6366 ) ) }
6467 </ TableBody >
0 commit comments