Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 리뷰페이지 api 연동 완료 외 자잘한 수정 #74

Merged
merged 17 commits into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ const Router = () => {
<Route path="/buyer/counselors" element={<BuyerAvailCounselor />} />
<Route path="/buyer/mypage" element={<BuyerMypage />} />
<Route path="/buyer/reviewManage" element={<BuyerReviewManage />} />
<Route path="/buyer/review/:id" element={<BuyerWriteReview />} />
<Route path="/buyer/review" element={<BuyerWriteReview />} />
<Route path="/buyer/saved" element={<BuyerSavedCounselor />} />
<Route path="/buyer/payment" element={<BuyerPayment />} />
<Route path="/buyer/letter/:id" element={<BuyerLetter />} />
@@ -93,7 +93,7 @@ const Router = () => {
<Route path="/signup" element={<BuyerSignup />} />
<Route path="/signup/nav" element={<BuyerSignupComplete />} />
<Route path="/find" element={<BuyerFindInfo />} />
<Route path="/setting" element={<BuyerAccountSetting />} />
<Route path="/buyer/setting" element={<BuyerAccountSetting />} />
<Route path="/setting/changePassword" element={<BuyerPwChange />} />
<Route path="/setting/terminate" element={<BuyerTerminate />} />
<Route path="/setting/logout" element={<BuyerLogout />} />
9 changes: 8 additions & 1 deletion src/api/get.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ export const getAdminsUnpaidConsults = async () =>
export const getAdminsPedningProfilse = async () =>
await getInstance('/admins/pending-profiles');

//buyer
//Chat Controller
//채팅 목록 반환
export const getChats = async (params: any) =>
await getInstance('/chats', params);
@@ -37,11 +37,18 @@ export const getLetterMessages = async (

export const getLetterRecentType = async (letterId: string | undefined) =>
await getInstance(`/letterMessages/recent-type/${letterId}`);
//Review Controller
export const getReviewsCustomer = async (params: any) =>
await getInstance('/reviews/customers', params);

// Conuselor Controller
export const getMyInfo = async () => await getInstance('counselors/my-info');
export const getProfiles = async () => await getInstance('counselors/profiles');
export const getIsPassQuiz = async () => await getInstance('counselors/quiz');
export const getCounselorConsults = async (
counselorId: string | undefined,
params: any,
) => await getInstance(`/counselors/consults/${counselorId}`, params);

// SearchWord Controller
export const getSearchWords = async () => await getInstance('/searchWords');
4 changes: 4 additions & 0 deletions src/api/patch.ts
Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ export const patchLetterMessageFirstQustion = async (body: any) =>
export const patchProfiles = async (body: any) =>
await patchInstance('counselors/profiles', body);

//Review Controller
export const patchReviews = async (body: any) =>
await patchInstance('/reviews', body);

//SearchWord Controller
//검색 결과 반환
export const patchSearchWordsResults = async (sortType: string, body: any) =>
File renamed without changes
2 changes: 1 addition & 1 deletion src/assets/icons/icon-down-toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/icons/icon-up-toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions src/components/Buyer/BuyerCategoryResult/SearchResult.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import styled from 'styled-components';
import { ReadyConsultCard } from '../Common/ReadyConsultCard';
import { useState } from 'react';
import { SearchResultData } from 'utils/type';
import { AppendCategoryType } from 'utils/AppendCategoryType';
interface SearchResultsProps {
searchData: SearchResultData[];
}

//임의로 ConsultInReady 그대로 사용
export const SearchResults = ({ searchData }: SearchResultsProps) => {
//찜하기 배열 init
const initialBookmarkStates = searchData.map(
(data) => data.isWishList || false,
);
const [bookmarkStates, setBookmarkStates] = useState<boolean[]>(
initialBookmarkStates,
);
return (
<Wrapper>
{searchData.map((value, index) => {
return (
<ReadyConsultCard
index={index}
counselorId={1}
tagList={AppendCategoryType(
value.consultCategories,
value.consultStyle,
)}
introduction={value.introduction}
nickname={value.nickname}
level={value.level}
bookmarkStates={bookmarkStates}
setBookmarkStates={setBookmarkStates}
rating={value.ratingAverage}
totalReview={value.totalReview}
consultType={value.consultTypes}
letterPrice={value.consultCosts.편지}
chattingPrice={value.consultCosts.채팅}
/>
);
})}
</Wrapper>
);
};
const Wrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin-bottom: 3.5rem;
`;
9 changes: 4 additions & 5 deletions src/components/Buyer/BuyerHome/ConsultInReady.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { ReadyConsultCard } from '../Common/ReadyConsultCard';
import { useState } from 'react';
import { counselorDummyData as dummy } from 'utils/buyerDummy';
import { useNavigate } from 'react-router-dom';
import { CartegoryState } from 'utils/type';
export const ConsultInReady = () => {
const navigate = useNavigate();
//consult type은 1이면 편지,2 면 채팅 3이면 둘다
@@ -30,8 +31,7 @@ export const ConsultInReady = () => {
<MoreIcon />
</div>
{dummy.map((value, index) => {
const tagListCast: CartegoryStateArray =
value.tagList as CartegoryStateArray;
const tagListCast: CartegoryState[] = value.tagList as CartegoryState[];
return (
<ReadyConsultCard
index={index}
@@ -43,9 +43,8 @@ export const ConsultInReady = () => {
bookmarkStates={bookmarkStates}
setBookmarkStates={setBookmarkStates}
rating={value.rating}
reviewNumber={value.reviewNumber}
iconNumber={value.iconNumber}
consultType={value.consultType}
totalReview={value.reviewNumber}
consultType={[]}
letterPrice={value.letterPrice}
chattingPrice={value.chattingPrice}
/>
36 changes: 0 additions & 36 deletions src/components/Buyer/BuyerPaymentDetail/PaymentDetailFooter.tsx

This file was deleted.

5 changes: 3 additions & 2 deletions src/components/Buyer/BuyerPaymentDetail/PaymentDetailInfo.tsx
Original file line number Diff line number Diff line change
@@ -4,12 +4,13 @@ import { Body1, Body3, Caption2, Heading } from 'styles/font';
import { Characters } from 'utils/Characters';
import { ReactComponent as Heart } from 'assets/icons/icon-heart2.svg';
import { TagA2Cartegory } from '../../Common/TagA2Cartegory';
import { CartegoryState } from 'utils/type';
interface PaymentDetailInfoProps {
nickname: string;
level: number;
rating: number;
reviewNumber: number;
tagList: CartegoryStateArray;
tagList: CartegoryState[];
iconNumber: number;
}
export const PaymentDetailInfo = ({
@@ -68,10 +69,10 @@ const Wrapper = styled.div`
`;
const CardWrapper = styled.div`
display: flex;
justify-content: space-between;
box-sizing: border-box;
padding: 1.6rem 0 2.4rem 0;
width: 33.5rem;
gap: 7.7rem;
.col1 {
display: flex;
flex-direction: column;
42 changes: 14 additions & 28 deletions src/components/Buyer/BuyerReviewManage/ReviewManageCard.tsx
Original file line number Diff line number Diff line change
@@ -5,64 +5,50 @@ import { Body1, Body3, Caption2 } from 'styles/font';
import { Characters } from 'utils/Characters';
import { ReactComponent as Heart } from 'assets/icons/icon-review-empty-heart.svg';
import { Button } from 'components/Common/Button';
import { consultStyleToCharNum } from 'utils/convertStringToCharNum';
import { BuyerReview } from 'utils/type';
interface ReviewManageCardProps {
counselorId: number;
nickname: string;
level: number;
ratingAverage: number;
reviewNumber: number;
iconNumber: number;
consultType: string;
price: number;
date: string;
reviewData: BuyerReview;
}
//캐릭터 넘버 레벨 별점 후기개수 상담유형 상담일자 상담가격 (남긴리뷰) 리뷰내용
export const ReviewManageCard = ({
counselorId,
nickname,
level,
ratingAverage,
reviewNumber,
iconNumber,
consultType,
price,
date,
}: ReviewManageCardProps) => {
export const ReviewManageCard = ({ reviewData }: ReviewManageCardProps) => {
const navigate = useNavigate();
return (
<Wrapper>
<UpperWrapper>
<Characters
number={iconNumber}
number={consultStyleToCharNum(reviewData.consultStyle)}
width="6.1rem"
height="5.4rem"
margin="1.2rem 0 0 1.6rem"
/>
<div>
<div className="row1">
<Body1>{nickname}</Body1>
<Caption2 color={Grey1}>{'Lv. ' + level}</Caption2>
<Body1>{reviewData.nickname}</Body1>
<Caption2 color={Grey1}>{'Lv. ' + reviewData.level}</Caption2>
</div>
<div className="row2">
<HeartIcon />
<Body3 color={Grey2}>
{ratingAverage + ' (' + reviewNumber + ')'}
{reviewData.ratingAverage + ' (' + reviewData.totalReview + ')'}
</Body3>
</div>
</div>
</UpperWrapper>
<LowerWrapper>
<div className="row">
<Body3 color={Grey3}>상담유형</Body3>
<Body3 color={Grey1}>{consultType}</Body3>
<Body3 color={Grey1}>{reviewData.consultType}</Body3>
</div>
<div className="row">
<Body3 color={Grey3}>상담일자</Body3>
<Body3 color={Grey1}>{date}</Body3>
<Body3 color={Grey1}>{reviewData.consultedAt}</Body3>
</div>
<div className="row3">
<Body3 color={Grey3}>상담가격</Body3>
<Body3 color={Grey1}>{price}원</Body3>
<Body3 color={Grey1}>
{reviewData.consultCost.toLocaleString()}원
</Body3>
</div>
<Button
text="리뷰 작성하기"
@@ -71,7 +57,7 @@ export const ReviewManageCard = ({
borderRadius="0.8rem"
onClick={() => {
//추후 해당하는 consult id에 해당하는 review로 넘어감
navigate('/buyer/review/0');
navigate('/buyer/review', { state: { reviewData: reviewData } });
}}
/>
</LowerWrapper>
Loading