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..93e1e310 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} + /> + ), + )} ); } @@ -187,7 +190,7 @@ export default function DetailReviews({ reviewData }: reviewProps) { {modalChildren === 'MyAlert' && alertType === 'LoginReview' && ( )} 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..7bb3cfb5 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 } }); }; @@ -113,7 +114,7 @@ export default function MyReview() {
- 작성한 리뷰가 없습니다 + 내가 쓴 리뷰가 없어요
다녀온 여행지의 리뷰를 남겨보세요! @@ -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 ( void; -} - -const ReviewButton = (props: ButtonProps) => { +const ReviewButton = (props: { onClick: () => void }) => { const { onClick } = props; const rating = useRecoilValue(ratingState); const [isRatingValid, setIsRatingValid] = useState(false); diff --git a/src/components/Review/ReviewComments.tsx b/src/components/Review/ReviewComments.tsx index 16fc7a00..965314d2 100644 --- a/src/components/Review/ReviewComments.tsx +++ b/src/components/Review/ReviewComments.tsx @@ -13,6 +13,7 @@ import MyAlert from '@components/common/modal/children/MyAlert'; import { commentState, toastPopUpState } from '@recoil/review'; import { alertTypeState } from '@recoil/modal'; import ToastPopUp from '@components/common/toastpopup/ToastPopUp'; +import { CommentItemProps } from '@/@types/review.types'; export default function ReviewComments() { const params = useParams(); @@ -88,8 +89,8 @@ export default function ReviewComments() {
{commentDataLength == 0 && ( -
-
댓글이 없습니다.
+
+
아직 댓글이 없어요.
첫 댓글을 작성해보세요!
)} @@ -107,17 +108,19 @@ export default function ReviewComments() { { 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/Trip/TripPreference.tsx b/src/components/Trip/TripPreference.tsx index bcc94302..16749894 100644 --- a/src/components/Trip/TripPreference.tsx +++ b/src/components/Trip/TripPreference.tsx @@ -14,19 +14,19 @@ import { useGetTripsAuthority } from '@hooks/useGetTripsAuthority'; import { useNavigate } from 'react-router-dom'; import { getMember } from '@api/member'; -interface RatioBarParams { +type RatioBarParams = { value: number; total: number; color: string; label1: string; label2: string; -} +}; -interface PercentageParams { +type PercentageParams = { value: number; total: number; color: string; -} +}; const TripPreferenceButton: React.FC = () => { const { tripAuthority } = useGetTripsAuthority(); diff --git a/src/components/Trip/TripRealtimeMember.tsx b/src/components/Trip/TripRealtimeMember.tsx index c57afe5a..db5a77ea 100644 --- a/src/components/Trip/TripRealtimeMember.tsx +++ b/src/components/Trip/TripRealtimeMember.tsx @@ -6,7 +6,6 @@ import { Navigation } from 'swiper/modules'; const TripRealtimeMember = () => { const { tripMember } = useContext(socketContext); - const tripMemberData = tripMember?.data; return ( @@ -15,7 +14,7 @@ const TripRealtimeMember = () => { slidesPerView={5} navigation={true} modules={[Navigation]} - className="w-[100vw]items-center flex max-w-[375px] justify-center"> + className="flex w-[100vw] max-w-[375px] items-center justify-center"> {tripMemberData?.tripMembers?.map((member) => { const isConnected = member?.connected; const thumbnailUrl = member?.thumbnailUrl; 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/components/common/toastpopup/ToastPopUp.tsx b/src/components/common/toastpopup/ToastPopUp.tsx index 4dbf53ca..004ebacd 100644 --- a/src/components/common/toastpopup/ToastPopUp.tsx +++ b/src/components/common/toastpopup/ToastPopUp.tsx @@ -51,7 +51,7 @@ const ToastPopUp: React.FC = ({ noun, verb }) => {

{noun} - {particle} {verb}되었습니다. + {particle} {verb}되었어요.

); 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[];