From b9ca36c412c0d9d9e1e1219954c62b7788ec0717 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Fri, 26 Jan 2024 15:34:46 +0900 Subject: [PATCH 01/12] =?UTF-8?q?refactor:=20=EB=8B=A4=EA=B0=80=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EC=97=AC=ED=96=89=20=EC=97=86=EC=9D=84=EC=8B=9C=20?= =?UTF-8?q?=ED=83=80=EC=9D=B4=ED=8B=80=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTripBeforeList.tsx | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/MyTrip/MyTripBeforeList.tsx b/src/components/MyTrip/MyTripBeforeList.tsx index 88dc770f..29ff4b81 100644 --- a/src/components/MyTrip/MyTripBeforeList.tsx +++ b/src/components/MyTrip/MyTripBeforeList.tsx @@ -12,18 +12,22 @@ const MyTripBeforeList: React.FC = ({ myTripsData }) => { return
데이터를 불러오는 중 오류가 발생했습니다.
; } - return ( - <> -
-

다가오는 여행

-
-
- {myTripsData.map((myTripList: MyTripType) => ( - - ))} -
- - ); + if (myTripsData.length > 0) { + return ( + <> +
+

다가오는 여행

+
+
+ {myTripsData.map((myTripList: MyTripType) => ( + + ))} +
+ + ); + } else { + return null; + } }; export default MyTripBeforeList; From e5664dd75ecdd8ca013da9b8e6515d14d1ca2f36 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Fri, 26 Jan 2024 17:14:53 +0900 Subject: [PATCH 02/12] =?UTF-8?q?style:=20qa=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyTrip/MyTrip.tsx | 6 +++--- src/components/MyTrip/MyTripAfterList.tsx | 8 ++++---- src/components/MyTrip/MyTripBeforeList.tsx | 8 ++++---- src/components/MyTrip/MyTripIngItem.tsx | 2 +- src/components/MyTrip/MyTripIngList.tsx | 2 +- src/components/MyTrip/MyTripItem.tsx | 2 +- .../Trip/LikedToursLists/LikedToursListCategoryItem.tsx | 2 +- src/components/Wish/Wish.tsx | 8 +++++--- src/components/Wish/WishCategoryItem.tsx | 2 +- src/components/Wish/WishItem.tsx | 2 +- src/components/Wish/WishList.tsx | 2 +- 11 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/components/MyTrip/MyTrip.tsx b/src/components/MyTrip/MyTrip.tsx index c80f12fc..1062e245 100644 --- a/src/components/MyTrip/MyTrip.tsx +++ b/src/components/MyTrip/MyTrip.tsx @@ -30,9 +30,9 @@ const MyTrip = () => { const { ingTrips, beforeTrips, afterTrips } = classifyTrips(data); return ( -
-
-

나의 여정

+
+
+

나의 여정

{data.length > 0 ? ( <> diff --git a/src/components/MyTrip/MyTripAfterList.tsx b/src/components/MyTrip/MyTripAfterList.tsx index c5d65cb4..c7ddd74c 100644 --- a/src/components/MyTrip/MyTripAfterList.tsx +++ b/src/components/MyTrip/MyTripAfterList.tsx @@ -19,16 +19,16 @@ const MyTripAfterList: React.FC = ({ myTripsData }) => { if (sortedTrips.length > 0) { return ( - <> -
+
+

지난 여행

-
+
{sortedTrips.map((myTripList: MyTripType) => ( ))}
- +
); } else { return null; diff --git a/src/components/MyTrip/MyTripBeforeList.tsx b/src/components/MyTrip/MyTripBeforeList.tsx index 29ff4b81..c6792597 100644 --- a/src/components/MyTrip/MyTripBeforeList.tsx +++ b/src/components/MyTrip/MyTripBeforeList.tsx @@ -14,16 +14,16 @@ const MyTripBeforeList: React.FC = ({ myTripsData }) => { if (myTripsData.length > 0) { return ( - <> -
+
+

다가오는 여행

-
+
{myTripsData.map((myTripList: MyTripType) => ( ))}
- +
); } else { return null; diff --git a/src/components/MyTrip/MyTripIngItem.tsx b/src/components/MyTrip/MyTripIngItem.tsx index 3ff6392c..328a80d0 100644 --- a/src/components/MyTrip/MyTripIngItem.tsx +++ b/src/components/MyTrip/MyTripIngItem.tsx @@ -24,7 +24,7 @@ const MyTripIngItem: React.FC = ({ myTripList }) => { alt="여행지 이미지" />
-
+
{tripStatus} diff --git a/src/components/MyTrip/MyTripIngList.tsx b/src/components/MyTrip/MyTripIngList.tsx index 758a4f71..01cf3210 100644 --- a/src/components/MyTrip/MyTripIngList.tsx +++ b/src/components/MyTrip/MyTripIngList.tsx @@ -14,7 +14,7 @@ const MyTripIngList: React.FC = ({ myTripsData }) => { return ( <> -
+
{myTripsData.map((myTripList: MyTripType) => ( ))} diff --git a/src/components/MyTrip/MyTripItem.tsx b/src/components/MyTrip/MyTripItem.tsx index b5878161..4fe80cce 100644 --- a/src/components/MyTrip/MyTripItem.tsx +++ b/src/components/MyTrip/MyTripItem.tsx @@ -54,7 +54,7 @@ const MyTripItem: React.FC = ({ myTripList }) => {
navigate(`/trip/${tripId}`)}>
diff --git a/src/components/Trip/LikedToursLists/LikedToursListCategoryItem.tsx b/src/components/Trip/LikedToursLists/LikedToursListCategoryItem.tsx index 9172815d..a461e4f0 100644 --- a/src/components/Trip/LikedToursLists/LikedToursListCategoryItem.tsx +++ b/src/components/Trip/LikedToursLists/LikedToursListCategoryItem.tsx @@ -22,7 +22,7 @@ export const LikedToursListCategoryItem: React.FC< return ( ); diff --git a/src/components/Wish/Wish.tsx b/src/components/Wish/Wish.tsx index 560a700a..296c4a77 100644 --- a/src/components/Wish/Wish.tsx +++ b/src/components/Wish/Wish.tsx @@ -44,9 +44,11 @@ const Wish = () => { } return ( -
-
-

나의 관심 목록

+
+
+

+ 나의 관심 목록 +

diff --git a/src/components/Wish/WishCategoryItem.tsx b/src/components/Wish/WishCategoryItem.tsx index 8704adff..4fcf3516 100644 --- a/src/components/Wish/WishCategoryItem.tsx +++ b/src/components/Wish/WishCategoryItem.tsx @@ -27,7 +27,7 @@ const WishCategoryItem: React.FC = ({ return ( ); diff --git a/src/components/Wish/WishItem.tsx b/src/components/Wish/WishItem.tsx index 75928caa..41540feb 100644 --- a/src/components/Wish/WishItem.tsx +++ b/src/components/Wish/WishItem.tsx @@ -32,7 +32,7 @@ const WishItem: React.FC = ({ wishList }) => { return (
navigate(`/detail/${id}`)}>
diff --git a/src/components/Wish/WishList.tsx b/src/components/Wish/WishList.tsx index c4fbb68d..3889d820 100644 --- a/src/components/Wish/WishList.tsx +++ b/src/components/Wish/WishList.tsx @@ -45,7 +45,7 @@ const WishList: React.FC = ({
}> -
+
{isLoading ? Array.from({ length: 10 }, (_, index) => ( From 0ba22308581113440135669ac47fddeeac3cf2f4 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Fri, 26 Jan 2024 17:27:08 +0900 Subject: [PATCH 03/12] =?UTF-8?q?style:=20=EB=94=94=EC=9E=90=EC=9D=B8=20QA?= =?UTF-8?q?=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trip/LikedToursList.tsx | 2 +- src/components/Trip/LikedToursLists/LikedToursListBox.tsx | 2 +- .../Trip/LikedToursLists/LikedToursListCategory.tsx | 2 +- src/components/Trip/LikedToursLists/LikedToursListItem.tsx | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Trip/LikedToursList.tsx b/src/components/Trip/LikedToursList.tsx index 9fa49f59..fcca4483 100644 --- a/src/components/Trip/LikedToursList.tsx +++ b/src/components/Trip/LikedToursList.tsx @@ -68,7 +68,7 @@ export const LikedToursList = () => { }, []); return ( -
+
{data?.pages[0].data.content.length > 0 ? ( diff --git a/src/components/Trip/LikedToursLists/LikedToursListBox.tsx b/src/components/Trip/LikedToursLists/LikedToursListBox.tsx index 39ef3aae..45bba12d 100644 --- a/src/components/Trip/LikedToursLists/LikedToursListBox.tsx +++ b/src/components/Trip/LikedToursLists/LikedToursListBox.tsx @@ -48,7 +48,7 @@ const LikedToursListBox: React.FC = ({ {/* */}
}> -
+
{isLoading ? Array.from({ length: 10 }, (_, index) => ( diff --git a/src/components/Trip/LikedToursLists/LikedToursListCategory.tsx b/src/components/Trip/LikedToursLists/LikedToursListCategory.tsx index 8e78be04..1ffe97d4 100644 --- a/src/components/Trip/LikedToursLists/LikedToursListCategory.tsx +++ b/src/components/Trip/LikedToursLists/LikedToursListCategory.tsx @@ -27,7 +27,7 @@ const LikedToursListCategory: React.FC = ({ }; return ( -
+
{categories.map((category) => { return ( = ({ />
-
+

{title} @@ -105,7 +105,7 @@ const LikedToursListItem: React.FC = ({

-
+

{tourAddress ? tourAddress : '주소를 제공하지 않고 있어요'}

From 2b6f276b8408998ba2f574ae55efc05d77b9ac99 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Fri, 26 Jan 2024 18:21:47 +0900 Subject: [PATCH 04/12] =?UTF-8?q?Refactor:=20=EB=93=9C=EB=A1=AD=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthInputBox/AuthInputItem/AuthInput.tsx | 2 +- .../SignupInfo/AuthDropDown/AuthDropDown.tsx | 102 ++++++------------ .../AuthDropDown/AuthDropDownOption.tsx | 82 +++----------- .../Auth/SignupInfo/SignupInfoForm.tsx | 6 +- src/components/Mypage/UserInfoForm.tsx | 8 +- src/components/common/icons/Icons.tsx | 18 ++++ src/utils/authSelectOptions.ts | 2 - 7 files changed, 75 insertions(+), 145 deletions(-) diff --git a/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx b/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx index 6a6ea0f9..94943892 100644 --- a/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx +++ b/src/components/Auth/AuthInput/AuthInputBox/AuthInputItem/AuthInput.tsx @@ -33,7 +33,7 @@ const AuthInput = ({ return (
-
diff --git a/src/components/Mypage/UserInfoForm.tsx b/src/components/Mypage/UserInfoForm.tsx index 6126a244..ae351363 100644 --- a/src/components/Mypage/UserInfoForm.tsx +++ b/src/components/Mypage/UserInfoForm.tsx @@ -34,6 +34,8 @@ const UserInfoForm = () => { setValue('ageType', userInfo?.ageType); }, [userInfo]); + console.log(watch()); + const onInfoSubmit: SubmitHandler = async (data) => { const { nickname, profileImageUrl, genderType, ageType } = data; @@ -85,13 +87,15 @@ const UserInfoForm = () => { label="성별" options={genderArr} name={'genderType'} - register={register} + setValue={setValue} + value={watch('genderType')} />
diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index 1969e0b1..1612c7b6 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -1792,3 +1792,21 @@ export const GrayCalendarIcon: React.FC = ({}) => { ); }; + +export const AuthDropDownIcon = () => { + return ( + + + + ); +}; diff --git a/src/utils/authSelectOptions.ts b/src/utils/authSelectOptions.ts index d16d0a59..576bbc79 100644 --- a/src/utils/authSelectOptions.ts +++ b/src/utils/authSelectOptions.ts @@ -1,12 +1,10 @@ export const genderArr: SelectOption[] = [ - { id: '', value: '성별을 선택해주세요.' }, { id: 'FEMALE', value: '여' }, { id: 'MALE', value: '남' }, { id: 'NON_BINARY', value: '기타' }, ]; export const ageArr: SelectOption[] = [ - { id: '', value: '연령대를 설정해주세요.' }, { id: 'TEENAGER', value: '10대' }, { id: 'TWENTIES', value: '20대' }, { id: 'THIRTIES', value: '30대' }, From 8363781352c3c804e4b131e3801452d82ccf9cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Fri, 26 Jan 2024 18:35:38 +0900 Subject: [PATCH 05/12] =?UTF-8?q?Fix:=20=EB=94=94=EC=9E=90=EC=9D=B8=202?= =?UTF-8?q?=EC=B0=A8=20QA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 +- .../DetailSectionBottom/ReviewItem.tsx | 40 ++++++---------- src/components/Review/CommentItem.tsx | 2 +- src/components/Review/ReviewComments.tsx | 2 +- src/components/Review/ReviewKeyword.tsx | 47 ++++++++----------- src/components/common/nav/InputComment.tsx | 5 +- 6 files changed, 39 insertions(+), 59 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 030880f3..c3e90c27 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -18,7 +18,7 @@ const App = () => { - + {/* */} ); }; diff --git a/src/components/DetailSectionBottom/ReviewItem.tsx b/src/components/DetailSectionBottom/ReviewItem.tsx index c11e040e..2ff1c349 100644 --- a/src/components/DetailSectionBottom/ReviewItem.tsx +++ b/src/components/DetailSectionBottom/ReviewItem.tsx @@ -151,51 +151,41 @@ const Item: React.FC = (props: ReviewInfoItemProps) => {
{!showMoreKeywords && - keywords.slice(0, 2).map((keyword, idx) => ( + keywords.slice(0, 1).map((keyword, idx) => (
{getEmoji(keyword.content)} {keyword.content}
))} - {keywords.length > 2 && !showMoreKeywords && ( + {keywords.length > 1 && !showMoreKeywords && (
{ handleClickPlusButton(e); }}> - +{keywords.length - 2} + +{keywords.length - 1}
)}
+
- {showMoreKeywords && - Array.from({ length: Math.ceil(keywords.length / 2) }).map( - (_, lineIdx) => ( + {showMoreKeywords && ( +
+ {keywords.map((keyword, idx) => (
- {keywords - .slice(lineIdx * 2, lineIdx * 2 + 2) - .map((keyword, idx) => ( -
- {getEmoji(keyword.content)} {keyword.content} -
- ))} + key={idx} + className="rounded-md bg-gray1 px-2 py-1 text-xs text-gray6"> + {getEmoji(keyword.content)} {keyword.content}
- ), - )} + ))} +
+ )}
-
+
-
{commentCount}
+
{commentCount}
diff --git a/src/components/Review/CommentItem.tsx b/src/components/Review/CommentItem.tsx index c74ff1c5..929621b9 100644 --- a/src/components/Review/CommentItem.tsx +++ b/src/components/Review/CommentItem.tsx @@ -44,7 +44,7 @@ const CommentItem: React.FC = (props: CommentItemProps) => { }; return ( -
+
{!( diff --git a/src/components/Review/ReviewComments.tsx b/src/components/Review/ReviewComments.tsx index 05dd0244..fbf4858b 100644 --- a/src/components/Review/ReviewComments.tsx +++ b/src/components/Review/ReviewComments.tsx @@ -85,7 +85,7 @@ export default function ReviewComments() { 댓글 {commentDataLength}
-
+
{commentDataLength == 0 && (
diff --git a/src/components/Review/ReviewKeyword.tsx b/src/components/Review/ReviewKeyword.tsx index d6c24780..c33d7323 100644 --- a/src/components/Review/ReviewKeyword.tsx +++ b/src/components/Review/ReviewKeyword.tsx @@ -45,38 +45,29 @@ export default function ReviewKeyword() { } }; - // 5x2 형태로 배치하기 위해 행(row)과 열(column)을 계산 - // const rows = 5; - const columns = 2; - return ( <>
어떤 점이 좋았나요?
-
- {reviewKeywords?.data?.data?.keywords?.map( - (keyword: Keyword, index: number) => { - const row = Math.floor(index / columns) + 1; - const col = (index % columns) + 1; - - const isSelected = selectedKeywords.some( - (selectedKeyword) => - selectedKeyword.keywordId === keyword.keywordId, - ); +
+ {reviewKeywords?.data?.data?.keywords?.map((keyword: Keyword) => { + const isSelected = selectedKeywords.some( + (selectedKeyword) => + selectedKeyword.keywordId === keyword.keywordId, + ); - return ( - - ); - }, - )} + return ( + + ); + })}
); diff --git a/src/components/common/nav/InputComment.tsx b/src/components/common/nav/InputComment.tsx index 00a343dc..ebaad8f5 100644 --- a/src/components/common/nav/InputComment.tsx +++ b/src/components/common/nav/InputComment.tsx @@ -106,12 +106,11 @@ export const InputComment: React.FC = () => { }; return ( -
-
+
+
Date: Fri, 26 Jan 2024 18:35:56 +0900 Subject: [PATCH 06/12] =?UTF-8?q?Refactor:=20=EC=99=84=EB=A3=8C=20->=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EB=B2=84=ED=8A=BC=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Mypage/UserInfoForm.tsx | 110 ++++++++++++++----------- src/pages/mypage/editUserInfo.page.tsx | 23 +----- 2 files changed, 61 insertions(+), 72 deletions(-) diff --git a/src/components/Mypage/UserInfoForm.tsx b/src/components/Mypage/UserInfoForm.tsx index ae351363..c0cc9ff8 100644 --- a/src/components/Mypage/UserInfoForm.tsx +++ b/src/components/Mypage/UserInfoForm.tsx @@ -4,11 +4,12 @@ import { Link, useNavigate } from 'react-router-dom'; import { useRecoilValue } from 'recoil'; import { UserInfoState } from '@recoil/Auth.atom'; import { useEffect } from 'react'; -import SubmitBtn from '@components/common/button/SubmitBtn'; import UserInfoImg from '@components/Auth/SignupInfo/UserInfoImg'; import AuthNicknameInputBox from '@components/Auth/AuthInput/AuthInputBox/AuthNicknameInputBox'; import AuthDropDown from '@components/Auth/SignupInfo/AuthDropDown/AuthDropDown'; import { ageArr, genderArr } from '@utils/authSelectOptions'; +import { BackBox } from '@components/common'; +import DeleteMemberButton from './DeleteMemberButton'; const UserInfoForm = () => { const { @@ -19,7 +20,7 @@ const UserInfoForm = () => { resetField, setError, setValue, - formState: { errors, isValid }, + formState: { errors }, } = useForm({ mode: 'onChange', criteriaMode: 'all', @@ -34,8 +35,6 @@ const UserInfoForm = () => { setValue('ageType', userInfo?.ageType); }, [userInfo]); - console.log(watch()); - const onInfoSubmit: SubmitHandler = async (data) => { const { nickname, profileImageUrl, genderType, ageType } = data; @@ -55,54 +54,65 @@ const UserInfoForm = () => { }; return ( -
-
-
- -
-
-
- {userInfo?.email} + <> + { + navigate('/mypage'); + }} + showSave + saveHandler={handleSubmit(onInfoSubmit)}> + 회원정보 수정 + +
+ +
+
+ +
+
+
+ {userInfo?.email} +
+ + 비밀번호 변경 + +
+ +
+ + +
- - 비밀번호 변경 - -
- -
- - -
-
-
- 완료 + +
- + ); }; diff --git a/src/pages/mypage/editUserInfo.page.tsx b/src/pages/mypage/editUserInfo.page.tsx index aab9743d..4932b44c 100644 --- a/src/pages/mypage/editUserInfo.page.tsx +++ b/src/pages/mypage/editUserInfo.page.tsx @@ -1,28 +1,7 @@ -import DeleteMemberButton from '@components/Mypage/DeleteMemberButton'; import UserInfoForm from '@components/Mypage/UserInfoForm'; -import { BackBox } from '@components/common'; -import { useNavigate } from 'react-router-dom'; const EditUserInfo = () => { - const navigate = useNavigate(); - return ( - <> - { - navigate('/mypage'); - }} - // showSave - // saveHandler={() => {}} - > - 회원정보 수정 - -
- - -
- - ); + return ; }; export default EditUserInfo; From 6a8ad6eda365c63e1df770eff941da1051c9a607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Fri, 26 Jan 2024 18:37:10 +0900 Subject: [PATCH 07/12] =?UTF-8?q?Fix:=20=EB=94=94=EC=9E=90=EC=9D=B8=202?= =?UTF-8?q?=EC=B0=A8=20QA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index c3e90c27..030880f3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -18,7 +18,7 @@ const App = () => { - {/* */} + ); }; From 7233bab84de09a375aa2c81369a55be0bdfaf64e Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Fri, 26 Jan 2024 19:24:39 +0900 Subject: [PATCH 08/12] =?UTF-8?q?Refactor:=20=EC=99=84=EB=A3=8C=20->=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EB=B2=84=ED=8A=BC=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/AuthSurvey/AuthSurvey.tsx | 41 +++---------------- src/components/Mypage/UserInfoForm.tsx | 3 +- src/components/common/BackBox/BackBox.tsx | 5 ++- src/pages/mypage/editUserSurvey.page.tsx | 30 +++++++++++++- src/pages/signup/signupSurvey.page.tsx | 30 +++++++++++++- 5 files changed, 68 insertions(+), 41 deletions(-) diff --git a/src/components/Auth/AuthSurvey/AuthSurvey.tsx b/src/components/Auth/AuthSurvey/AuthSurvey.tsx index a4d02834..9f5f446b 100644 --- a/src/components/Auth/AuthSurvey/AuthSurvey.tsx +++ b/src/components/Auth/AuthSurvey/AuthSurvey.tsx @@ -1,25 +1,16 @@ -import SubmitBtn from '@components/common/button/SubmitBtn'; import AuthSurveyOption from './AuthSurveyOption'; -import { SubmitHandler, useForm } from 'react-hook-form'; -import { putMemberSurvey } from '@api/member'; -import { useNavigate } from 'react-router-dom'; import { surveyArr } from '@utils/survey.constants'; import { useEffect } from 'react'; import { UserInfoState } from '@recoil/Auth.atom'; import { useRecoilState } from 'recoil'; +import { UseFormRegister, UseFormSetValue } from 'react-hook-form'; interface Props { - path?: string; + register: UseFormRegister; + setValue: UseFormSetValue; } -const AuthSurvey = ({ path }: Props) => { - const { - register, - handleSubmit, - setValue, - formState: { isDirty, isValid }, - } = useForm(); - const navigate = useNavigate(); +const AuthSurvey = ({ register, setValue }: Props) => { const [userInfo, _] = useRecoilState(UserInfoState); useEffect(() => { if (userInfo?.survey) { @@ -33,29 +24,8 @@ const AuthSurvey = ({ path }: Props) => { } }, [userInfo]); - const onSaveSubmit: SubmitHandler = async (data) => { - try { - const res = await putMemberSurvey({ survey: data }); - if (res.data.status === 200) { - // setUserInfo((prevUserInfo) => { - // const newPrevUserInfo = prevUserInfo!; - // newPrevUserInfo.survey = data; - // return newPrevUserInfo; - // }); - if (path) { - navigate(path); - } else { - navigate(-1); - } - } - } catch (err) { - console.error(err); - alert('오류가 발생했습니다. 다시 시도해주세요'); - } - }; - return ( -
+
{surveyArr.map((section) => (
@@ -75,7 +45,6 @@ const AuthSurvey = ({ path }: Props) => {
))}
- 완료
); }; diff --git a/src/components/Mypage/UserInfoForm.tsx b/src/components/Mypage/UserInfoForm.tsx index c0cc9ff8..8cedc7e4 100644 --- a/src/components/Mypage/UserInfoForm.tsx +++ b/src/components/Mypage/UserInfoForm.tsx @@ -20,7 +20,7 @@ const UserInfoForm = () => { resetField, setError, setValue, - formState: { errors }, + formState: { errors, isValid }, } = useForm({ mode: 'onChange', criteriaMode: 'all', @@ -61,6 +61,7 @@ const UserInfoForm = () => { navigate('/mypage'); }} showSave + isSaveValid={isValid} saveHandler={handleSubmit(onInfoSubmit)}> 회원정보 수정 diff --git a/src/components/common/BackBox/BackBox.tsx b/src/components/common/BackBox/BackBox.tsx index 0d29c96f..6e51e9c9 100644 --- a/src/components/common/BackBox/BackBox.tsx +++ b/src/components/common/BackBox/BackBox.tsx @@ -8,6 +8,7 @@ interface Props { showSkip?: boolean; skipHandler?: VoidFunction; showSave?: boolean; + isSaveValid?: boolean; saveHandler?: VoidFunction; showShare?: boolean; shareHandler?: VoidFunction; @@ -20,6 +21,7 @@ const BackBox = ({ showSkip, skipHandler, showSave, + isSaveValid, saveHandler, showShare, shareHandler, @@ -51,7 +53,8 @@ const BackBox = ({ )} {showSave && ( diff --git a/src/pages/mypage/editUserSurvey.page.tsx b/src/pages/mypage/editUserSurvey.page.tsx index adf0f324..12124c49 100644 --- a/src/pages/mypage/editUserSurvey.page.tsx +++ b/src/pages/mypage/editUserSurvey.page.tsx @@ -1,21 +1,47 @@ +import { putMemberSurvey } from '@api/member'; import AuthSurvey from '@components/Auth/AuthSurvey/AuthSurvey'; import { BackBox } from '@components/common'; +import { SubmitHandler, useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; const EditUserSurvey = () => { const navigate = useNavigate(); + const { + register, + handleSubmit, + setValue, + formState: { isValid }, + } = useForm(); + + const onSaveSubmit: SubmitHandler = async (data) => { + try { + const res = await putMemberSurvey({ survey: data }); + if (res.data.status === 200) { + navigate(-1); + } + } catch (err) { + console.error(err); + alert('오류가 발생했습니다. 다시 시도해주세요'); + } + }; + + console.log(isValid); + return ( <> { navigate(-1); - }}> + }} + showSave + isSaveValid={isValid} + saveHandler={handleSubmit(onSaveSubmit)}> 나의 여행 취향 설정
- +
); diff --git a/src/pages/signup/signupSurvey.page.tsx b/src/pages/signup/signupSurvey.page.tsx index a00fe2e2..f3a73cf7 100644 --- a/src/pages/signup/signupSurvey.page.tsx +++ b/src/pages/signup/signupSurvey.page.tsx @@ -3,9 +3,32 @@ import { BackBox } from '@components/common'; import AuthSurvey from '@components/Auth/AuthSurvey/AuthSurvey'; import { useNavigate } from 'react-router-dom'; import { ProgressBarIcon } from '@components/common/icons/Icons'; +import { SubmitHandler, useForm } from 'react-hook-form'; +import SubmitBtn from '@components/common/button/SubmitBtn'; +import { putMemberSurvey } from '@api/member'; const SignupSurvey = () => { const navigate = useNavigate(); + + const { + register, + handleSubmit, + setValue, + formState: { isDirty, isValid }, + } = useForm(); + + const onSaveSubmit: SubmitHandler = async (data) => { + try { + const res = await putMemberSurvey({ survey: data }); + if (res.data.status === 200) { + navigate('/signup/info'); + } + } catch (err) { + console.error(err); + alert('오류가 발생했습니다. 다시 시도해주세요'); + } + }; + return (
{ title={'어떤 여행을 좋아하세요?'} subTitle="여행 취향을 골라주세요." /> - + + + 완료 +
); }; From 5494bf205d62be73446d34c7358fac663348f1c6 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Fri, 26 Jan 2024 21:04:04 +0900 Subject: [PATCH 09/12] =?UTF-8?q?Refactor:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/signup/signup.page.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/signup/signup.page.tsx b/src/pages/signup/signup.page.tsx index def45d2d..7ee023b0 100644 --- a/src/pages/signup/signup.page.tsx +++ b/src/pages/signup/signup.page.tsx @@ -9,10 +9,12 @@ import { import { BackBox } from '@components/common'; import SubmitBtn from '@components/common/button/SubmitBtn'; import { CheckboxIcon } from '@components/common/icons/Icons'; +import { UserInfoState } from '@recoil/Auth.atom'; import { setItem } from '@utils/localStorageFun'; import { useEffect } from 'react'; import { SubmitHandler, useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; +import { useSetRecoilState } from 'recoil'; const Signup = () => { const { @@ -39,6 +41,8 @@ const Signup = () => { } }, [password, trigger]); + const setUserInfo = useSetRecoilState(UserInfoState); + const onSignupSubmit: SubmitHandler = async (data) => { const { email, password } = data; @@ -48,6 +52,14 @@ const Signup = () => { password, }); if (res.status === 200) { + setUserInfo({ + nickname: res.data.data.nickName!, + email: res.data.data.email!, + profileImageUrl: null, + ageType: null, + genderType: null, + survey: null, + }); setItem('accessToken', res.data.data.tokenInfo.accessToken); navigate('/signup/success'); } From 654b791dc19750b2b9336f25e8e3d67fff26db84 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Fri, 26 Jan 2024 21:08:37 +0900 Subject: [PATCH 10/12] =?UTF-8?q?Design:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=84=B1=EA=B3=B5=20=EB=B2=84=ED=8A=BC=20=EC=9C=84?= =?UTF-8?q?=EB=A1=9C=20=EC=98=AC=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/signup/signupSuccess.page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/signup/signupSuccess.page.tsx b/src/pages/signup/signupSuccess.page.tsx index 82eeb663..9a8fa527 100644 --- a/src/pages/signup/signupSuccess.page.tsx +++ b/src/pages/signup/signupSuccess.page.tsx @@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom'; const SignupSuccess = () => { const navigate = useNavigate(); return ( -
+
From e2af705c01a87c1f7615f06bfc84fec60cc9fe93 Mon Sep 17 00:00:00 2001 From: jisu Seo Date: Fri, 26 Jan 2024 21:12:24 +0900 Subject: [PATCH 11/12] =?UTF-8?q?Design:=20=EB=92=A4=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/icons/Icons.tsx | 37 ++++++++------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index 1612c7b6..b47046ad 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -279,36 +279,19 @@ export const CheckIcon = ({ ); }; -interface LeftIconProps { - width?: number; - height?: number; - fill?: string; - onClick?: VoidFunction; - cursor?: string; -} - -export const LeftIcon = ({ - width = 8, - height = 15, - fill = '#1E1E1E', - onClick, - cursor = 'pointer', -}: LeftIconProps) => { +export const LeftIcon = () => { return ( + xmlns="http://www.w3.org/2000/svg" + width="9" + height="16" + viewBox="0 0 9 16" + fill="none"> ); From 9497066b3c35397f869442cf5230d0259663c9e4 Mon Sep 17 00:00:00 2001 From: NohWookJin Date: Sat, 27 Jan 2024 10:03:58 +0900 Subject: [PATCH 12/12] =?UTF-8?q?style:=20=EA=B4=80=EC=8B=AC=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20qa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Wish/WishItem.tsx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/Wish/WishItem.tsx b/src/components/Wish/WishItem.tsx index 41540feb..cc7a4edd 100644 --- a/src/components/Wish/WishItem.tsx +++ b/src/components/Wish/WishItem.tsx @@ -46,12 +46,12 @@ const WishItem: React.FC = ({ wishList }) => {
-
-
-

+

+
+

{title}

-
+

{isMetroIncluded && tourAddress ? (tourAddress.match(/(.*?[시군구])/)?.[0] || '') + @@ -63,25 +63,25 @@ const WishItem: React.FC = ({ wishList }) => {

-
+
-
- +
+
-
- +
+ {(Math.ceil(ratingAverage * 100) / 100).toFixed(1)} - + ({reviewCount ? reviewCount.toLocaleString() : reviewCount})
-
-
- +
+
+
- + {likedCount ? likedCount.toLocaleString() : likedCount}