Skip to content

Commit

Permalink
Feat: 빌드준비완료
Browse files Browse the repository at this point in the history
  • Loading branch information
LeHiHo committed Jan 4, 2024
1 parent 1b26218 commit f8f1559
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 53 deletions.
38 changes: 18 additions & 20 deletions src/components/DetailSectionBottom/DetailReviews.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getToursReviews } from '@api/tours';
import { useEffect, useState } from 'react';
import InfiniteScroll from 'react-infinite-scroller';
import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
// import InfiniteScroll from 'react-infinite-scroller';
import { useQuery } from '@tanstack/react-query';
import ReviewItem from './ReviewItem';
import { StarIcon } from '@components/common/icons/Icons';
import { useNavigate, useParams } from 'react-router-dom';
Expand Down Expand Up @@ -80,24 +80,22 @@ export default function DetailReviews({ reviewData }: reviewProps) {
</div>
{reviewDataLength > 0 && (
<div>
{toursReviews?.data?.data?.reviewInfos?.content?.map(
(item: any, index: number) => (
<ReviewItem
key={item.reviewId}
reviewId={item.reviewId}
authorNickname={item.authorNickname}
authorProfileImageUrl={item.authorProfileImageUrl}
rating={item.rating}
createdTime={item.createdTime}
content={item.content}
keywords={item.keywords} // keywordId, content, type
commentCount={item.commentCount}
onClick={() => handleReviewClick(item)}
tourItemId={tourItemId}
contentTypeId={contentTypeId}
/>
),
)}
{toursReviews?.data?.data?.reviewInfos?.content?.map((item: any) => (
<ReviewItem
key={item.reviewId}
reviewId={item.reviewId}
authorNickname={item.authorNickname}
authorProfileImageUrl={item.authorProfileImageUrl}
rating={item.rating}
createdTime={item.createdTime}
content={item.content}
keywords={item.keywords} // keywordId, content, type
commentCount={item.commentCount}
onClick={() => handleReviewClick(item)}
tourItemId={tourItemId}
contentTypeId={contentTypeId}
/>
))}
</div>
)}
{reviewDataLength == 0 && (
Expand Down
3 changes: 1 addition & 2 deletions src/components/DetailSectionBottom/DetailSectionBottom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,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';

export default function DetailSectionBottom() {
const params = useParams();
const tourItemId = Number(params.id);
const { isError, isLoading, isFetching, data } = useQuery({
const { isError, data } = useQuery({
queryKey: ['details', tourItemId],
queryFn: () => getDetailTours(tourItemId),
});
Expand Down
3 changes: 1 addition & 2 deletions src/components/DetailSectionBottom/ReviewItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect } from 'react';
import { StarIcon, ChatIcon, MoreIcon } from '@components/common/icons/Icons';
import { useSetRecoilState, useRecoilState } from 'recoil';
import { isModalOpenState, titleState } from '@recoil/modal';
Expand Down Expand Up @@ -45,7 +44,7 @@ const Item: React.FC<ItemProps> = (props: ItemProps) => {
tourItemId,
contentTypeId,
} = props;
const [isModalOpen, setIsModalOpen] = useRecoilState(isModalOpenState);
const [_, setIsModalOpen] = useRecoilState(isModalOpenState);

const setRating = useSetRecoilState(ratingState);
const setKeywords = useSetRecoilState(keywordsState);
Expand Down
8 changes: 4 additions & 4 deletions src/components/Review/CommentItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MoreIcon } from '@components/common/icons/Icons';
import { useSetRecoilState, useRecoilState, useRecoilValue } from 'recoil';
import { useSetRecoilState, useRecoilState } from 'recoil';
import { isModalOpenState, titleState } from '@recoil/modal';
import {
commentState,
Expand All @@ -22,12 +22,12 @@ const CommentItem: React.FC<ItemProps> = (props: ItemProps) => {
const {
commentId,
authorNickname,
authorProfileImageUrl,
// authorProfileImageUrl,
createdTime,
content,
onClick,
// onClick,
} = props;
const [isModalOpen, setIsModalOpen] = useRecoilState(isModalOpenState);
const [_, setIsModalOpen] = useRecoilState(isModalOpenState);
const setTitle = useSetRecoilState(titleState);
const [targetCommentId, setTargetCommentId] =
useRecoilState(targetCommentIdState);
Expand Down
8 changes: 4 additions & 4 deletions src/components/Review/Review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export default function Review() {
const params = useParams();
const navigate = useNavigate();
const tourItemId = Number(params.id);
const [rating, setRating] = useRecoilState(ratingState);
const [keywords, setKeywords] = useRecoilState(keywordsState);
const [content, setContent] = useRecoilState(contentState);
const [rating] = useRecoilState(ratingState);
const [keywords] = useRecoilState(keywordsState);
const [content] = useRecoilState(contentState);
const isModifyingReview = useRecoilValue(isModifyingReviewState);
const targetReviewId = useRecoilValue(targetReviewIdState);
const [isModalOpen, setIsModalOpen] = useRecoilState(isModalOpenState);
const [_, setIsModalOpen] = useRecoilState(isModalOpenState);

const handlePostReview = async () => {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Review/ReviewButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ButtonPrimary } from '@components/common/button/Button';
import { useState, useEffect, ChangeEvent } from 'react';
import { useState, useEffect } from 'react';
import { contentState, keywordsState } from '@recoil/review';
import { useRecoilState, useRecoilValue } from 'recoil';

Expand All @@ -9,7 +9,7 @@ interface ButtonProps {

const ReviewButton = (props: ButtonProps) => {
const { onClick } = props;
const [content, setContent] = useRecoilState(contentState);
const [content] = useRecoilState(contentState);
const keywords = useRecoilValue(keywordsState);
const [isContentValid, setIsContentValid] = useState(false);
const [isKeywordsValid, setIsKeywordsValid] = useState(false);
Expand Down
11 changes: 5 additions & 6 deletions src/components/Review/ReviewComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ import { getReviewComments } from '@api/review';
import { useQuery } from '@tanstack/react-query';
import { useParams } from 'react-router-dom';
import CommentItem from './CommentItem';
import { useSetRecoilState, useRecoilState } from 'recoil';
import { isModalOpenState, titleState } from '@recoil/modal';
import { useRecoilState } from 'recoil';
import { isModalOpenState } from '@recoil/modal';
import { Modal } from '@components/common/modal';
import { useEffect } from 'react';
import { targetCommentIdState } from '@recoil/review';
// import { targetCommentIdState } from '@recoil/review';

export default function ReviewComments() {
const params = useParams();
const reviewId = Number(params.id);
const [isModalOpen, setIsModalOpen] = useRecoilState(isModalOpenState);
const setTitle = useSetRecoilState(titleState);
const setTargetCommentId = useSetRecoilState(targetCommentIdState);
// const setTitle = useSetRecoilState(titleState);
// const setTargetCommentId = useSetRecoilState(targetCommentIdState);

const { data: reviewComments } = useQuery({
queryKey: ['reviewComments'],
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/back/Back.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate, useNavigation } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { LeftIcon } from '../icons/Icons';

const Back = () => {
Expand Down
20 changes: 10 additions & 10 deletions src/components/common/modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React, { useEffect } from 'react';
import React from 'react';
import Modal from 'react-modal';
import { DeleteIcon, PenIcon } from '@components/common/icons/Icons';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { titleState, isModalOpenState } from '@recoil/modal';
import { deleteReview, putReview } from '@api/review';
import { deleteComments, putComments } from '@api/comments';
import { deleteReview } from '@api/review';
import { deleteComments } from '@api/comments';
import {
ratingState,
keywordsState,
contentState,
commentState,
// commentState,
targetReviewIdState,
reviewDataState,
// reviewDataState,
targetCommentIdState,
commentContentState,
// commentContentState,
isModifyingCommentState,
isModifyingReviewState,
tourItemIdState,
contentTypeIdState,
} from '@recoil/review';
import { Navigate, useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';

interface ModalProps {
isOpen: boolean;
Expand All @@ -30,12 +30,12 @@ const ModalComponent: React.FC<ModalProps> = ({ isOpen, closeModal }) => {
const rating = useRecoilValue(ratingState);
const keywords = useRecoilValue(keywordsState);
const content = useRecoilValue(contentState);
const comment = useRecoilValue(commentState);
// const comment = useRecoilValue(commentState);
const title = useRecoilValue(titleState);
const targetReviewId = useRecoilValue(targetReviewIdState);
const reviewData = useRecoilValue(reviewDataState);
// const reviewData = useRecoilValue(reviewDataState);
const targetCommentId = useRecoilValue(targetCommentIdState);
const commentContent = useRecoilValue(commentContentState);
// const commentContent = useRecoilValue(commentContentState);
const tourItemId = useRecoilValue(tourItemIdState);
const contentTypeId = useRecoilValue(contentTypeIdState);
const setIsModifyingReview = useSetRecoilState(isModifyingReviewState);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/signup/signup.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { UserEmailInputBox, UserPwInputBox } from '@components/user';
import { useState } from 'react';

const Signup = () => {
const [isActive, setIsActive] = useState<boolean>(false);
const [isActive] = useState<boolean>(false);

return (
<div className="relative">
Expand All @@ -27,4 +27,4 @@ const Signup = () => {
);
};

export default Signup;
export default Signup;

0 comments on commit f8f1559

Please sign in to comment.