From 054505b75f7fd3983b1863e52a2bc4af9af7c691 Mon Sep 17 00:00:00 2001 From: presentKey Date: Tue, 12 Mar 2024 19:10:01 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EB=A7=81=ED=81=AC=20=EB=B3=B5=EC=82=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileImageSection/ProfileSetupButton.tsx | 13 +++++++++++++ src/features/users/routes/Profile/AboutMe/index.tsx | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/features/users/components/ProfileImageSection/ProfileSetupButton.tsx b/src/features/users/components/ProfileImageSection/ProfileSetupButton.tsx index ddfdf92e..91b592e7 100644 --- a/src/features/users/components/ProfileImageSection/ProfileSetupButton.tsx +++ b/src/features/users/components/ProfileImageSection/ProfileSetupButton.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { useNavigate } from "react-router-dom"; import BackdropPortal from "@/components/Backdrop/BackdropPortal"; +import useToast from "@/components/Toast/useToast"; import DropDownModal from "../DropDownModal"; import useDropDownModal from "../DropDownModal/useDropDownModal"; @@ -16,16 +17,27 @@ import { interface ProfileSetupButtonProps { isMine: boolean; + userName: string; } export default function ProfileSetupButton({ isMine, + userName, }: ProfileSetupButtonProps) { const { isDropDownModalOpen, handleDropDownModalToggle } = useDropDownModal(); const [isReportModalOpen, setIsReportModalOpen] = useState(false); const handleReportModalToggle = () => setIsReportModalOpen((prev) => !prev); const navigate = useNavigate(); + const toast = useToast(); const handleLinkToEditClick = () => navigate("/profile/edit"); + const handleProfileLinkCopyClick = () => { + window.navigator.clipboard // + .writeText(`https://oduck.io/users/${userName}`) + .then( + () => toast.success({ message: "링크가 복사되었어요." }), + () => toast.error({ message: "링크 복사에 실패했어요." }), + ); + }; const handleReportClick = () => { handleDropDownModalToggle(); handleReportModalToggle(); @@ -60,6 +72,7 @@ export default function ProfileSetupButton({ size="lg" variant="solid" color="neutral" + onClick={handleProfileLinkCopyClick} > 프로필 링크 복사 diff --git a/src/features/users/routes/Profile/AboutMe/index.tsx b/src/features/users/routes/Profile/AboutMe/index.tsx index 057dfcc8..37a228f8 100644 --- a/src/features/users/routes/Profile/AboutMe/index.tsx +++ b/src/features/users/routes/Profile/AboutMe/index.tsx @@ -33,7 +33,10 @@ export default function AboutMe({ <> - + From 793f3bed473fb4f3dc2b20d28c7a85811846ce15 Mon Sep 17 00:00:00 2001 From: presentKey Date: Tue, 12 Mar 2024 19:16:47 +0900 Subject: [PATCH 2/3] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/ProfileSetupButton.test.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/features/users/components/ProfileImageSection/tests/ProfileSetupButton.test.tsx b/src/features/users/components/ProfileImageSection/tests/ProfileSetupButton.test.tsx index 055120af..4195026c 100644 --- a/src/features/users/components/ProfileImageSection/tests/ProfileSetupButton.test.tsx +++ b/src/features/users/components/ProfileImageSection/tests/ProfileSetupButton.test.tsx @@ -14,7 +14,10 @@ describe("ProfileSetupButton", () => { customRender( - + , ); @@ -38,7 +41,10 @@ describe("ProfileSetupButton", () => { path="/" element={ - + } /> @@ -61,7 +67,10 @@ describe("ProfileSetupButton", () => { customRender( - + , ); From f37ae500438eeb705741e330396cbda9c91488c9 Mon Sep 17 00:00:00 2001 From: presentKey Date: Tue, 12 Mar 2024 19:32:23 +0900 Subject: [PATCH 3/3] =?UTF-8?q?test:=20customRender=20=EC=BD=94=EB=93=9C?= =?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/__test__/customRender.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__test__/customRender.tsx b/src/__test__/customRender.tsx index 93bb9334..76149929 100644 --- a/src/__test__/customRender.tsx +++ b/src/__test__/customRender.tsx @@ -4,6 +4,7 @@ import { RenderOptions, render } from "@testing-library/react"; import { PropsWithChildren } from "react"; import { OduckApiContext } from "@/contexts/OduckApiContext"; +import { ToastContextProvider } from "@/contexts/ToastContext"; import { theme } from "@/styles/theme"; export default function customRender( @@ -23,8 +24,7 @@ export function RenderWithProviders( - {children} - {/* */} + {children}