diff --git a/src/@types/detail.types.ts b/src/@types/detail.types.ts index bfb4bca8..71827919 100644 --- a/src/@types/detail.types.ts +++ b/src/@types/detail.types.ts @@ -1,5 +1,6 @@ interface tourDetail { id: number; + contentTypeId: number; title: string; liked: boolean; fullAddress: string; diff --git a/src/@types/review.types.ts b/src/@types/review.types.ts index 851b017b..fe5fcb10 100644 --- a/src/@types/review.types.ts +++ b/src/@types/review.types.ts @@ -1,11 +1,27 @@ -interface ReviewRequest { - tourItemId: number; - rating: number; - keywords: Keyword[]; +export interface Keyword { + keywordId: number; content: string; + type: string; } -interface Keyword { - keywordId: number; +export interface CommentItemProps { + commentId: number; + authorNickname: string; + authorProfileImageUrl: string; + createdTime: string; content: string; + onClick?: () => void; + isAuthor: boolean; +} + +export interface MyReviewContent { + reviewId: number; + authorNickname: string; + authorProfileImageUrl: string; + rating: number; + createdTime: string; + content: string; + keywords: Keyword[]; + commentCount: number; + isAuthor?: boolean; } diff --git a/src/@types/tours.types.ts b/src/@types/tours.types.ts index ccd95671..11e862e7 100644 --- a/src/@types/tours.types.ts +++ b/src/@types/tours.types.ts @@ -52,3 +52,25 @@ export interface LikedListType { preferTotalCount: number; notPreferTotalCount: number; } + +export interface ReviewInfoItemProps { + reviewId: number; + authorNickname: string; + authorProfileImageUrl: string; + rating: number; + createdTime: string; + content: string; + keywords: Keyword[]; // keywordId, content, type + commentCount: number; + onClick?: () => void; + tourItemId?: number; + contentTypeId?: number; + canTextOverflow: boolean; + isAuthor?: boolean; +} + +interface Keyword { + keywordId: number; + content: string; + type: string; +} diff --git a/src/@types/trips.types.ts b/src/@types/trips.types.ts index e2ebbb0c..36f92cd8 100644 --- a/src/@types/trips.types.ts +++ b/src/@types/trips.types.ts @@ -51,3 +51,13 @@ interface AuthorityType { tripId: string; }; } +interface TripSurveySetMemberInfo { + memberId: number; + nickname: string; + thumbnail: string; +} + +interface TripMemeberInfo { + nickname: string; + profileImageUrl: string; +} diff --git a/src/api/review.ts b/src/api/review.ts index 9c5e46df..ec7f4f43 100644 --- a/src/api/review.ts +++ b/src/api/review.ts @@ -1,6 +1,6 @@ import client from './client'; import authClient from './authClient'; - +import { ReviewRequest } from '@recoil/review'; // 리뷰 관련 API // 리뷰수정 diff --git a/src/components/DetailSectionBottom/DetailReviews.tsx b/src/components/DetailSectionBottom/DetailReviews.tsx index 8d526846..bde618f1 100644 --- a/src/components/DetailSectionBottom/DetailReviews.tsx +++ b/src/components/DetailSectionBottom/DetailReviews.tsx @@ -26,12 +26,13 @@ import ToastPopUp from '@components/common/toastpopup/ToastPopUp'; import EditDelete from '@components/common/modal/children/EditDelete'; import MyAlert from '@components/common/modal/children/MyAlert'; import { alertTypeState } from '@recoil/modal'; +import { ReviewInfoItemProps } from '@/@types/tours.types'; -interface reviewProps { - reviewData: any; -} - -export default function DetailReviews({ reviewData }: reviewProps) { +export default function DetailReviews({ + reviewData, +}: { + reviewData: tourDetail; +}) { const [reviewDataLength, setReviewDataLength] = useState(0); const { title, contentTypeId } = reviewData; const params = useParams(); @@ -73,7 +74,7 @@ export default function DetailReviews({ reviewData }: reviewProps) { return
데이터를 불러오는 중 오류가 발생했습니다.
; } - const handleReviewClick = (item: any) => { + const handleReviewClick = (item: ReviewInfoItemProps) => { const reviewId = item.reviewId; navigate(`/reviewComment/${reviewId}`, { state: { item, tourItemId } }); }; @@ -155,24 +156,26 @@ export default function DetailReviews({ reviewData }: reviewProps) { { return ( - {group?.data.data.reviewInfos.content.map((item: any) => ( - handleReviewClick(item)} - tourItemId={tourItemId} - contentTypeId={contentTypeId} - canTextOverflow={true} - isAuthor={item.isAuthor} - /> - ))} + {group?.data.data.reviewInfos.content.map( + (item: ReviewInfoItemProps) => ( + handleReviewClick(item)} + tourItemId={tourItemId} + contentTypeId={contentTypeId} + canTextOverflow={true} + isAuthor={item.isAuthor} + /> + ), + )} ); } diff --git a/src/components/DetailSectionBottom/ReviewItem.tsx b/src/components/DetailSectionBottom/ReviewItem.tsx index 57a89c8c..1a2817d9 100644 --- a/src/components/DetailSectionBottom/ReviewItem.tsx +++ b/src/components/DetailSectionBottom/ReviewItem.tsx @@ -21,30 +21,9 @@ import { import { MouseEvent, useState } from 'react'; import { getEmoji } from '@utils/utils'; import { getStarFill } from '@utils/getStarFill'; +import { ReviewInfoItemProps } from '@/@types/tours.types'; -interface Keyword { - keywordId: number; - content: string; - type: string; -} - -interface ItemProps { - reviewId: number; - authorNickname: string; - authorProfileImageUrl: string; - rating: number; - createdTime: any; - content: string; - keywords: Keyword[]; // keywordId, content, type - commentCount: number; - onClick?: () => void; - tourItemId?: number; - contentTypeId?: number; - canTextOverflow: boolean; - isAuthor?: boolean; -} - -const Item: React.FC = (props: ItemProps) => { +const Item: React.FC = (props: ReviewInfoItemProps) => { const { reviewId, authorNickname, diff --git a/src/components/DetailSectionTop/DetailToursButtons.tsx b/src/components/DetailSectionTop/DetailToursButtons.tsx index 8c9e01a6..49de97fb 100644 --- a/src/components/DetailSectionTop/DetailToursButtons.tsx +++ b/src/components/DetailSectionTop/DetailToursButtons.tsx @@ -10,11 +10,11 @@ import { useNavigate, useParams } from 'react-router-dom'; import { useSetRecoilState } from 'recoil'; import { getMember } from '@api/member'; -interface reviewProps { - reviewData: any; -} - -export default function DetailTourButtons({ reviewData }: reviewProps) { +export default function DetailTourButtons({ + reviewData, +}: { + reviewData: tourDetail; +}) { const { title, contentTypeId } = reviewData; const params = useParams(); const tourItemId = Number(params.id); diff --git a/src/components/Review/CommentItem.tsx b/src/components/Review/CommentItem.tsx index 6c1b907e..9b8a8fdd 100644 --- a/src/components/Review/CommentItem.tsx +++ b/src/components/Review/CommentItem.tsx @@ -6,17 +6,9 @@ import { } from '@recoil/modal'; import { commentState, targetCommentIdState } from '@recoil/review'; import { useRecoilState, useSetRecoilState } from 'recoil'; -interface ItemProps { - commentId: number; - authorNickname: string; - authorProfileImageUrl: string; - createdTime: any; - content: string; - onClick?: () => void; - isAuthor: boolean; -} +import { CommentItemProps } from '@/@types/review.types'; -const CommentItem: React.FC = (props: ItemProps) => { +const CommentItem: React.FC = (props: CommentItemProps) => { const { commentId, authorNickname, diff --git a/src/components/Review/MyReview.tsx b/src/components/Review/MyReview.tsx index ed33f095..a34d61ce 100644 --- a/src/components/Review/MyReview.tsx +++ b/src/components/Review/MyReview.tsx @@ -22,6 +22,7 @@ import MyAlert from '@components/common/modal/children/MyAlert'; import { alertTypeState } from '@recoil/modal'; import { PenIcon } from '@components/common/icons/Icons'; import ScrollTopButton from '@components/Plan/ScrollTopButton'; +import { MyReviewContent } from '@/@types/review.types'; export default function MyReview() { const [reviewDataLength, setReviewDataLength] = useState(0); @@ -60,7 +61,7 @@ export default function MyReview() { return
데이터를 불러오는 중 오류가 발생했습니다.
; } - const handleReviewClick = (item: any) => { + const handleReviewClick = (item: MyReviewContent) => { const reviewId = item.reviewId; navigate(`/reviewComment/${reviewId}`, { state: { item } }); }; @@ -134,7 +135,7 @@ export default function MyReview() { { return ( - {group?.data.data.content.map((item: any) => { + {group?.data.data.content.map((item: MyReviewContent) => { item.isAuthor = true; return ( - {group?.data.data.comments.content.map((item: any) => ( - - ))} + {group?.data.data.comments.content.map( + (item: CommentItemProps) => ( + + ), + )} ); } diff --git a/src/components/Review/ReviewKeyword.tsx b/src/components/Review/ReviewKeyword.tsx index 1d9d7ad3..1b33a700 100644 --- a/src/components/Review/ReviewKeyword.tsx +++ b/src/components/Review/ReviewKeyword.tsx @@ -4,11 +4,7 @@ import { getReviewKeywords } from '@api/review'; import { useQuery } from '@tanstack/react-query'; import { useRecoilState } from 'recoil'; import { keywordsState } from '@recoil/review'; - -interface Keyword { - keywordId: number; - content: string; -} +import { Keyword } from '@/@types/review.types'; export default function ReviewKeyword() { const location = useLocation(); @@ -59,7 +55,7 @@ export default function ReviewKeyword() {
어떤 점이 좋았나요?
{reviewKeywords?.data?.data?.keywords?.map( - (keyword: any, index: number) => { + (keyword: Keyword, index: number) => { const row = Math.floor(index / columns) + 1; const col = (index % columns) + 1; diff --git a/src/components/Review/ReviewRating.tsx b/src/components/Review/ReviewRating.tsx index 7ec0baed..f4f5ffb1 100644 --- a/src/components/Review/ReviewRating.tsx +++ b/src/components/Review/ReviewRating.tsx @@ -13,7 +13,7 @@ const ReviewRating = () => { const handleStarClick = (index: number) => { const newRating = index + 1; - setRating((prevRating: any) => { + setRating((prevRating: number) => { const updatedIsHalfClicked = prevRating === newRating ? !isHalfClicked : false; setIsHalfClicked(updatedIsHalfClicked); diff --git a/src/components/Trip/TripInfo.tsx b/src/components/Trip/TripInfo.tsx index 7e753878..72b02f76 100644 --- a/src/components/Trip/TripInfo.tsx +++ b/src/components/Trip/TripInfo.tsx @@ -26,7 +26,7 @@ const ShareList = () => { <>
- {members.map((member: any, index: number) => { + {members.map((member: TripMemeberInfo, index: number) => { return (
{
- {members?.map((member: any, index: number) => ( + {members?.map((member: TripMemeberInfo, index: number) => (
{member.profileImageUrl && member.profileImageUrl !== 'http://asiduheimage.jpg' ? ( diff --git a/src/components/Trip/TripParticipant.tsx b/src/components/Trip/TripParticipant.tsx index d114a6d5..28938a6f 100644 --- a/src/components/Trip/TripParticipant.tsx +++ b/src/components/Trip/TripParticipant.tsx @@ -7,9 +7,11 @@ interface ParticipantStatusProps { status: string; } -const ParticipantList: React.FC<{ infos: any[] }> = ({ infos }) => ( +const ParticipantList: React.FC<{ infos: TripSurveySetMemberInfo[] }> = ({ + infos, +}) => (
- {infos.map((info: any) => ( + {infos.map((info: TripSurveySetMemberInfo) => (
diff --git a/src/components/common/modal/Modal.tsx b/src/components/common/modal/Modal.tsx index 8296f7bc..340f72e7 100644 --- a/src/components/common/modal/Modal.tsx +++ b/src/components/common/modal/Modal.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { ReactNode } from 'react'; import Modal from 'react-modal'; import { modalChildrenState } from '@recoil/modal'; import { useRecoilValue } from 'recoil'; @@ -6,7 +6,7 @@ import { useRecoilValue } from 'recoil'; interface ModalProps { isOpen: boolean; closeModal: () => void; - children: any; + children: ReactNode; } const ModalComponent: React.FC = ({ diff --git a/src/recoil/review.ts b/src/recoil/review.ts index 1c9753e1..4c7b0156 100644 --- a/src/recoil/review.ts +++ b/src/recoil/review.ts @@ -1,6 +1,6 @@ import { atom } from 'recoil'; -interface ReviewRequest { +export interface ReviewRequest { tourItemId: number; rating: number; keywords: Keyword[];