From c3fc0eb96b9a42e123e95c55a2e3fd93747cc750 Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 13 May 2025 15:09:56 +0900 Subject: [PATCH] =?UTF-8?q?design:=20=EB=B8=94=EB=9E=99=20=ED=85=8C?= =?UTF-8?q?=EB=A7=88=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbsimage/[bbsId]/[pstNo]/modify/page.tsx | 10 ++++ apps/common/features/package.json | 1 + apps/common/features/src/app/index.tsx | 2 + apps/common/features/src/app/styles/base.css | 10 ++-- .../features/src/pages/(pst)/image/index.ts | 1 + .../src/pages/(pst)/image/ui/modify-page.tsx | 53 +++++++++++++++++++ .../post/model/grid-view-table-columns.tsx | 34 +++++++----- .../src/widgets/post/ui/post-comment.tsx | 16 +++--- .../src/widgets/post/ui/post-form.tsx | 2 +- .../features/src/widgets/post/ui/post.tsx | 13 ++--- .../post/ui/with-preview-file-uploader.tsx | 20 +++++-- apps/common/features/tailwind.config.ts | 3 ++ pnpm-lock.yaml | 7 +++ 13 files changed, 135 insertions(+), 37 deletions(-) create mode 100644 apps/common/features/app/(with-base-layout)/pst/bbsimage/[bbsId]/[pstNo]/modify/page.tsx create mode 100644 apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx diff --git a/apps/common/features/app/(with-base-layout)/pst/bbsimage/[bbsId]/[pstNo]/modify/page.tsx b/apps/common/features/app/(with-base-layout)/pst/bbsimage/[bbsId]/[pstNo]/modify/page.tsx new file mode 100644 index 000000000..d7601ffd1 --- /dev/null +++ b/apps/common/features/app/(with-base-layout)/pst/bbsimage/[bbsId]/[pstNo]/modify/page.tsx @@ -0,0 +1,10 @@ +import { ModifyPage } from "@/pages/(pst)/image"; + +export default async function PstBbsImagePostModifyPage({ + params, +}: { + params: Promise<{ bbsId: string; pstNo: string }>; +}) { + const { bbsId, pstNo } = await params; + return ; +} diff --git a/apps/common/features/package.json b/apps/common/features/package.json index 88a5a66a1..8ec6639bf 100644 --- a/apps/common/features/package.json +++ b/apps/common/features/package.json @@ -13,6 +13,7 @@ "@common/components": "workspace:*", "@common/config": "workspace:*", "@common/network": "workspace:*", + "@fontsource-variable/noto-sans-kr": "^5.2.5", "@frontend-opensource/use-react-hooks": "^1.1.4", "@hookform/resolvers": "^4.1.3", "@minoru/react-dnd-treeview": "^3.5.0", diff --git a/apps/common/features/src/app/index.tsx b/apps/common/features/src/app/index.tsx index 5a73f2fdd..692b55ef0 100644 --- a/apps/common/features/src/app/index.tsx +++ b/apps/common/features/src/app/index.tsx @@ -1,5 +1,7 @@ import "./styles/base.css"; import "./styles/components.css"; +import "@fontsource-variable/noto-sans-kr"; + import { AppProvider } from "./providers"; import { cookies } from "next/headers"; diff --git a/apps/common/features/src/app/styles/base.css b/apps/common/features/src/app/styles/base.css index a4f54680f..6cbb623bb 100644 --- a/apps/common/features/src/app/styles/base.css +++ b/apps/common/features/src/app/styles/base.css @@ -5,8 +5,10 @@ @tailwind base; @tailwind utilities; -html, -body { - font-family: "Noto Sans KR", sans-serif; - font-size: 10px; +@layer base { + html, + body { + font-family: "Noto Sans KR", sans-serif; + font-size: 10px; + } } diff --git a/apps/common/features/src/pages/(pst)/image/index.ts b/apps/common/features/src/pages/(pst)/image/index.ts index b3a860dfe..0bc16c1ad 100644 --- a/apps/common/features/src/pages/(pst)/image/index.ts +++ b/apps/common/features/src/pages/(pst)/image/index.ts @@ -1,3 +1,4 @@ export { CreatePage } from "./ui/create-page"; +export { ModifyPage } from "./ui/modify-page"; export { ImagePage } from "./ui/image-page"; export { ImagePost } from "./ui/image-post"; diff --git a/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx b/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx new file mode 100644 index 000000000..c721286e4 --- /dev/null +++ b/apps/common/features/src/pages/(pst)/image/ui/modify-page.tsx @@ -0,0 +1,53 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useMutation, useQuery } from "@tanstack/react-query"; +import { PostForm } from "@/widgets/post"; +import { + PostApi, + postUpdateFormSchema, + type PostUpdateFormData, +} from "@/entities/post"; +import { ENDPOINT } from "@/shared/config"; +import { useAlertStore, useUserStore } from "@/shared/lib"; + +function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { + const router = useRouter(); + const { setMessage: alert } = useAlertStore((state) => state); + const { userInfo } = useUserStore((state) => state); + + const { data: postInfo } = useQuery({ + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pstNo], + queryFn: () => PostApi.getPostInfo(bbsId, pstNo), + }); + + const { mutateAsync: updatePost } = useMutation({ + mutationFn: (data: PostUpdateFormData) => + PostApi.updatePost(bbsId, pstNo, data), + onSuccess: () => { + alert("수정되었습니다.", router.back); + }, + }); + + const form = useForm({ + resolver: zodResolver(postUpdateFormSchema), + values: { + ...postInfo, + pstTtl: postInfo?.pstTtl ?? "", + pstPswd: userInfo?.userUnqId ?? "", + }, + }); + + return ( +
+
+

이미지 게시글 수정

+
+ +
+ ); +} + +export { ModifyPage }; diff --git a/apps/common/features/src/widgets/post/model/grid-view-table-columns.tsx b/apps/common/features/src/widgets/post/model/grid-view-table-columns.tsx index 66c144053..4969d2c77 100644 --- a/apps/common/features/src/widgets/post/model/grid-view-table-columns.tsx +++ b/apps/common/features/src/widgets/post/model/grid-view-table-columns.tsx @@ -38,9 +38,9 @@ export const createColumns = ( NEW )} -
- {pstTtl} -
+ + {pstTtl} + ); }, @@ -49,7 +49,6 @@ export const createColumns = ( id: "atflCd", cell: ({ row }) => { const atflCd = row.original.atflCd; - if (!atflCd) return null; return ( { const { rgtrNm } = row.original; - return {rgtrNm}; + return ( + {rgtrNm} + ); }, }, { id: "regDt", cell: ({ row }) => ( - + {dayjs(row.original.regDt).format("YYYY-MM-DD")} ), @@ -102,16 +103,21 @@ const ThumbImage = ({ atflCd, pstNo, thumbRefs }: ThumbImageProps) => { ); - if (!imageUrl) return null; + if (imageUrl) + return ( +
+ 썸네일 이미지 +
+ ); return ( -
- 썸네일 이미지 +
+
); }; diff --git a/apps/common/features/src/widgets/post/ui/post-comment.tsx b/apps/common/features/src/widgets/post/ui/post-comment.tsx index 0bddc1e81..983865935 100644 --- a/apps/common/features/src/widgets/post/ui/post-comment.tsx +++ b/apps/common/features/src/widgets/post/ui/post-comment.tsx @@ -125,7 +125,7 @@ function PostComment({ bbsId, pstNo }: { bbsId: number; pstNo: number }) {