From 7ee32aa7ff8c48ea46878e1a6f545e54cb143d6e Mon Sep 17 00:00:00 2001 From: leekyuho Date: Thu, 25 Jan 2024 18:55:13 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9A=94=EC=9D=BC=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=98=EA=B2=8C=20=EB=9C=A8=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20(#46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AvailCounselorSearchResult.tsx | 3 +- .../CategorySearchResult.tsx | 3 +- .../Buyer/BuyerHome/HomeConsultInReady.tsx | 3 +- .../Buyer/BuyerSearchResult/SearchResults.tsx | 3 +- .../Buyer/Common/ReadyConsultCard.tsx | 42 ++++++++++++++----- src/pages/Buyer/BuyerCounselorProfile.tsx | 25 ++++++----- src/pages/Buyer/BuyerHome.tsx | 1 - src/utils/atom.ts | 6 +++ src/utils/type.ts | 1 + 9 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/components/Buyer/BuyerAvailCounselor/AvailCounselorSearchResult.tsx b/src/components/Buyer/BuyerAvailCounselor/AvailCounselorSearchResult.tsx index 3d8d06ff..7b74d236 100644 --- a/src/components/Buyer/BuyerAvailCounselor/AvailCounselorSearchResult.tsx +++ b/src/components/Buyer/BuyerAvailCounselor/AvailCounselorSearchResult.tsx @@ -27,11 +27,12 @@ export const AvailCounselorSearchResults = ({ // 나중에 id로 변경 key={index} index={index} - counselorId={consultStyleToCharNum(value.consultStyle)} + counselorId={value.counselorId} tagList={AppendCategoryType( value.consultCategories, value.consultStyle, )} + consultStyle={consultStyleToCharNum(value.consultStyle)} consultTimes={value.consultTimes} introduction={value.introduction} nickname={value.nickname} diff --git a/src/components/Buyer/BuyerCategoryResult/CategorySearchResult.tsx b/src/components/Buyer/BuyerCategoryResult/CategorySearchResult.tsx index 7d5c160a..f20b1602 100644 --- a/src/components/Buyer/BuyerCategoryResult/CategorySearchResult.tsx +++ b/src/components/Buyer/BuyerCategoryResult/CategorySearchResult.tsx @@ -27,11 +27,12 @@ export const CategorySearchResults = ({ // 나중에 id로 변경 key={index} index={index} - counselorId={consultStyleToCharNum(value.consultStyle)} + counselorId={value.counselorId} tagList={AppendCategoryType( value.consultCategories, value.consultStyle, )} + consultStyle={consultStyleToCharNum(value.consultStyle)} consultTimes={value.consultTimes} introduction={value.introduction} nickname={value.nickname} diff --git a/src/components/Buyer/BuyerHome/HomeConsultInReady.tsx b/src/components/Buyer/BuyerHome/HomeConsultInReady.tsx index 1dcf192e..a68d4396 100644 --- a/src/components/Buyer/BuyerHome/HomeConsultInReady.tsx +++ b/src/components/Buyer/BuyerHome/HomeConsultInReady.tsx @@ -39,11 +39,12 @@ export const HomeConsultInReady = ({ searchData }: HomeConsultInReadyProps) => { // 나중에 id로 변경 key={index} index={index} - counselorId={consultStyleToCharNum(value.consultStyle)} + counselorId={value.counselorId} tagList={AppendCategoryType( value.consultCategories, value.consultStyle, )} + consultStyle={consultStyleToCharNum(value.consultStyle)} consultTimes={value.consultTimes} introduction={value.introduction} nickname={value.nickname} diff --git a/src/components/Buyer/BuyerSearchResult/SearchResults.tsx b/src/components/Buyer/BuyerSearchResult/SearchResults.tsx index 647d5fa4..5d79e5dc 100644 --- a/src/components/Buyer/BuyerSearchResult/SearchResults.tsx +++ b/src/components/Buyer/BuyerSearchResult/SearchResults.tsx @@ -26,11 +26,12 @@ export const SearchResults = ({ searchData }: SearchResultsProps) => { // 나중에 id로 변경 key={index} index={index} - counselorId={consultStyleToCharNum(value.consultStyle)} + counselorId={value.counselorId} tagList={AppendCategoryType( value.consultCategories, value.consultStyle, )} + consultStyle={consultStyleToCharNum(value.consultStyle)} consultTimes={value.consultTimes} introduction={value.introduction} nickname={value.nickname} diff --git a/src/components/Buyer/Common/ReadyConsultCard.tsx b/src/components/Buyer/Common/ReadyConsultCard.tsx index 70a6428e..6db56cb5 100644 --- a/src/components/Buyer/Common/ReadyConsultCard.tsx +++ b/src/components/Buyer/Common/ReadyConsultCard.tsx @@ -8,7 +8,7 @@ import { ReactComponent as NoneBookMark } from 'assets/icons/icon-save1.svg'; import { ReactComponent as BookMark } from 'assets/icons/icon-save2.svg'; import { ReactComponent as DownIcon } from 'assets/icons/icon-down-toggle.svg'; import { ReactComponent as UpIcon } from 'assets/icons/icon-up-toggle.svg'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { CartegoryState, ConsultTimes } from 'utils/type'; import { convertTimeToString } from 'utils/convertTimeToString'; @@ -27,6 +27,7 @@ interface ReadyConsultCardProps { consultType: string[]; letterPrice: number; chattingPrice: number; + consultStyle: number; } //일단 toggle파트 제외하고 클릭 시 상담프로필로 navigate하게 구현 export const ReadyConsultCard = ({ @@ -44,6 +45,7 @@ export const ReadyConsultCard = ({ consultType, letterPrice, chattingPrice, + consultStyle, }: ReadyConsultCardProps) => { const navigate = useNavigate(); //toggle @@ -53,13 +55,24 @@ export const ReadyConsultCard = ({ const newStates = [...bookmarkStates]; newStates[index] = !newStates[index]; setBookmarkStates(newStates); + console.log(consultTimes); }; + const [timeData, setTimeData] = useState([ + null, + null, + null, + null, + null, + null, + null, + ]); + useEffect(() => {}, []); return ( { //마인더 프로필 개발되면 수정 - navigate('/buyer/profile/0'); + navigate(`/buyer/profile/${counselorId}`); }} > @@ -71,11 +84,11 @@ export const ReadyConsultCard = ({ { - navigate('/buyer/profile/0'); + navigate(`/buyer/profile/${counselorId}`); }} > 상담가능 시간
- {consultTimes.MON !== undefined ? ( + {consultTimes.MON !== undefined && + consultTimes.MON.length !== 0 ? ( 월 {convertTimeToString(consultTimes.MON)} ) : null} - {consultTimes.TUE !== undefined ? ( + {consultTimes.TUE !== undefined && + consultTimes.TUE.length !== 0 ? ( 화 {convertTimeToString(consultTimes.TUE)} ) : null} - {consultTimes.WED !== undefined ? ( + {consultTimes.WED !== undefined && + consultTimes.WED.length !== 0 ? ( 수 {convertTimeToString(consultTimes.WED)} ) : null} - {consultTimes.THU !== undefined ? ( + {consultTimes.THU !== undefined && + consultTimes.THU.length !== 0 ? ( 목 {convertTimeToString(consultTimes.THU)} ) : null} - {consultTimes.FRI !== undefined ? ( + {consultTimes.FRI !== undefined && + consultTimes.FRI.length !== 0 ? ( 금 {convertTimeToString(consultTimes.FRI)} ) : null} - {consultTimes.SAT !== undefined ? ( + {consultTimes.SAT !== undefined && + consultTimes.SAT.length !== 0 ? ( 토 {convertTimeToString(consultTimes.SAT)} ) : null} - {consultTimes.SUN !== undefined ? ( + {consultTimes.SUN !== undefined && + consultTimes.SUN.length !== 0 ? ( 일 {convertTimeToString(consultTimes.SUN)} diff --git a/src/pages/Buyer/BuyerCounselorProfile.tsx b/src/pages/Buyer/BuyerCounselorProfile.tsx index f578a154..4341bcf6 100644 --- a/src/pages/Buyer/BuyerCounselorProfile.tsx +++ b/src/pages/Buyer/BuyerCounselorProfile.tsx @@ -19,39 +19,38 @@ export const BuyerCounselorProfile = () => { const [isInfo, setIsInfo] = useState(true); if (id !== undefined) { const counselorId = parseInt(id, 10); - const tagListCast: CartegoryState[] = dummy[counselorId] - .tagList as CartegoryState[]; + const tagListCast: CartegoryState[] = dummy[1].tagList as CartegoryState[]; return ( {isInfo ? ( <> - + ) : ( )} - + ); } else { diff --git a/src/pages/Buyer/BuyerHome.tsx b/src/pages/Buyer/BuyerHome.tsx index bb1ac816..aa2c726c 100644 --- a/src/pages/Buyer/BuyerHome.tsx +++ b/src/pages/Buyer/BuyerHome.tsx @@ -8,7 +8,6 @@ import styled from 'styled-components'; import HomeAboutFooterSection from 'components/Common/HomeAboutFooterSection'; import { SearchResultData } from 'utils/type'; import { useEffect, useState } from 'react'; -import { ConverSortType } from 'utils/convertSortType'; import { patchCounselors } from 'api/patch'; export const BuyerHome = () => { const navigate = useNavigate(); diff --git a/src/utils/atom.ts b/src/utils/atom.ts index 5dcf02b8..63162386 100644 --- a/src/utils/atom.ts +++ b/src/utils/atom.ts @@ -106,6 +106,12 @@ export const searchKeywordState = atom({ default: '', effects_UNSTABLE: [persistAtom], }); +//셰어 side searchKeywordState +export const profileCounselorIdState = atom({ + key: 'profileCounselorIdState', + default: -1, + effects_UNSTABLE: [persistAtom], +}); //셰어 상대 마인더 nickname export const opponentNicknameState = atom({ key: 'opponentNicknameState', diff --git a/src/utils/type.ts b/src/utils/type.ts index 0b7c1de7..f00652da 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -81,6 +81,7 @@ export type SearchResultData = { consultStyle: '조언'; consultTimes: ConsultTimes; consultTypes: string[]; + counselorId: number; introduction: string; isWishList: boolean; level: number;