Skip to content

Commit

Permalink
Merge pull request #82 from sharemindteam/leekyuho
Browse files Browse the repository at this point in the history
feat: 요일 불필요하게 뜨는 문제 해결 (#46)
  • Loading branch information
kyuhho authored Jan 25, 2024
2 parents 9c6eb11 + 7ee32aa commit 878b3e1
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buyer/BuyerHome/HomeConsultInReady.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Buyer/BuyerSearchResult/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
42 changes: 31 additions & 11 deletions src/components/Buyer/Common/ReadyConsultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -27,6 +27,7 @@ interface ReadyConsultCardProps {
consultType: string[];
letterPrice: number;
chattingPrice: number;
consultStyle: number;
}
//일단 toggle파트 제외하고 클릭 시 상담프로필로 navigate하게 구현
export const ReadyConsultCard = ({
Expand All @@ -44,6 +45,7 @@ export const ReadyConsultCard = ({
consultType,
letterPrice,
chattingPrice,
consultStyle,
}: ReadyConsultCardProps) => {
const navigate = useNavigate();
//toggle
Expand All @@ -53,13 +55,24 @@ export const ReadyConsultCard = ({
const newStates = [...bookmarkStates];
newStates[index] = !newStates[index];
setBookmarkStates(newStates);
console.log(consultTimes);
};
const [timeData, setTimeData] = useState<string | null[]>([
null,
null,
null,
null,
null,
null,
null,
]);
useEffect(() => {}, []);
return (
<Wrapper>
<UpperWrapper
onClick={() => {
//마인더 프로필 개발되면 수정
navigate('/buyer/profile/0');
navigate(`/buyer/profile/${counselorId}`);
}}
>
<TagWrapper>
Expand All @@ -71,11 +84,11 @@ export const ReadyConsultCard = ({
</UpperWrapper>
<LowerWrapper
onClick={() => {
navigate('/buyer/profile/0');
navigate(`/buyer/profile/${counselorId}`);
}}
>
<Characters
number={1}
number={consultStyle}
width="6.5rem"
height="5.4rem"
margin="1.2rem 0 0 1.6rem"
Expand Down Expand Up @@ -115,37 +128,44 @@ export const ReadyConsultCard = ({
<div className="row2">
<Body3 color={Grey3}>상담가능 시간</Body3>
<div>
{consultTimes.MON !== undefined ? (
{consultTimes.MON !== undefined &&
consultTimes.MON.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.MON)}
</Body3>
) : null}
{consultTimes.TUE !== undefined ? (
{consultTimes.TUE !== undefined &&
consultTimes.TUE.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.TUE)}
</Body3>
) : null}
{consultTimes.WED !== undefined ? (
{consultTimes.WED !== undefined &&
consultTimes.WED.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.WED)}
</Body3>
) : null}
{consultTimes.THU !== undefined ? (
{consultTimes.THU !== undefined &&
consultTimes.THU.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.THU)}
</Body3>
) : null}
{consultTimes.FRI !== undefined ? (
{consultTimes.FRI !== undefined &&
consultTimes.FRI.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.FRI)}
</Body3>
) : null}
{consultTimes.SAT !== undefined ? (
{consultTimes.SAT !== undefined &&
consultTimes.SAT.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.SAT)}
</Body3>
) : null}
{consultTimes.SUN !== undefined ? (
{consultTimes.SUN !== undefined &&
consultTimes.SUN.length !== 0 ? (
<Body3 color={Grey1}>
{convertTimeToString(consultTimes.SUN)}
</Body3>
Expand Down
25 changes: 12 additions & 13 deletions src/pages/Buyer/BuyerCounselorProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,38 @@ export const BuyerCounselorProfile = () => {
const [isInfo, setIsInfo] = useState<boolean>(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 (
<Wrapper>
<CounselorProfileHeader />
<Body>
<CounselorProfileCard
nickname={dummy[counselorId].nickname}
level={dummy[counselorId].level}
rating={dummy[counselorId].rating}
reviewNumber={dummy[counselorId].reviewNumber}
nickname={dummy[1].nickname}
level={dummy[1].level}
rating={dummy[1].rating}
reviewNumber={dummy[1].reviewNumber}
tagList={tagListCast}
iconNumber={dummy[counselorId].iconNumber}
iconNumber={dummy[1].iconNumber}
/>
<CounselorProfileNav
isInfo={isInfo}
setIsInfo={setIsInfo}
reviewNumber={dummy[counselorId].reviewNumber}
reviewNumber={dummy[1].reviewNumber}
/>
{isInfo ? (
<>
<CounselorInfo
consultType={dummy[counselorId].consultType}
letterPrice={dummy[counselorId].letterPrice}
chattingPrice={dummy[counselorId].chattingPrice}
consultType={dummy[1].consultType}
letterPrice={dummy[1].letterPrice}
chattingPrice={dummy[1].chattingPrice}
/>
<CounselorExp experience={dummy[counselorId].experience} />
<CounselorExp experience={dummy[1].experience} />
</>
) : (
<CounselorReview reviewList={reviewDummy} />
)}
</Body>
<CounselorFooter isBookmarked={dummy[counselorId].isBookmarked} />
<CounselorFooter isBookmarked={dummy[1].isBookmarked} />
</Wrapper>
);
} else {
Expand Down
1 change: 0 additions & 1 deletion src/pages/Buyer/BuyerHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/utils/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/utils/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export type SearchResultData = {
consultStyle: '조언';
consultTimes: ConsultTimes;
consultTypes: string[];
counselorId: number;
introduction: string;
isWishList: boolean;
level: number;
Expand Down

0 comments on commit 878b3e1

Please sign in to comment.