From 6bb1fc312f7259ab9068e718f1e1cec78a4c1391 Mon Sep 17 00:00:00 2001 From: bicochan Date: Thu, 8 May 2025 10:45:45 +0900 Subject: [PATCH] =?UTF-8?q?rename:=20bbs=20->=20pst=20=EA=B7=B8=EB=A3=B9?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbsnotice/[bbsId]/[pstNo]/modify/page.tsx | 2 +- .../pst/bbsnotice/[bbsId]/[pstNo]/page.tsx | 2 +- .../pst/bbsnotice/[bbsId]/page.tsx | 2 +- .../pst/bbsnotice/[bbsId]/register/page.tsx | 2 +- .../(with-base-layout)/pst/layout.tsx} | 8 +- .../src/pages/(bbs)/notice/ui/notice-page.tsx | 159 ------------------ .../pages/{(bbs) => (pst)}/notice/index.ts | 0 .../notice/model/notice-table-columns.tsx | 0 .../notice/ui/create-page.tsx | 13 +- .../notice/ui/modify-page.tsx | 13 +- .../src/pages/(pst)/notice/ui/notice-page.tsx | 152 +++++++++++++++++ .../notice/ui/notice-post.tsx | 7 +- 12 files changed, 172 insertions(+), 188 deletions(-) rename apps/common/features/{src/pages/(bbs)/notice/ui/notice-layout.tsx => app/(with-base-layout)/pst/layout.tsx} (87%) delete mode 100644 apps/common/features/src/pages/(bbs)/notice/ui/notice-page.tsx rename apps/common/features/src/pages/{(bbs) => (pst)}/notice/index.ts (100%) rename apps/common/features/src/pages/{(bbs) => (pst)}/notice/model/notice-table-columns.tsx (100%) rename apps/common/features/src/pages/{(bbs) => (pst)}/notice/ui/create-page.tsx (79%) rename apps/common/features/src/pages/{(bbs) => (pst)}/notice/ui/modify-page.tsx (79%) create mode 100644 apps/common/features/src/pages/(pst)/notice/ui/notice-page.tsx rename apps/common/features/src/pages/{(bbs) => (pst)}/notice/ui/notice-post.tsx (51%) diff --git a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/modify/page.tsx b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/modify/page.tsx index c40eb93d4..bfe86c491 100644 --- a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/modify/page.tsx +++ b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/modify/page.tsx @@ -1,4 +1,4 @@ -import { ModifyPage } from "@/pages/(bbs)/notice"; +import { ModifyPage } from "@/pages/(pst)/notice"; export default async function PstBbsNoticePostModifyPage({ params, diff --git a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/page.tsx b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/page.tsx index bc0380808..f5b6f13fd 100644 --- a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/page.tsx +++ b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/[pstNo]/page.tsx @@ -1,4 +1,4 @@ -import { NoticePost } from "@/pages/(bbs)/notice"; +import { NoticePost } from "@/pages/(pst)/notice"; export default async function PstBbsNoticePostPage({ params, diff --git a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/page.tsx b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/page.tsx index 0f3176325..a94302706 100644 --- a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/page.tsx +++ b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/page.tsx @@ -1,4 +1,4 @@ -import { NoticePage } from "@/pages/(bbs)/notice"; +import { NoticePage } from "@/pages/(pst)/notice"; export default async function PstBbsNoticePage({ params, diff --git a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/register/page.tsx b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/register/page.tsx index 4e4b4c78e..859274306 100644 --- a/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/register/page.tsx +++ b/apps/common/features/app/(with-base-layout)/pst/bbsnotice/[bbsId]/register/page.tsx @@ -1,4 +1,4 @@ -import { CreatePage } from "@/pages/(bbs)/notice"; +import { CreatePage } from "@/pages/(pst)/notice"; export default async function PstBbsNoticeRegisterPage({ params, diff --git a/apps/common/features/src/pages/(bbs)/notice/ui/notice-layout.tsx b/apps/common/features/app/(with-base-layout)/pst/layout.tsx similarity index 87% rename from apps/common/features/src/pages/(bbs)/notice/ui/notice-layout.tsx rename to apps/common/features/app/(with-base-layout)/pst/layout.tsx index b4b5e37fb..19d7de4cb 100644 --- a/apps/common/features/src/pages/(bbs)/notice/ui/notice-layout.tsx +++ b/apps/common/features/app/(with-base-layout)/pst/layout.tsx @@ -5,7 +5,11 @@ import type { Board } from "@/entities/board"; import { PageLayout } from "@/shared/ui/page-layout"; import { useLocalStorage } from "@frontend-opensource/use-react-hooks"; -function NoticeLayout({ children }: { children: React.ReactNode }) { +export default function PostLayout({ + children, +}: { + children: React.ReactNode; +}) { const [bbsInfo, setBbsInfo] = useState(null); const [storedBbsInfo] = useLocalStorage("bbs-info", ""); @@ -22,5 +26,3 @@ function NoticeLayout({ children }: { children: React.ReactNode }) { ); } - -export { NoticeLayout }; diff --git a/apps/common/features/src/pages/(bbs)/notice/ui/notice-page.tsx b/apps/common/features/src/pages/(bbs)/notice/ui/notice-page.tsx deleted file mode 100644 index ff085824b..000000000 --- a/apps/common/features/src/pages/(bbs)/notice/ui/notice-page.tsx +++ /dev/null @@ -1,159 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; -import { usePathname, useRouter } from "next/navigation"; -import { useQuery } from "@tanstack/react-query"; -import { - getCoreRowModel, - useReactTable, - type PaginationState, - type RowSelectionState, -} from "@tanstack/react-table"; -import { - Button, - DataTable, - Input, - Label, - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@common/components"; -import { PostApi, type Post, type PostParams } from "@/entities/post"; -import { ENDPOINT } from "@/shared/config"; -import { useMenuStore } from "@/shared/lib"; -import { columns } from "../model/notice-table-columns"; -import { NoticeLayout } from "./notice-layout"; - -function NoticePage({ bbsId }: { bbsId: string }) { - const router = useRouter(); - const pathname = usePathname(); - const { pageMenuAuthority } = useMenuStore((state) => state); - - const [rowSelection, setRowSelection] = useState({}); - const [postParams, setPostParams] = useState({ - keywordType: "title", - keyword: "", - }); - const [pagination, setPagination] = useState({ - pageIndex: 0, - pageSize: 10, - }); - - const { data: postList, refetch } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId], - queryFn: () => - PostApi.getPostList(bbsId, { - ...postParams, - page: pagination.pageIndex, - size: pagination.pageSize, - }), - enabled: false, - }); - - const table = useReactTable({ - data: postList?.content ?? [], - columns, - state: { - pagination, - rowSelection, - }, - rowCount: postList?.totalElements ?? 0, - manualPagination: true, - enableMultiRowSelection: true, - getCoreRowModel: getCoreRowModel(), - onPaginationChange: setPagination, - onRowSelectionChange: setRowSelection, - }); - - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - refetch(); - }; - - const handleRowClick = (row: Post) => { - router.push(`${pathname}/${row.pstNo}`); - }; - - useEffect(() => { - refetch(); - }, [pagination]); - - return ( - -
-
-
- - - - setPostParams({ ...postParams, keyword: e.target.value }) - } - className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" - /> - -
-
-
-
-
-

공지사항 목록

-
- {pageMenuAuthority?.regAuthrtYn === "Y" && ( - - )} - -
-
-
-
- -
-
-
-
- ); -} - -export { NoticePage }; diff --git a/apps/common/features/src/pages/(bbs)/notice/index.ts b/apps/common/features/src/pages/(pst)/notice/index.ts similarity index 100% rename from apps/common/features/src/pages/(bbs)/notice/index.ts rename to apps/common/features/src/pages/(pst)/notice/index.ts diff --git a/apps/common/features/src/pages/(bbs)/notice/model/notice-table-columns.tsx b/apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx similarity index 100% rename from apps/common/features/src/pages/(bbs)/notice/model/notice-table-columns.tsx rename to apps/common/features/src/pages/(pst)/notice/model/notice-table-columns.tsx diff --git a/apps/common/features/src/pages/(bbs)/notice/ui/create-page.tsx b/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx similarity index 79% rename from apps/common/features/src/pages/(bbs)/notice/ui/create-page.tsx rename to apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx index 761056f7f..a6a926c32 100644 --- a/apps/common/features/src/pages/(bbs)/notice/ui/create-page.tsx +++ b/apps/common/features/src/pages/(pst)/notice/ui/create-page.tsx @@ -8,7 +8,6 @@ import { useMutation } from "@tanstack/react-query"; import { PostForm } from "@/widgets/post"; import { PostApi, postFormSchema, type PostFormData } from "@/entities/post"; import { setCookie, useAlertStore, useUserStore } from "@/shared/lib"; -import { NoticeLayout } from "./notice-layout"; function CreatePage({ bbsId }: { bbsId: string }) { const router = useRouter(); @@ -40,14 +39,12 @@ function CreatePage({ bbsId }: { bbsId: string }) { }, []); return ( - -
-
-

게시글 등록

-
- +
+
+

게시글 등록

- + +
); } diff --git a/apps/common/features/src/pages/(bbs)/notice/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx similarity index 79% rename from apps/common/features/src/pages/(bbs)/notice/ui/modify-page.tsx rename to apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx index 7049de20f..897b72e62 100644 --- a/apps/common/features/src/pages/(bbs)/notice/ui/modify-page.tsx +++ b/apps/common/features/src/pages/(pst)/notice/ui/modify-page.tsx @@ -11,7 +11,6 @@ import { } from "@/entities/post"; import { ENDPOINT } from "@/shared/config"; import { useAlertStore, useUserStore } from "@/shared/lib"; -import { NoticeLayout } from "./notice-layout"; function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const { setMessage: alert } = useAlertStore((state) => state); @@ -40,14 +39,12 @@ function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { }); return ( - -
-
-

게시글 수정

-
- +
+
+

게시글 수정

- + +
); } diff --git a/apps/common/features/src/pages/(pst)/notice/ui/notice-page.tsx b/apps/common/features/src/pages/(pst)/notice/ui/notice-page.tsx new file mode 100644 index 000000000..a023a096a --- /dev/null +++ b/apps/common/features/src/pages/(pst)/notice/ui/notice-page.tsx @@ -0,0 +1,152 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { usePathname, useRouter } from "next/navigation"; +import { useQuery } from "@tanstack/react-query"; +import { + getCoreRowModel, + useReactTable, + type PaginationState, + type RowSelectionState, +} from "@tanstack/react-table"; +import { + Button, + DataTable, + Input, + Label, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@common/components"; +import { PostApi, type Post, type PostParams } from "@/entities/post"; +import { ENDPOINT } from "@/shared/config"; +import { useMenuStore } from "@/shared/lib"; +import { columns } from "../model/notice-table-columns"; + +function NoticePage({ bbsId }: { bbsId: string }) { + const router = useRouter(); + const pathname = usePathname(); + const { pageMenuAuthority } = useMenuStore((state) => state); + + const [rowSelection, setRowSelection] = useState({}); + const [postParams, setPostParams] = useState({ + keywordType: "title", + keyword: "", + }); + const [pagination, setPagination] = useState({ + pageIndex: 0, + pageSize: 10, + }); + + const { data: postList, refetch } = useQuery({ + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId], + queryFn: () => + PostApi.getPostList(bbsId, { + ...postParams, + page: pagination.pageIndex, + size: pagination.pageSize, + }), + enabled: false, + }); + + const table = useReactTable({ + data: postList?.content ?? [], + columns, + state: { + pagination, + rowSelection, + }, + rowCount: postList?.totalElements ?? 0, + manualPagination: true, + enableMultiRowSelection: true, + getCoreRowModel: getCoreRowModel(), + onPaginationChange: setPagination, + onRowSelectionChange: setRowSelection, + }); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + refetch(); + }; + + const handleRowClick = (row: Post) => { + router.push(`${pathname}/${row.pstNo}`); + }; + + useEffect(() => { + refetch(); + }, [pagination]); + + return ( +
+
+
+ + + + setPostParams({ ...postParams, keyword: e.target.value }) + } + className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" + /> + +
+
+
+
+
+

공지사항 목록

+
+ {pageMenuAuthority?.regAuthrtYn === "Y" && ( + + )} + +
+
+
+
+ +
+
+
+ ); +} + +export { NoticePage }; diff --git a/apps/common/features/src/pages/(bbs)/notice/ui/notice-post.tsx b/apps/common/features/src/pages/(pst)/notice/ui/notice-post.tsx similarity index 51% rename from apps/common/features/src/pages/(bbs)/notice/ui/notice-post.tsx rename to apps/common/features/src/pages/(pst)/notice/ui/notice-post.tsx index 964e16a91..c61c734f3 100644 --- a/apps/common/features/src/pages/(bbs)/notice/ui/notice-post.tsx +++ b/apps/common/features/src/pages/(pst)/notice/ui/notice-post.tsx @@ -1,14 +1,9 @@ "use client"; import { Post } from "@/widgets/post"; -import { NoticeLayout } from "./notice-layout"; function NoticePost({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { - return ( - - - - ); + return ; } export { NoticePost };