Skip to content

Commit fa5d5ab

Browse files
committed
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react into feat/OD-179
2 parents a7f0797 + aa538f8 commit fa5d5ab

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

src/assets/default/share.svg

Lines changed: 20 additions & 0 deletions
Loading

src/pages/Home/OOTD/Feed/index.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getCurrentUserId } from '@utils/getCurrentUserId';
1919
import defaultProfile from '@assets/default/defaultProfile.svg';
2020
import more from '@assets/default/more.svg';
2121
import xBtn from '@assets/default/reject.svg';
22+
import share from '@assets/default/share.svg';
2223

2324
import Heart from '@components/Icons/Heart';
2425
import Message from '@components/Icons/Message';
@@ -209,6 +210,24 @@ const Feed: React.FC<FeedProps> = ({ feed }) => {
209210
},
210211
};
211212

213+
// 친구한테 프로필 공유하기
214+
const handleShareButtonClick = (e: React.MouseEvent) => {
215+
e.stopPropagation();
216+
// 사용자 ID로 프로필 URL 생성
217+
const profileUrl = `${window.location.origin}/profile/${feed.user.id}`;
218+
219+
navigator.clipboard
220+
.writeText(profileUrl)
221+
.then(() => {
222+
setModalContent(`${feed.user.nickname}님의 프로필이 복사되었습니다!`);
223+
setIsStatusModalOpen(true); // 복사 성공 후 모달 열기
224+
})
225+
.catch(() => {
226+
setModalContent('프로필 복사에 실패했습니다. 다시 시도해 주세요.');
227+
setIsStatusModalOpen(true); // 복사 실패 시 모달 열기
228+
});
229+
};
230+
212231
return (
213232
<FeedWrapper onClick={handleFeedClick}>
214233
<FeedTop>
@@ -251,7 +270,11 @@ const Feed: React.FC<FeedProps> = ({ feed }) => {
251270
<div className="button" onClick={handleLikeButtonClick}>
252271
<Heart isFilled={isLikeClicked} />
253272
</div>
273+
<div className="button" onClick={handleShareButtonClick}>
274+
<img src={share} alt="공유" />
275+
</div>
254276
</Reaction>
277+
255278
<MatchingBtn onClick={handleMatchingButtonClick}>
256279
<Message width="16" height="16" color="white" />
257280
<StyledText $textTheme={{ style: 'body1-regular' }} color={theme.colors.text.contrast}>

0 commit comments

Comments
 (0)