From 419099d233853810fba4ac3843127c503dc87536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A7=80=EC=B2=A0?= Date: Mon, 30 Jun 2025 19:33:31 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8D=BC=EA=B0=80=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/widgets/post/ui/post-action.tsx | 22 + pnpm-lock.yaml | 3690 +++++++++-------- 2 files changed, 1994 insertions(+), 1718 deletions(-) diff --git a/apps/common/features/src/widgets/post/ui/post-action.tsx b/apps/common/features/src/widgets/post/ui/post-action.tsx index 4eaa960cb..eb0acef5f 100644 --- a/apps/common/features/src/widgets/post/ui/post-action.tsx +++ b/apps/common/features/src/widgets/post/ui/post-action.tsx @@ -2,6 +2,7 @@ import { useRouter, usePathname } from "next/navigation"; import { useConfirm } from "@frontend-opensource/use-react-hooks"; import { Button } from "@common/components"; import { useMenuStore, useUserStore } from "@/shared/lib"; +import { useState } from 'react'; type PostActionProps = { bbsId: string; @@ -16,6 +17,7 @@ function PostAction({ children, handleDelete }: PostActionProps) { const { confirm } = useConfirm(); const bbsInfo = useMenuStore((state) => state.bbsInfo); const userInfo = useUserStore((state) => state.userInfo); + const [copied, setCopied] = useState(false); const onDelete = async () => { if (await confirm("삭제하시겠습니까?")) handleDelete(); @@ -33,11 +35,31 @@ function PostAction({ children, handleDelete }: PostActionProps) { // 비회원 return true; }; + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(window.location.href); + setCopied(true); + setTimeout(() => setCopied(false), 2000); // 2초 후 상태 초기화 + alert("복사되었습니다..") + } catch (err) { + console.error('복사 실패:', err); + } + }; + return ( <> {children}
+ +