Skip to content

Commit c8c4f91

Browse files
committed
feat: 객체 목록에서 createdAt / updatedAt을 숨길 수 있도록 수정
1 parent 2585a90 commit c8c4f91

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/pyconkr-admin/src/components/layouts/admin_list.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import { BackendAdminSignInGuard } from "../elements/admin_signin_guard";
2121
type AdminListProps = {
2222
app: string;
2323
resource: string;
24+
hideCreatedAt?: boolean;
25+
hideUpdatedAt?: boolean;
2426
};
2527

2628
type ListRowType = {
@@ -32,7 +34,7 @@ type ListRowType = {
3234

3335
const InnerAdminList: React.FC<AdminListProps> = ErrorBoundary.with(
3436
{ fallback: Common.Components.ErrorFallback },
35-
Suspense.with({ fallback: <CircularProgress /> }, ({ app, resource }) => {
37+
Suspense.with({ fallback: <CircularProgress /> }, ({ app, resource, hideCreatedAt, hideUpdatedAt }) => {
3638
const navigate = useNavigate();
3739
const backendAdminClient = Common.Hooks.BackendAdminAPI.useBackendAdminClient();
3840
const listQuery = Common.Hooks.BackendAdminAPI.useListQuery<ListRowType>(backendAdminClient, app, resource);
@@ -53,8 +55,8 @@ const InnerAdminList: React.FC<AdminListProps> = ErrorBoundary.with(
5355
<TableRow>
5456
<TableCell sx={{ width: "25%" }}>ID</TableCell>
5557
<TableCell sx={{ width: "40%" }}>이름</TableCell>
56-
<TableCell sx={{ width: "17.5%" }}>생성 시간</TableCell>
57-
<TableCell sx={{ width: "17.5%" }}>수정 시간</TableCell>
58+
{hideCreatedAt === true && <TableCell sx={{ width: "17.5%" }}>생성 시간</TableCell>}
59+
{hideUpdatedAt === true && <TableCell sx={{ width: "17.5%" }}>수정 시간</TableCell>}
5860
</TableRow>
5961
</TableHead>
6062
<TableBody>
@@ -66,8 +68,8 @@ const InnerAdminList: React.FC<AdminListProps> = ErrorBoundary.with(
6668
<TableCell>
6769
<Link to={`/${app}/${resource}/${item.id}`}>{item.str_repr}</Link>
6870
</TableCell>
69-
<TableCell>{new Date(item.created_at).toLocaleString()}</TableCell>
70-
<TableCell>{new Date(item.updated_at).toLocaleString()}</TableCell>
71+
{hideCreatedAt === true && <TableCell>{new Date(item.created_at).toLocaleString()}</TableCell>}
72+
{hideUpdatedAt === true && <TableCell>{new Date(item.updated_at).toLocaleString()}</TableCell>}
7173
</TableRow>
7274
))}
7375
</TableBody>

0 commit comments

Comments
 (0)