From 50f68c6076a5316fe2523b7bc0e9ea48922ea8d5 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:04:54 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=20=EC=8B=9C=20=EA=B8=B0=EB=B3=B8=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/Menu/index.tsx | 3 ++- src/components/order/OrderFilterBar/index.tsx | 14 +++++++++----- src/pages/my/profile/index.tsx | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/auth/Menu/index.tsx b/src/components/auth/Menu/index.tsx index 85352d5a..4a365135 100644 --- a/src/components/auth/Menu/index.tsx +++ b/src/components/auth/Menu/index.tsx @@ -8,6 +8,7 @@ import NextButton from '@/components/common/Button/NextButton'; import NavBottom from '@/components/common/Nav/Bottom'; import FloatingBox from '@/components/common/Layout/Footer/FloatingBox'; import { cartQueries } from '@/apis/cart/queries'; +import defaultImg from '@/assets/images/rectangle.png'; import styles from './Menu.module.scss'; @@ -25,7 +26,7 @@ export default function Menu() {

마이페이지

- +

{userData.nickname}

diff --git a/src/components/order/OrderFilterBar/index.tsx b/src/components/order/OrderFilterBar/index.tsx index 816ca9db..fef6b459 100644 --- a/src/components/order/OrderFilterBar/index.tsx +++ b/src/components/order/OrderFilterBar/index.tsx @@ -1,9 +1,9 @@ -import { useCallback, useRef, useState } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import classNames from 'classnames/bind'; import useDragScroll from '@/hooks/useDragScroll'; +import scrollToTargetX from '@/utils/scrollToTargetX'; import styles from './OrderFilterBar.module.scss'; -import scrollToTargetX from '@/utils/scrollToTargetX'; const cx = classNames.bind(styles); @@ -35,17 +35,21 @@ export default function OrderFilterBar({ onFilterChange }: OrderFilterBarProps) const targetRef = useRef(null); + const [isClicked, setIsClicked] = useState(false); + const handleButtonClick = useCallback( (item: OrderFilterButtonsProps) => { setActiveButton(item); onFilterChange(item.id); - if (targetRef.current) { - targetRef.current.scrollIntoView({ behavior: 'smooth', block: 'center' }); - } + setIsClicked(prev => !prev); }, [onFilterChange] ); + useEffect(() => { + scrollToTargetX(dragScrollProps.ref, targetRef); + }, [dragScrollProps.ref, isClicked]); + return (
{buttonIds.map(item => ( diff --git a/src/pages/my/profile/index.tsx b/src/pages/my/profile/index.tsx index f8883d9f..8f769731 100644 --- a/src/pages/my/profile/index.tsx +++ b/src/pages/my/profile/index.tsx @@ -16,6 +16,7 @@ import BackButton from '@/components/common/Button/BackButton'; import Button from '@/components/common/Button'; import PlusButton from '@/assets/svgs/plus-button.svg'; import { nicknameSchema } from '@/utils/signupFormSchema'; +import defaultImg from '@/assets/images/rectangle.png'; import styles from './Profile.module.scss'; @@ -27,7 +28,7 @@ export default function Profile() { const queryClient = useQueryClient(); const [profileImage, setProfileImage] = useState(); - const [profileImageUrl, setProfileImageUrl] = useState(userData.profileImage || null); + const [profileImageUrl, setProfileImageUrl] = useState(userData.profileImage || defaultImg); const [dogChecked, setDogChecked] = useState(userData.preferredPet === 1 || userData.preferredPet === 0); const [catChecked, setCatChecked] = useState(userData.preferredPet === 2 || userData.preferredPet === 0); From aa337d3cc66aac65e6ba380c00b58bd8e13b7878 Mon Sep 17 00:00:00 2001 From: seolsis Date: Mon, 24 Jun 2024 16:16:50 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=EC=B2=B4=ED=81=AC=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20=EB=9D=BC=EB=B2=A8=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/PaymentAgree.module.scss | 1 + src/components/payment/PaymentAgree.tsx | 29 +++++++++++++++---- src/pages/payment/index.tsx | 8 ++--- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/components/payment/PaymentAgree.module.scss b/src/components/payment/PaymentAgree.module.scss index 92d52d3c..f9e98034 100644 --- a/src/components/payment/PaymentAgree.module.scss +++ b/src/components/payment/PaymentAgree.module.scss @@ -36,6 +36,7 @@ display: flex; gap: 0.8rem; margin: 0.8rem 0; + align-items: center; } .check { diff --git a/src/components/payment/PaymentAgree.tsx b/src/components/payment/PaymentAgree.tsx index 53c28acf..5492782d 100644 --- a/src/components/payment/PaymentAgree.tsx +++ b/src/components/payment/PaymentAgree.tsx @@ -43,19 +43,38 @@ export default function PaymentAgree({ onCheckboxChange }: PaymentAgreeProps) {
-
주문내용 확인 및 결제 동의
+
- -
(필수) 개인정보 수집, 이용 동의
+ +
- -
(필수) 개인정보 제3자 정보 제공 동의
+ +
diff --git a/src/pages/payment/index.tsx b/src/pages/payment/index.tsx index 0dd58c19..d588824e 100644 --- a/src/pages/payment/index.tsx +++ b/src/pages/payment/index.tsx @@ -82,11 +82,8 @@ export default function Payment({ defaultDelivery }: { defaultDelivery: Delivery const remainingProductCount = (products?.length || 0) - 1; const orderName = remainingProductCount > 0 ? `${firstProductTitle} 외 ${remainingProductCount}건` : firstProductTitle; - const selectedProductIds = products.map(product => product.id).join(','); const deliveryMessageValue = deliveryMessage; - console.log(deliveryMessage); - console.log(selectedProductIds); sessionStorage.setItem('deliveryMessage', deliveryMessageValue); sessionStorage.setItem('selectedProductIds', selectedProductIds); delivery && sessionStorage.setItem('deliveryId', delivery.id.toString()); @@ -105,6 +102,7 @@ export default function Payment({ defaultDelivery }: { defaultDelivery: Delivery selectedProducts?.reduce((total, product) => { return total + product.productCost * product.productNumber + product.combinationPrice * product.productNumber; }, 0) ?? 0; + const formattedTotalPrice = totalPrice.toLocaleString('ko-KR'); function calculateTotalOriginalPrice() { return products @@ -173,8 +171,8 @@ export default function Payment({ defaultDelivery }: { defaultDelivery: Delivery ))}
@@ -189,7 +187,7 @@ export default function Payment({ defaultDelivery }: { defaultDelivery: Delivery backgroundColor="$color-pink-main" onClick={handlePayment} disabled={!checkboxChecked || !delivery}> - {totalPrice}원 주문하기 + {formattedTotalPrice}원 주문하기
From c947139512c7e57a0bbf23be496bbe0d54741450 Mon Sep 17 00:00:00 2001 From: seolsis Date: Mon, 24 Jun 2024 16:32:40 +0900 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=EC=98=B5=EC=85=98=EC=9D=B4=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=EB=AA=85=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cart/Card.tsx | 20 +++++++++++--------- src/components/cart/TotalPay.module.scss | 2 ++ src/components/payment/Card.tsx | 12 +++++++----- src/components/payment/TotalPay.module.scss | 4 ++++ src/components/payment/TotalPay.tsx | 8 ++++---- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/cart/Card.tsx b/src/components/cart/Card.tsx index bd9f2914..344f7ed2 100644 --- a/src/components/cart/Card.tsx +++ b/src/components/cart/Card.tsx @@ -47,8 +47,8 @@ export default function Card({ onQuantityChange(newQuantity); } - const formattedOriginalCost = originalCost.toLocaleString('ko-KR'); - const formattedProductCost = productCost.toLocaleString('ko-KR'); + const totalOriginalCost = (originalCost * productNumber + combinationPrice * productNumber).toLocaleString('ko-KR'); + const totalProductCost = (productCost * productNumber + combinationPrice * productNumber).toLocaleString('ko-KR'); const formattedCombinationPrice = combinationPrice.toLocaleString('ko-KR'); return ( @@ -68,15 +68,17 @@ export default function Card({ productImg
{productTitle}
-
-
{option}
-
(+{formattedCombinationPrice}원)
-
+ {option !== '기본' && ( +
+
{option}
+
(+{formattedCombinationPrice}원)
+
+ )}
-
{formattedOriginalCost}원
+
{totalOriginalCost}원
{discountRate.toFixed(0)}%
-
{formattedProductCost}원
+
{totalProductCost}원
@@ -86,7 +88,7 @@ export default function Card({ - + diff --git a/src/components/cart/TotalPay.module.scss b/src/components/cart/TotalPay.module.scss index a0b81b3d..405a8fd4 100644 --- a/src/components/cart/TotalPay.module.scss +++ b/src/components/cart/TotalPay.module.scss @@ -30,6 +30,8 @@ } .totalPrice { + font-size: 1.8rem; + font-weight: 700; margin-top: 1rem; display: flex; justify-content: space-between; diff --git a/src/components/payment/Card.tsx b/src/components/payment/Card.tsx index a4c6b708..cbc784f2 100644 --- a/src/components/payment/Card.tsx +++ b/src/components/payment/Card.tsx @@ -33,11 +33,13 @@ export default function Card({ productImg
{productTitle}
-
-
{option}
-
(+{combinationPrice}원)
-
 | {productNumber}개
-
+ {option !== '기본' && ( +
+
{option}
+
(+{combinationPrice}원)
+
 | {productNumber}개
+
+ )}
{totalOriginalCost}원
diff --git a/src/components/payment/TotalPay.module.scss b/src/components/payment/TotalPay.module.scss index b3f56e56..6c90d714 100644 --- a/src/components/payment/TotalPay.module.scss +++ b/src/components/payment/TotalPay.module.scss @@ -24,6 +24,10 @@ margin-top: 2.4rem; } +.priceBold { + @include font-body1; +} + .line { width: 100%; height: 0.15rem; diff --git a/src/components/payment/TotalPay.tsx b/src/components/payment/TotalPay.tsx index a74d6d7d..c8311ec4 100644 --- a/src/components/payment/TotalPay.tsx +++ b/src/components/payment/TotalPay.tsx @@ -21,19 +21,19 @@ export default function TotalPay({ totalPrice, totalOriginalPrice, title, produc
원가
-
{formattedTotalOriginalPrice}원
+
{formattedTotalOriginalPrice}원
할인 금액
-
-{formattedDiscountAmount}원
+
-{formattedDiscountAmount}원
결제 금액
-
{formattedTotalPrice}원
+
{formattedTotalPrice}원
배송비
-
무료배송
+
무료배송
From 658d9142906d80446b8edba9cc53f7da8acb4aca Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:59:26 +0900 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20=EB=A6=AC=EB=B7=B0=20=EC=93=B0?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20disabled=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/my/order/index.tsx | 75 +++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/src/pages/my/order/index.tsx b/src/pages/my/order/index.tsx index 37c9877f..c92e8417 100644 --- a/src/pages/my/order/index.tsx +++ b/src/pages/my/order/index.tsx @@ -12,10 +12,11 @@ import BackButton from '@/components/common/Button/BackButton'; import { ProductInfo } from '@/components/common/Card'; import OrderFilterBar from '@/components/order/OrderFilterBar'; import OrderCard from '@/components/order/OrderCard'; -import { PurchaseDataProps } from '@/pages/my/review'; +import { PurchaseData, PurchaseDataProps } from '@/pages/my/review'; import Empty from '@/components/order/Empty'; import styles from './Order.module.scss'; +import { getReviewableData, getWroteReviewList } from '@/apis/myReviewAPI'; const cx = classNames.bind(styles); @@ -35,6 +36,22 @@ export default function Order() { setFilterId(filterId); } + function handleClickWriteReview(purchase: PurchaseData) { + return () => { + router.push({ + pathname: `/my/review/write`, + query: { + id: purchase.id, + title: purchase.title, + combinationName: purchase.combinationName, + quantity: purchase.quantity, + thumbNailImage: purchase.thumbNailImage, + productId: purchase.productId, + }, + }); + }; + } + function handleMoveOrderDetail({ purchaseId, purchaseDate }: { purchaseId: number; purchaseDate: string }) { router.push({ pathname: `/my/order/${purchaseId}`, @@ -42,6 +59,17 @@ export default function Order() { }); } + const { data: wroteReviews } = useQuery({ + queryKey: ['wroteReviews'], + queryFn: getWroteReviewList, + }); + + console.log(wroteReviews); + console.log(wroteReviews?.data.map((item: PurchaseData) => item.review.id)); + + const reviewableId = wroteReviews?.data.map((item: PurchaseData) => item.id); + console.log(reviewableId); + const { mutateAsync: mutation } = useMutation({ mutationKey: ['changePurchaseStatus'], mutationFn: async ({ id, body }: { id: number; body: PutProductsRdo }) => { @@ -69,6 +97,7 @@ export default function Order() { console.error('Error cancel purchase:', error); } } + console.log(purchaseData); async function handleExchangeOrRefund(purchaseId: number) { try { @@ -91,11 +120,20 @@ export default function Order() { showToast({ status: 'success', message: '배송 조회를 진행 중입니다.' }); } - function handleWriteReview() { - router.push({ - pathname: `/my/review/write`, - query: purchaseData?.data.id, - }); + function handleWriteReview(purchase: PurchaseData) { + return () => { + router.push({ + pathname: `/my/review/write`, + query: { + id: purchase.id, + title: purchase.title, + combinationName: purchase.combinationName, + quantity: purchase.quantity, + thumbNailImage: purchase.thumbNailImage, + productId: purchase.productId, + }, + }); + }; } const firstButton = (purchaseId: number) => [ @@ -117,12 +155,23 @@ export default function Order() { { id: 4, name: '교환/환불', disabled: true, onClick: () => handleExchangeOrRefund(purchaseId) }, ]; - const thirdButton = (purchaseId: number) => [ - { id: 1, name: '리뷰 쓰기', disabled: true, onClick: () => handleWriteReview() }, - { id: 2, name: '리뷰 쓰기', disabled: true, onClick: () => handleWriteReview() }, - { id: 3, name: '리뷰 쓰기', disabled: false, onClick: () => handleWriteReview() }, - { id: 4, name: '리뷰 쓰기', disabled: true, onClick: () => handleWriteReview() }, + const thirdButton = (purchase: PurchaseData) => [ + { + id: 1, + name: '리뷰 쓰기', + disabled: true, + onClick: handleWriteReview(purchase), + }, + { id: 2, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, + { + id: 3, + name: reviewableId.length > 0 && reviewableId.includes(purchase.id) ? '리뷰 쓰기' : '리뷰 작성 완료', + disabled: reviewableId.length > 0 && reviewableId.includes(purchase.id) ? false : true, + onClick: handleWriteReview(purchase), + }, + { id: 4, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, ]; + if (!purchaseData) return ; if (!purchaseData || (purchaseData.data && purchaseData.data.length === 0)) return ; return ( @@ -170,7 +219,7 @@ export default function Order() {
{item.purchaseProducts .filter((product: ProductInfo) => (filterId === 0 ? true : product.status === filterId - 1)) - .map((purchase: ProductInfo, index) => ( + .map((purchase: ProductInfo) => ( From 0448e725bd81aa083fa3dd98141934184ae4ee06 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:10:08 +0900 Subject: [PATCH 05/11] =?UTF-8?q?fix:=20=EB=82=B4=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../review/WroteReviewCard/index.tsx | 4 +- src/pages/my/order/index.tsx | 5 --- src/pages/my/review/index.tsx | 45 +++++++------------ 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/components/review/WroteReviewCard/index.tsx b/src/components/review/WroteReviewCard/index.tsx index 7e17fbb1..b082a0be 100644 --- a/src/components/review/WroteReviewCard/index.tsx +++ b/src/components/review/WroteReviewCard/index.tsx @@ -14,7 +14,9 @@ export default function WroteReviewCard({ href, productInfo, onClick }: WroteRev
- +
+ +

diff --git a/src/pages/my/order/index.tsx b/src/pages/my/order/index.tsx index c92e8417..c5349263 100644 --- a/src/pages/my/order/index.tsx +++ b/src/pages/my/order/index.tsx @@ -64,11 +64,7 @@ export default function Order() { queryFn: getWroteReviewList, }); - console.log(wroteReviews); - console.log(wroteReviews?.data.map((item: PurchaseData) => item.review.id)); - const reviewableId = wroteReviews?.data.map((item: PurchaseData) => item.id); - console.log(reviewableId); const { mutateAsync: mutation } = useMutation({ mutationKey: ['changePurchaseStatus'], @@ -97,7 +93,6 @@ export default function Order() { console.error('Error cancel purchase:', error); } } - console.log(purchaseData); async function handleExchangeOrRefund(purchaseId: number) { try { diff --git a/src/pages/my/review/index.tsx b/src/pages/my/review/index.tsx index aa179297..35f029bd 100644 --- a/src/pages/my/review/index.tsx +++ b/src/pages/my/review/index.tsx @@ -44,7 +44,6 @@ export default function Review() { const [myReview, setMyReview] = useState(false); const router = useRouter(); - const { reviewId } = router.query; const { data: purchaseData } = useQuery({ queryKey: ['purchase'], queryFn: purchaseApi.getPurchase }); @@ -59,36 +58,22 @@ export default function Review() { queryFn: getWroteReviewList, }); - const reviewableList = - purchaseData && - purchaseData.data.map((item: PurchaseDataProps) => - item.purchaseProducts.map((product: ProductInfo) => ({ - productId: product.productId, - title: product.title, - thumbNailImage: product.thumbNailImage, - originalPrice: product.originalPrice, - price: product.price, - option: product.combinationName, - quantity: product.quantity, - stock: 1, - })) - ); - + console.log(wroteReviews); //TODO: 리뷰 작성 후 테스트 때 적용 // const myReviewList = - // wroteReviews && - // wroteReviews.data.map((item: PurchaseDataProps) => - // item.purchaseProducts.map((product: ProductInfo) => ({ - // productId: product.productId, - // title: product.title, - // thumbNailImage: product.thumbNailImage, - // originalPrice: product.originalPrice, - // price: product.price, - // option: product.combinationName, - // quantity: product.quantity, - // stock: 1, - // })) - // ); + // wroteReviews?.data.length > 0 && + // wroteReviews?.data.map((item: PurchaseDataProps) => + // item.purchaseProducts.map((product: ProductInfo) => ({ + // productId: product.productId, + // title: product.title, + // thumbNailImage: product.thumbNailImage, + // originalPrice: product.originalPrice, + // price: product.price, + // option: product.combinationName, + // quantity: product.quantity, + // stock: 1, + // })) + // ); const purchaseId = purchaseData?.data.flatMap((item: PurchaseDataProps) => item.purchaseProducts.map((item: ProductInfo) => { @@ -180,7 +165,7 @@ export default function Review() { ))} From b93858c7fdeb6d537879bcd5be5d0a85ae4b7b24 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:26:48 +0900 Subject: [PATCH 06/11] =?UTF-8?q?design:=20=ED=86=A0=ED=83=88=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=20=EA=B8=80=EC=94=A8=20=ED=94=84=EB=A1=AD=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cart/TotalPay.tsx | 11 ++++++++--- src/pages/my/order/[purchaseId].tsx | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/cart/TotalPay.tsx b/src/components/cart/TotalPay.tsx index 940325e1..f058c332 100644 --- a/src/components/cart/TotalPay.tsx +++ b/src/components/cart/TotalPay.tsx @@ -1,3 +1,5 @@ +import classNames from 'classnames/bind'; + import styles from './TotalPay.module.scss'; interface TotalPayProps { @@ -5,9 +7,12 @@ interface TotalPayProps { totalOriginalPrice: number; productCount: number; // 전체 상품 수 title: string; + inOrder?: boolean; } -export default function TotalPay({ totalPrice, totalOriginalPrice, title, productCount }: TotalPayProps) { +const cx = classNames.bind(styles); + +export default function TotalPay({ totalPrice, totalOriginalPrice, title, productCount, inOrder }: TotalPayProps) { const discountAmount = (totalOriginalPrice || 0) - (totalPrice || 0); const formattedTotalOriginalPrice = (totalOriginalPrice || 0).toLocaleString('ko-KR'); const formattedTotalPrice = (totalPrice || 0).toLocaleString('ko-KR'); @@ -25,7 +30,7 @@ export default function TotalPay({ totalPrice, totalOriginalPrice, title, produc
할인 금액
-{formattedDiscountAmount}원
-
+
결제 금액
{formattedTotalPrice}원
@@ -35,7 +40,7 @@ export default function TotalPay({ totalPrice, totalOriginalPrice, title, produc
-
+
총 결제 금액
{formattedTotalPrice}원
diff --git a/src/pages/my/order/[purchaseId].tsx b/src/pages/my/order/[purchaseId].tsx index ba43c4bd..4f53e73a 100644 --- a/src/pages/my/order/[purchaseId].tsx +++ b/src/pages/my/order/[purchaseId].tsx @@ -109,6 +109,7 @@ export default function OrderDetail() { totalPrice={totalPrice} totalOriginalPrice={totalOriginalPrice} productCount={orderCount} + inOrder />
{/*
From 8bdfc72d507803352dc7584e179e90d58d723f05 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:33:27 +0900 Subject: [PATCH 07/11] =?UTF-8?q?refactor:=20=EC=BD=98=EC=86=94=20?= =?UTF-8?q?=EC=A7=80=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/my/order/index.tsx | 4 ++-- src/pages/my/review/index.tsx | 18 ------------------ src/pages/onboarding/index.tsx | 1 - 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/pages/my/order/index.tsx b/src/pages/my/order/index.tsx index c5349263..0d335966 100644 --- a/src/pages/my/order/index.tsx +++ b/src/pages/my/order/index.tsx @@ -160,8 +160,8 @@ export default function Order() { { id: 2, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, { id: 3, - name: reviewableId.length > 0 && reviewableId.includes(purchase.id) ? '리뷰 쓰기' : '리뷰 작성 완료', - disabled: reviewableId.length > 0 && reviewableId.includes(purchase.id) ? false : true, + name: reviewableId?.length > 0 && reviewableId.includes(purchase.id) ? '리뷰 쓰기' : '리뷰 작성 완료', + disabled: reviewableId?.length > 0 && reviewableId.includes(purchase.id) ? false : true, onClick: handleWriteReview(purchase), }, { id: 4, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, diff --git a/src/pages/my/review/index.tsx b/src/pages/my/review/index.tsx index 35f029bd..acde5a8a 100644 --- a/src/pages/my/review/index.tsx +++ b/src/pages/my/review/index.tsx @@ -58,23 +58,6 @@ export default function Review() { queryFn: getWroteReviewList, }); - console.log(wroteReviews); - //TODO: 리뷰 작성 후 테스트 때 적용 - // const myReviewList = - // wroteReviews?.data.length > 0 && - // wroteReviews?.data.map((item: PurchaseDataProps) => - // item.purchaseProducts.map((product: ProductInfo) => ({ - // productId: product.productId, - // title: product.title, - // thumbNailImage: product.thumbNailImage, - // originalPrice: product.originalPrice, - // price: product.price, - // option: product.combinationName, - // quantity: product.quantity, - // stock: 1, - // })) - // ); - const purchaseId = purchaseData?.data.flatMap((item: PurchaseDataProps) => item.purchaseProducts.map((item: ProductInfo) => { return item.productId; @@ -125,7 +108,6 @@ export default function Review() { setReviewWrite(false); } - console.log(wroteReviews?.data); return (
diff --git a/src/pages/onboarding/index.tsx b/src/pages/onboarding/index.tsx index 2dd4a654..086bbe74 100644 --- a/src/pages/onboarding/index.tsx +++ b/src/pages/onboarding/index.tsx @@ -29,7 +29,6 @@ export default function Onboarding() { return response; }, onSuccess: data => { - console.log(data); queryClient.invalidateQueries({ queryKey: ['user'], }); From 4e1d20bd722898f5062f9d4a84ad6d95a69d3f77 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:38:51 +0900 Subject: [PATCH 08/11] =?UTF-8?q?fix:=20=EA=B5=AC=EB=A7=A4=EB=82=B4?= =?UTF-8?q?=EC=97=AD=20=EB=A6=AC=EB=B7=B0=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=9B=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/auth/LoginButton/GoogleLogin.tsx | 2 +- src/pages/my/order/[purchaseId].tsx | 4 +++- src/pages/my/order/index.tsx | 11 ++++++----- src/pages/my/review/index.tsx | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/auth/LoginButton/GoogleLogin.tsx b/src/components/auth/LoginButton/GoogleLogin.tsx index 0ff70db7..54054167 100644 --- a/src/components/auth/LoginButton/GoogleLogin.tsx +++ b/src/components/auth/LoginButton/GoogleLogin.tsx @@ -11,7 +11,7 @@ export default function GoogleLogin() {
- 카카오로 계속하기 + 구글로 계속하기
diff --git a/src/pages/my/order/[purchaseId].tsx b/src/pages/my/order/[purchaseId].tsx index 4f53e73a..fbac6b12 100644 --- a/src/pages/my/order/[purchaseId].tsx +++ b/src/pages/my/order/[purchaseId].tsx @@ -32,6 +32,7 @@ export default function OrderDetail() { detailedAddress: purchaseDetailData.data.detailedAddress, zipCode: purchaseDetailData.data.zipCode, message: purchaseDetailData.data.deliveryMessage, + deliveryName: purchaseDetailData.data.deliveryName, }; function calculateTotalOriginalPrice() { @@ -71,7 +72,7 @@ export default function OrderDetail() {

배송지

-

{deliveryInfo?.recipient} 집

+

{deliveryInfo?.deliveryName}

{deliveryInfo?.recipient} · {deliveryInfo?.recipientPhoneNumber}
@@ -98,6 +99,7 @@ export default function OrderDetail() { status={order.status as number} productInfo={{ ...order, stock: 3, option: order.combinationName }} tagText={getTagText(order.status)} + href={`/my/order/${purchaseId}`} /> ))}
diff --git a/src/pages/my/order/index.tsx b/src/pages/my/order/index.tsx index 0d335966..94829994 100644 --- a/src/pages/my/order/index.tsx +++ b/src/pages/my/order/index.tsx @@ -64,7 +64,7 @@ export default function Order() { queryFn: getWroteReviewList, }); - const reviewableId = wroteReviews?.data.map((item: PurchaseData) => item.id); + const notReviewableId = wroteReviews?.data.map((item: PurchaseData) => item.id); const { mutateAsync: mutation } = useMutation({ mutationKey: ['changePurchaseStatus'], @@ -116,6 +116,7 @@ export default function Order() { } function handleWriteReview(purchase: PurchaseData) { + console.log(purchase); return () => { router.push({ pathname: `/my/review/write`, @@ -125,7 +126,7 @@ export default function Order() { combinationName: purchase.combinationName, quantity: purchase.quantity, thumbNailImage: purchase.thumbNailImage, - productId: purchase.productId, + productId: 1, }, }); }; @@ -160,8 +161,8 @@ export default function Order() { { id: 2, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, { id: 3, - name: reviewableId?.length > 0 && reviewableId.includes(purchase.id) ? '리뷰 쓰기' : '리뷰 작성 완료', - disabled: reviewableId?.length > 0 && reviewableId.includes(purchase.id) ? false : true, + name: notReviewableId?.length > 0 && notReviewableId.includes(purchase.id) ? '리뷰 작성 완료' : '리뷰 쓰기', + disabled: notReviewableId?.length > 0 && notReviewableId.includes(purchase.id) ? true : false, onClick: handleWriteReview(purchase), }, { id: 4, name: '리뷰 쓰기', disabled: true, onClick: handleWriteReview(purchase) }, @@ -217,7 +218,7 @@ export default function Order() { .map((purchase: ProductInfo) => ( { router.push({ pathname: `/my/review/write`, From e246c30a6a671ee13af9885c0a9ad12d723afa9f Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:55:23 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20input=20onBlur=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/my/info/index.tsx | 33 +++++++++++++++++++++------------ src/pages/my/profile/index.tsx | 1 + src/utils/signupFormSchema.ts | 6 ++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/pages/my/info/index.tsx b/src/pages/my/info/index.tsx index 2d5c1b83..efbda8df 100644 --- a/src/pages/my/info/index.tsx +++ b/src/pages/my/info/index.tsx @@ -1,5 +1,5 @@ import { useRouter } from 'next/router'; -import { SubmitHandler, useForm } from 'react-hook-form'; +import { Controller, SubmitHandler, useForm } from 'react-hook-form'; import { QueryClient, dehydrate, useMutation, useQueryClient } from '@tanstack/react-query'; import * as Yup from 'yup'; import { yupResolver } from '@hookform/resolvers/yup'; @@ -68,12 +68,13 @@ export default function Info() { const methods = useForm({ resolver: yupResolver(phoneNumberSchema), + mode: 'onBlur', }); const { formState: { errors }, } = methods; - const { register, handleSubmit } = methods; + const { register, handleSubmit, control } = methods; const onSubmit: SubmitHandler = data => { const userEditData: UserEditProps = { @@ -83,7 +84,6 @@ export default function Info() { isSubscribedToPromotions: userData.isSubscribedToPromotions, preferredPet: userData.preferredPet, }; - console.log(data); const params: UserEditParams = { id: userData.id, @@ -133,15 +133,24 @@ export default function Info() { background="background" placeholder={userData.email} /> - ( + { + field.onBlur(); + }} + isError={errors.phoneNumber && true} + labelStyle={'label'} + placeholder="000-0000-0000 형식으로 입력해주세요" + defaultValue={userData.phoneNumber} + /> + )} {...register('phoneNumber')} /> {errors.phoneNumber && {errors.phoneNumber.message}} diff --git a/src/pages/my/profile/index.tsx b/src/pages/my/profile/index.tsx index 8f769731..40e4c5f3 100644 --- a/src/pages/my/profile/index.tsx +++ b/src/pages/my/profile/index.tsx @@ -68,6 +68,7 @@ export default function Profile() { const methods = useForm({ resolver: yupResolver(nicknameSchema), + mode: 'onBlur', }); const { diff --git a/src/utils/signupFormSchema.ts b/src/utils/signupFormSchema.ts index 0c54136b..c282bfab 100644 --- a/src/utils/signupFormSchema.ts +++ b/src/utils/signupFormSchema.ts @@ -30,10 +30,8 @@ const signupFormSchema = Yup.object().shape({ }); export const phoneNumberSchema = Yup.object({ - phoneNumber: Yup.string() - .matches(/010-\d{3,4}-\d{4}$/, '연락처 입력 형식을 확인해주세요. (000-0000-0000)') - .required('연락처를 입력해주세요'), -}).required(); + phoneNumber: Yup.string().matches(/010-\d{3,4}-\d{4}$/, '연락처 입력 형식을 확인해주세요. (000-0000-0000)'), +}); export const nicknameSchema = Yup.object({ nickname: Yup.string() From fd0dbb306ecf9df497fc30be5c07c18814324d7a Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:00:19 +0900 Subject: [PATCH 10/11] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/my/info/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/my/info/index.tsx b/src/pages/my/info/index.tsx index efbda8df..0cfd205b 100644 --- a/src/pages/my/info/index.tsx +++ b/src/pages/my/info/index.tsx @@ -79,7 +79,7 @@ export default function Info() { const onSubmit: SubmitHandler = data => { const userEditData: UserEditProps = { nickname: userData.nickname, - phoneNumber: data.phoneNumber, + phoneNumber: data.phoneNumber || userData.phoneNumber, profileImage: userData.profileImage, isSubscribedToPromotions: userData.isSubscribedToPromotions, preferredPet: userData.preferredPet, From 2e3af634276df59de5806657594d0c282bc071e7 Mon Sep 17 00:00:00 2001 From: Seoin <144193370+Seoin02@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:00:17 +0900 Subject: [PATCH 11/11] =?UTF-8?q?design:=20=EB=A7=9E=EC=B6=A4=20=EC=83=81?= =?UTF-8?q?=ED=92=88=20=EC=B6=94=EC=B2=9C=20=EC=8A=AC=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=93=9C=20=ED=8C=A8=EB=94=A9=20=EC=97=86=EC=95=A0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/order/Empty/Empty.module.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/order/Empty/Empty.module.scss b/src/components/order/Empty/Empty.module.scss index 66d28d71..bd7de4e2 100644 --- a/src/components/order/Empty/Empty.module.scss +++ b/src/components/order/Empty/Empty.module.scss @@ -35,7 +35,6 @@ display: flex; flex-direction: column; padding-top: 2.4rem; - padding-right: 1.6rem; justify-content: space-between; align-items: flex-start; align-self: stretch;