diff --git a/apps/common/features/src/widgets/post/index.ts b/apps/common/features/src/widgets/post/index.ts index 7d43c205d..a7ea4e48e 100644 --- a/apps/common/features/src/widgets/post/index.ts +++ b/apps/common/features/src/widgets/post/index.ts @@ -1,3 +1,4 @@ export { Post } from "./ui/post"; export { PostForm } from "./ui/post-form"; export { PostPage } from "./ui/post-page"; +export { SortSelect } from "./ui/sort-select"; diff --git a/apps/common/features/src/widgets/post/ui/post-page.tsx b/apps/common/features/src/widgets/post/ui/post-page.tsx index 5a459835f..509087b68 100644 --- a/apps/common/features/src/widgets/post/ui/post-page.tsx +++ b/apps/common/features/src/widgets/post/ui/post-page.tsx @@ -33,6 +33,7 @@ import { useMenuStore, useUserStore } from "@/shared/lib"; import { GridViewDataTable } from "@/shared/ui/grid-view-data-table"; import { columns as tableColumns } from "../model/post-table-columns"; import { createColumns as createGridViewColumns } from "../model/grid-view-table-columns"; +import { SortSelect } from "./sort-select"; function PostPage({ bbsId }: { bbsId: string }) { const router = useRouter(); @@ -203,24 +204,9 @@ function PostPage({ bbsId }: { bbsId: string }) { ))} - + {bbsInfo?.ansUseYn === "N" && ( + + )} diff --git a/apps/common/features/src/widgets/post/ui/sort-select.tsx b/apps/common/features/src/widgets/post/ui/sort-select.tsx new file mode 100644 index 000000000..57950e894 --- /dev/null +++ b/apps/common/features/src/widgets/post/ui/sort-select.tsx @@ -0,0 +1,32 @@ +import { + Select, + SelectTrigger, + SelectValue, + SelectContent, + SelectItem, +} from "@common/components"; + +type SortSelectProps = { + value: string; + onValueChange: (value: string) => void; +}; + +function SortSelect(props: SortSelectProps) { + return ( + + ); +} + +export { SortSelect }; diff --git a/apps/cs/src/pages/recent/ui/recent-page.tsx b/apps/cs/src/pages/recent/ui/recent-page.tsx index ec9fec78a..26cf3af85 100644 --- a/apps/cs/src/pages/recent/ui/recent-page.tsx +++ b/apps/cs/src/pages/recent/ui/recent-page.tsx @@ -21,6 +21,7 @@ import { SelectTrigger, SelectValue, } from "@common/components"; +import { SortSelect } from "@/widgets/post"; import { PostApi, deleteReasonMessages, @@ -49,7 +50,9 @@ function RecentPage() { const { prompt } = useSelectPrompt(selectData); const { confirm } = useConfirm(); const alert = useAlertStore((state) => state.setMessage); + const [dateRange, setDateRange] = useState(); + const [tableSort, setTableSort] = useState("regDt,desc"); const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10, @@ -62,17 +65,17 @@ function RecentPage() { delYn: "N", frDateYmd: "", toDateYmd: "", - sort:"regDt,desc" }); const [isDeletePostData, setIsDeletePostData] = useState(false); const query = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, pagination], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, pagination, tableSort], queryFn: () => PostApi.getRecentPostList({ ...recentPostQuery, page: pagination.pageIndex, size: pagination.pageSize, + sort: tableSort, }), placeholderData: keepPreviousData, }); @@ -342,6 +345,7 @@ function RecentPage() { ))} + diff --git a/apps/cs/src/widgets/post/index.ts b/apps/cs/src/widgets/post/index.ts index a80768562..feb886602 100644 --- a/apps/cs/src/widgets/post/index.ts +++ b/apps/cs/src/widgets/post/index.ts @@ -1,4 +1,5 @@ export { Post } from "./ui/post"; export { PostForm } from "./ui/post-form"; export { PostPage } from "./ui/post-page"; +export { SortSelect } from "./ui/sort-select"; export { GeneralFileUploader } from "./ui/general-file-uploader"; diff --git a/apps/cs/src/widgets/post/ui/post-page.tsx b/apps/cs/src/widgets/post/ui/post-page.tsx index a37cdec84..850513a94 100644 --- a/apps/cs/src/widgets/post/ui/post-page.tsx +++ b/apps/cs/src/widgets/post/ui/post-page.tsx @@ -34,6 +34,7 @@ import { useMenuStore, useSelectPrompt } from "@/shared/lib"; import { GridViewDataTable } from "@/shared/ui/grid-view-data-table"; import { columns as tableColumns } from "../model/post-table-columns"; import { createColumns as createGridViewColumns } from "../model/grid-view-table-columns"; +import { SortSelect } from "./sort-select"; const selectData = Object.entries(deleteReasonMessages).map( ([label, value]) => ({ label, value }), @@ -212,24 +213,9 @@ function PostPage({ bbsId }: { bbsId: string }) { ))} - + {bbsInfo?.ansUseYn === "N" && ( + + )} diff --git a/apps/cs/src/widgets/post/ui/sort-select.tsx b/apps/cs/src/widgets/post/ui/sort-select.tsx new file mode 100644 index 000000000..57950e894 --- /dev/null +++ b/apps/cs/src/widgets/post/ui/sort-select.tsx @@ -0,0 +1,32 @@ +import { + Select, + SelectTrigger, + SelectValue, + SelectContent, + SelectItem, +} from "@common/components"; + +type SortSelectProps = { + value: string; + onValueChange: (value: string) => void; +}; + +function SortSelect(props: SortSelectProps) { + return ( + + ); +} + +export { SortSelect };