From 8aef38b534e2a4f2917ee441ee6a96b9eaa3eb96 Mon Sep 17 00:00:00 2001 From: uraflower <82873315+uraflower@users.noreply.github.com> Date: Thu, 30 May 2024 17:14:39 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[feat]:=20=EC=84=A0=EB=AC=BC=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=ED=95=B8=EB=93=A4=EB=9F=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Product/BuyInfo/ButtonBundles/index.tsx | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx index 0b0825d0..45d4a499 100644 --- a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx +++ b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx @@ -4,6 +4,9 @@ import { Button } from 'components/ui/Button'; import FundingModal from 'components/ui/Modal/FundingModal'; import WishModal from 'components/ui/Modal/WishModal'; +import { useSelectedFriendsStore } from 'store/useSelectedFriendsStore'; + +import { useKakaoPicker } from 'hooks/useKakaoPicker'; import { useLogin } from 'hooks/useLogin'; import { useModal } from 'hooks/useModal'; import { formatNumberWithPlus } from 'utils/format'; @@ -34,6 +37,9 @@ const ButtonBundles = ({ productDescription; const navigate = useNavigate(); const { isLoggedIn, login, confirmLogin } = useLogin(); + const { isSelected, isSelfSelected, selectedFriends } = + useSelectedFriendsStore(); + const { openKakaoPicker } = useKakaoPicker(); const { isOpen: isFundingOpen, @@ -107,9 +113,18 @@ const ButtonBundles = ({ // 친구에게 선물하기 버튼 핸들러 const handleClickGiftForFriend = () => { checkLoginBeforeAction(() => { - // TODO: 친구를 선택하지 않은 경우 피커 오픈 - // 친구를 선택한 경우 선물 결제 페이지로 이동 - navigate('/bill/gift', { state: { orderInfos, giftFor: 'friends' } }); + if (!isSelected) { + openKakaoPicker(); + return; + } + + if (isSelfSelected) { + navigate('/bill/gift', { state: { orderInfos, giftFor: 'me' } }); + } else if (selectedFriends.length === 1) { + navigate('/bill/gift', { state: { orderInfos, giftFor: 'friends' } }); + } else { + alert('지금은 한 번에 한 명에게만 선물할 수 있어요.'); + } }); }; From 53095890c76b1cbbe88b70a08f4cf7a843f3841c Mon Sep 17 00:00:00 2001 From: uraflower <82873315+uraflower@users.noreply.github.com> Date: Thu, 30 May 2024 17:56:20 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[refactor]:=20=ED=94=BC=EC=BB=A4=20?= =?UTF-8?q?=EC=B9=9C=EA=B5=AC=20=ED=94=84=EB=A1=9C=ED=95=84=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20get=20=ED=95=A8=EC=88=98=20=EB=B3=80=EA=B2=BD=20(#3?= =?UTF-8?q?24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit default url을 인자로 받도록 수정 --- src/layouts/Home/Receiver/index.tsx | 5 ++++- src/store/useSelectedFriendsStore.ts | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/layouts/Home/Receiver/index.tsx b/src/layouts/Home/Receiver/index.tsx index a26d8755..311fa974 100644 --- a/src/layouts/Home/Receiver/index.tsx +++ b/src/layouts/Home/Receiver/index.tsx @@ -8,6 +8,8 @@ import { useKakaoPicker } from 'hooks/useKakaoPicker'; import { useLogin } from 'hooks/useLogin'; import { getSessionStorageItem } from 'utils/sessionStorage'; +import DefaultImgUrl from 'assets/bg_profile_default.png'; + import FriendFunding from './FriendFunding'; import FriendWish from './FriendWish'; @@ -32,7 +34,8 @@ const Receiver = () => { (state) => state.clearSelectedFriends, ); const { isLoggedIn, login, confirmLogin } = useLogin(); - const PROFILE_IMAGE = isLoggedIn && isSelfSelected ? profileUrl : getImgUrl(); + const PROFILE_IMAGE = + isLoggedIn && isSelfSelected ? profileUrl : getImgUrl(DefaultImgUrl); const isKakaoConnected = window.Kakao?.isInitialized(); const getTitle = () => { diff --git a/src/store/useSelectedFriendsStore.ts b/src/store/useSelectedFriendsStore.ts index 9c9fbe8d..776ec8a4 100644 --- a/src/store/useSelectedFriendsStore.ts +++ b/src/store/useSelectedFriendsStore.ts @@ -3,7 +3,6 @@ import { persist } from 'zustand/middleware'; import { PickerResponseData, User } from 'types/user'; -import defaultImgUrl from 'assets/bg_profile_default.png'; import friendsDefaultImgUrl from 'assets/profile_default.png'; import peopleImgUrl from 'assets/profile_people.png'; @@ -20,7 +19,7 @@ type SelectedFriendsAction = { name: User['name'], providerId: User['providerId'], ) => void; - getImgUrl: () => string; + getImgUrl: (defaultImgUrl: string) => string; clearSelectedFriends: () => void; }; @@ -54,7 +53,7 @@ export const useSelectedFriendsStore = create< selectedHeadCount: 0, }), - getImgUrl: () => { + getImgUrl: (defaultImgUrl: string) => { const selectCount = get().selectedHeadCount; if (selectCount > 1) return peopleImgUrl; From f59101ae36a45a400653460520fc206536a9f4ea Mon Sep 17 00:00:00 2001 From: uraflower <82873315+uraflower@users.noreply.github.com> Date: Thu, 30 May 2024 17:57:54 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[feat]:=20=EC=84=A0=ED=83=9D=ED=95=9C=20?= =?UTF-8?q?=EC=B9=9C=EA=B5=AC=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EB=82=B4=20=ED=94=84=EB=A1=9C=ED=95=84=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20=EB=B3=80=EA=B2=BD=20(#324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BuyInfo/ButtonBundles/index.module.scss | 11 ++++++++--- .../Product/BuyInfo/ButtonBundles/index.tsx | 14 ++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/layouts/Product/BuyInfo/ButtonBundles/index.module.scss b/src/layouts/Product/BuyInfo/ButtonBundles/index.module.scss index 765adb2a..5b05a41c 100644 --- a/src/layouts/Product/BuyInfo/ButtonBundles/index.module.scss +++ b/src/layouts/Product/BuyInfo/ButtonBundles/index.module.scss @@ -47,13 +47,18 @@ .btn_gift { @include size(40%, 60px, 0 0 0 5px, 0); - .img_profile { + .wrapper_profile { @include size(32px, 32px, 0, 0); position: relative; margin-right: 6px; - background-image: url('assets/profile_noimg.png'); - background-size: cover; + + .img_profile { + @include masking; + + width: 100%; + object-fit: cover; + } } .ico_profile { diff --git a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx index 45d4a499..0d758ab6 100644 --- a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx +++ b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx @@ -14,6 +14,8 @@ import { formatNumberWithPlus } from 'utils/format'; import { RequestOrderPreview } from 'types/payment'; import { OptionDetail, ProductDescriptionResponse } from 'types/product'; +import DefaultProfileImage from 'assets/profile_noimg.png'; + import styles from './index.module.scss'; const mockData = { @@ -37,7 +39,7 @@ const ButtonBundles = ({ productDescription; const navigate = useNavigate(); const { isLoggedIn, login, confirmLogin } = useLogin(); - const { isSelected, isSelfSelected, selectedFriends } = + const { isSelected, isSelfSelected, selectedFriends, getImgUrl } = useSelectedFriendsStore(); const { openKakaoPicker } = useKakaoPicker(); @@ -186,10 +188,14 @@ const ButtonBundles = ({ onClick={handleClickGiftForFriend} className={styles.btn_gift} > - - {/* TODO : 로그인 되었을 때만 보이게 */} +
+ 선물할 친구 프로필 사진 - +
선물하기 From 81c118add2722da1dda4e1e5359a1ada23a2c452 Mon Sep 17 00:00:00 2001 From: uraflower <82873315+uraflower@users.noreply.github.com> Date: Thu, 30 May 2024 18:13:40 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[feat]:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=ED=94=BC?= =?UTF-8?q?=EC=BB=A4=20=EC=98=A4=ED=94=88=20(#324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/Product/BuyInfo/ButtonBundles/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx index 0d758ab6..f89123fa 100644 --- a/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx +++ b/src/layouts/Product/BuyInfo/ButtonBundles/index.tsx @@ -130,6 +130,12 @@ const ButtonBundles = ({ }); }; + // 친구 프로필 이미지 클릭 핸들러 + const handleClickProfile = (e: React.MouseEvent) => { + e.stopPropagation(); + openKakaoPicker(); + }; + // 선물상자 담기 버튼 핸들러 const handleClickCart = () => { // console.log('선물상자 담기'); @@ -188,7 +194,7 @@ const ButtonBundles = ({ onClick={handleClickGiftForFriend} className={styles.btn_gift} > -
+