From 19dd7a009188f79edd01141473cf169b2b3b3f6b Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 1 Jul 2025 14:18:58 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=ED=85=8C=EC=9D=B4=EB=B8=94=20columns?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/(pst)/notice/model/notice-table-columns.tsx | 6 ++++++ .../src/widgets/post/model/post-table-columns.tsx | 7 +++++-- apps/cs/src/widgets/post/model/post-table-columns.tsx | 8 ++++++-- apps/cs/src/widgets/post/ui/post-page.tsx | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx b/apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx index 0926a2d9d..e6feb6952 100644 --- a/apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx +++ b/apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx @@ -8,6 +8,12 @@ export const columns: ColumnDef[] = [ { accessorKey: "rowNo", header: "NO", + cell: ({ row, table }) => { + const totalRows = table.getRowCount(); + const currentPage = table.getState().pagination.pageIndex; + const pageSize = table.getState().pagination.pageSize; + return totalRows - (currentPage * pageSize + row.index); + }, }, { accessorKey: "pstTtl", diff --git a/apps/common/features/src/widgets/post/model/post-table-columns.tsx b/apps/common/features/src/widgets/post/model/post-table-columns.tsx index 973ce9315..2084b69ac 100644 --- a/apps/common/features/src/widgets/post/model/post-table-columns.tsx +++ b/apps/common/features/src/widgets/post/model/post-table-columns.tsx @@ -29,7 +29,7 @@ export const columns: ColumnDef[] = [ { accessorKey: "rowNo", header: "NO", - cell: ({ row }) => { + cell: ({ row, table }) => { if (row.original.isUpndFixPost) { return ( [] = [ ); } - return row.original.rowNo; + const totalRows = table.getRowCount(); + const currentPage = table.getState().pagination.pageIndex; + const pageSize = table.getState().pagination.pageSize; + return totalRows - (currentPage * pageSize + row.index); }, }, { diff --git a/apps/cs/src/widgets/post/model/post-table-columns.tsx b/apps/cs/src/widgets/post/model/post-table-columns.tsx index 973ce9315..c16f7a931 100644 --- a/apps/cs/src/widgets/post/model/post-table-columns.tsx +++ b/apps/cs/src/widgets/post/model/post-table-columns.tsx @@ -29,7 +29,7 @@ export const columns: ColumnDef[] = [ { accessorKey: "rowNo", header: "NO", - cell: ({ row }) => { + cell: ({ row, table }) => { if (row.original.isUpndFixPost) { return ( [] = [ ); } - return row.original.rowNo; + + const totalRows = table.getRowCount(); + const currentPage = table.getState().pagination.pageIndex; + const pageSize = table.getState().pagination.pageSize; + return totalRows - (currentPage * pageSize + row.index); }, }, { diff --git a/apps/cs/src/widgets/post/ui/post-page.tsx b/apps/cs/src/widgets/post/ui/post-page.tsx index 0a91f08e9..75384ad13 100644 --- a/apps/cs/src/widgets/post/ui/post-page.tsx +++ b/apps/cs/src/widgets/post/ui/post-page.tsx @@ -78,7 +78,7 @@ function PostPage({ bbsId }: { bbsId: string }) { isLoading, refetch, } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd, pagination], queryFn: () => PostApi.getPostList(parseInt(bbsId), { ...postParams,