-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from FinalDoubleTen/FE-6--feat/Tours
Feat: 인기여행지 구현
- Loading branch information
Showing
41 changed files
with
314 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
- Chore : 빌드 관련 코드 수정 | ||
- Rename : 파일 및 폴더명 수정. | ||
- Remove : 파일 삭제. | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// import { getToursReviews } from '@api/tours'; | ||
// import { useEffect, useState } from 'react'; | ||
// import InfiniteScroll from 'react-infinite-scroller'; | ||
// import { useInfiniteQuery } from '@tanstack/react-query'; | ||
// import ReviewItem from './ReviewItem'; | ||
// import { StarIcon } from '@components/common/icons/Icons'; | ||
|
||
// export default function DetailReview() { | ||
// const [reviewDataLength, setReviewDataLength] = useState<number>(0); | ||
// const tourItemId = 1; | ||
|
||
// const { | ||
// data: toursReviews, | ||
// fetchNextPage, | ||
// hasNextPage, | ||
// } = useInfiniteQuery({ | ||
// queryKey: ['toursReviews'], | ||
// queryFn: ({ pageParam }) => getToursReviews(tourItemId), | ||
// initialPageParam: 0, | ||
// getNextPageParam: (lastPage, allPages, lastPageParam) => { | ||
// const lastData = lastPage?.data?.data?.reviewInfos; | ||
// return lastData && lastData.length === 4 ? lastPageParam + 1 : undefined; | ||
// }, | ||
// }); | ||
|
||
// useEffect(() => { | ||
// if (toursReviews) { | ||
// const totalCount = toursReviews.pages.reduce( | ||
// (accumulator, page) => | ||
// accumulator + (page?.data?.data?.reviewInfos?.length || 0), | ||
// 0, | ||
// ); | ||
// setReviewDataLength(totalCount); | ||
// } | ||
// }, [toursReviews]); | ||
|
||
// return ( | ||
// <> | ||
// <div className="mb-4 mt-2 text-lg font-bold"> | ||
// 리뷰 <span className="text-gray3">{reviewDataLength}</span> | ||
// </div> | ||
// {reviewDataLength > 0 && ( | ||
// <InfiniteScroll | ||
// hasMore={hasNextPage} | ||
// loadMore={() => fetchNextPage()} | ||
// initialLoad={false}> | ||
// {toursReviews?.pages?.map((page, pageIndex) => ( | ||
// <div key={pageIndex}> | ||
// {page?.data?.data?.reviewInfos?.map( | ||
// (item: any, index: number) => ( | ||
// <ReviewItem | ||
// key={item.reviewId} | ||
// authorNickname={item.authorNickname} | ||
// authorProfileImageUrl={item.authorProfileImageUrl} | ||
// rating={item.rating} | ||
// createdTime={item.createdTime} | ||
// content={item.content} | ||
// keywords={item.keywords} // keywordId, content, type | ||
// commentCount={2} //commentCount가 swagger에는 있는데 response에는 없음 | ||
// /> | ||
// ), | ||
// )} | ||
// </div> | ||
// ))} | ||
// </InfiniteScroll> | ||
// )} | ||
// {reviewDataLength == 0 && ( | ||
// <div className="flex flex-col items-center justify-center"> | ||
// <div className="mb-2 flex"> | ||
// {Array.from({ length: 5 }, (_, index) => ( | ||
// <StarIcon | ||
// key={index} | ||
// size={30} | ||
// color="none" | ||
// fill={'#EDEDED'} | ||
// className="cursor-pointer" | ||
// /> | ||
// ))} | ||
// </div> | ||
// <div className="text-sm text-gray3">첫번째 리뷰를 남겨주세요!</div> | ||
// </div> | ||
// )} | ||
// </> | ||
// ); | ||
// } |
29 changes: 8 additions & 21 deletions
29
src/components/DetailSectionBottom/DetailSectionBottom.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
import { DetailReviews, DetailReviewStats } from '.'; | ||
import { useParams } from 'react-router-dom'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getDetailTours } from '@api/tours'; | ||
import { useEffect } from 'react'; | ||
import { DetailReviewStats } from '.'; | ||
|
||
// 담당 컴포넌트들 호출하는 컴포넌트(분업 때문에 페이지 느낌으로 나눠봤습니다), API 호출 컴포넌트, | ||
export default function DetailSectionBottom() { | ||
const params = useParams(); | ||
const tourItemId = Number(params.id); | ||
const { isError, isLoading, isFetching, data } = useQuery({ | ||
queryKey: ['details', tourItemId], | ||
queryFn: () => getDetailTours(tourItemId), | ||
}); | ||
if (data) { | ||
return ( | ||
<> | ||
<DetailReviewStats /> | ||
<DetailReviews reviewData={data} /> | ||
</> | ||
); | ||
} | ||
|
||
if (isError) console.log('error'); | ||
return ( | ||
<> | ||
<DetailReviewStats /> | ||
{/* <DetailReview /> */} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import DetailReviewStats from './DetailReviewStats'; | ||
import DetailReviews from './DetailReviews'; | ||
|
||
export { DetailReviews, DetailReviewStats }; | ||
export { DetailReviewStats }; |
Oops, something went wrong.