Skip to content

Commit

Permalink
Merge pull request #270 from FinalDoubleTen/FE-102--feat/Refactor
Browse files Browse the repository at this point in the history
Fe 102  feat/refactor
  • Loading branch information
seungjun222 authored Jan 25, 2024
2 parents baaf35a + a3f74b3 commit 9af0c24
Show file tree
Hide file tree
Showing 33 changed files with 38 additions and 199 deletions.
15 changes: 11 additions & 4 deletions src/@types/review.types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export interface Keyword {
interface Keyword {
keywordId: number;
content: string;
type: string;
type?: string;
}

export interface CommentItemProps {
interface CommentItemProps {
commentId: number;
authorNickname: string;
authorProfileImageUrl: string;
Expand All @@ -14,7 +14,7 @@ export interface CommentItemProps {
isAuthor: boolean;
}

export interface MyReviewContent {
interface MyReviewContent {
reviewId: number;
authorNickname: string;
authorProfileImageUrl: string;
Expand All @@ -25,3 +25,10 @@ export interface MyReviewContent {
commentCount: number;
isAuthor?: boolean;
}

interface ReviewRequest {
tourItemId: number;
rating: number;
keywords: Keyword[];
content: string;
}
20 changes: 10 additions & 10 deletions src/@types/tours.types.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
export type TourKeywordInfo = {
interface TourKeywordInfo {
keywordId: number;
content: string;
type: string;
keywordCount: number;
};
}

export interface RegionTypes {
interface RegionTypes {
areaCode?: number;
subAreaCode?: number;
name: string;
}

export interface ToursCategoryItemProps extends RegionTypes {
interface ToursCategoryItemProps extends RegionTypes {
isSelected: boolean;
onSelect: (name: string) => void;
}

export interface ToursListProps {
interface ToursListProps {
selectedRegion: string;
}

export interface ToursCategoryProps extends ToursListProps {
interface ToursCategoryProps extends ToursListProps {
setSelectedRegion: (region: string) => void;
}

export interface TourType {
interface TourType {
contentTypeId?: number;
id: number;
title: string;
Expand All @@ -38,7 +38,7 @@ export interface TourType {
latitude?: string;
}

export interface LikedListType {
interface LikedListType {
tripLikedItemId: number;
tourItemId: number;
contentTypeId: number;
Expand All @@ -53,7 +53,7 @@ export interface LikedListType {
notPreferTotalCount: number;
}

export interface ReviewInfoItemProps {
interface ReviewInfoItemProps {
reviewId: number;
authorNickname: string;
authorProfileImageUrl: string;
Expand All @@ -72,5 +72,5 @@ export interface ReviewInfoItemProps {
interface Keyword {
keywordId: number;
content: string;
type: string;
type?: string;
}
12 changes: 12 additions & 0 deletions src/@types/trips.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,15 @@ interface TripMemeberInfo {
nickname: string;
profileImageUrl: string;
}

interface Participant {
memberId: number;
nickname: string;
thumbnail: string;
}

interface Participants {
tripSurveyMemberCount: number;
tripSurveySetMemberInfos: Participant[];
nonTripSurveySetMemberInfos: Participant[];
}
10 changes: 2 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { ThemeProvider } from 'styled-components';
import { GlobalStyle } from '@styles/globalStyles';
import { theme } from '@styles/theme';
import { RecoilRoot } from 'recoil';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
Expand All @@ -17,11 +14,8 @@ const App = () => {
<RecoilRoot>
<BrowserRouter>
<ScrollToTop />
<ThemeProvider theme={theme}>
<GlobalStyle />
<MainRouter />
<SocketRouter />
</ThemeProvider>
<MainRouter />
<SocketRouter />
</BrowserRouter>
</RecoilRoot>
<ReactQueryDevtools initialIsOpen={false} />
Expand Down
1 change: 0 additions & 1 deletion src/api/review.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import client from './client';
import authClient from './authClient';
import { ReviewRequest } from '@recoil/review';
// 리뷰 관련 API

// 리뷰수정
Expand Down
1 change: 0 additions & 1 deletion src/components/DetailSectionBottom/DetailReviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ 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';

export default function DetailReviews({
reviewData,
Expand Down
3 changes: 1 addition & 2 deletions src/components/DetailSectionBottom/ReviewItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { MouseEvent, useState } from 'react';
import { getEmoji } from '@utils/utils';
import { getStarFill } from '@utils/getStarFill';
import { ReviewInfoItemProps } from '@/@types/tours.types';

const Item: React.FC<ReviewInfoItemProps> = (props: ReviewInfoItemProps) => {
const {
Expand Down Expand Up @@ -185,7 +184,7 @@ const Item: React.FC<ReviewInfoItemProps> = (props: ReviewInfoItemProps) => {
.map((keyword, idx) => (
<div
key={idx}
className="rounded-md bg-gray1 px-2 py-1 text-gray6">
className="rounded-md bg-gray1 px-2 py-1 text-xs text-gray6">
{getEmoji(keyword.content)} {keyword.content}
</div>
))}
Expand Down
1 change: 0 additions & 1 deletion src/components/Review/CommentItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@recoil/modal';
import { commentState, targetCommentIdState } from '@recoil/review';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { CommentItemProps } from '@/@types/review.types';

const CommentItem: React.FC<CommentItemProps> = (props: CommentItemProps) => {
const {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Review/MyReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +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/common/scrollTopButton/ScrollTopButton';
import { MyReviewContent } from '@/@types/review.types';


export default function MyReview() {
const [reviewDataLength, setReviewDataLength] = useState<number>(0);
Expand Down
1 change: 0 additions & 1 deletion src/components/Review/Review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { isModalOpenState } from '@recoil/modal';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { useParams, useNavigate } from 'react-router-dom';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { ReviewRequest } from '@recoil/review';
interface EditReviewMutationParams {
reviewData: ReviewRequest;
targetReviewId: number;
Expand Down
1 change: 0 additions & 1 deletion src/components/Review/ReviewComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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();
Expand Down
1 change: 0 additions & 1 deletion src/components/Review/ReviewKeyword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getReviewKeywords } from '@api/review';
import { useQuery } from '@tanstack/react-query';
import { useRecoilState } from 'recoil';
import { keywordsState } from '@recoil/review';
import { Keyword } from '@/@types/review.types';

export default function ReviewKeyword() {
const location = useLocation();
Expand Down
1 change: 0 additions & 1 deletion src/components/Tours/ToursCategory.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { RegionTypes, ToursCategoryProps } from '@/@types/tours.types';
import ToursCategoryItem from './ToursCategoryItem';
import { getPopularRegion } from '@api/region';
import { Swiper, SwiperSlide } from 'swiper/react';
Expand Down
2 changes: 0 additions & 2 deletions src/components/Tours/ToursCategoryItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ToursCategoryItemProps } from '@/@types/tours.types';

const ToursCategoryItem = ({
name,
isSelected,
Expand Down
1 change: 0 additions & 1 deletion src/components/Tours/ToursItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType } from '@/@types/tours.types';
import { HeartIcon, StarIcon } from '@components/common/icons/Icons';
import Like from '@components/common/like/Like';
import { useNavigate } from 'react-router-dom';
Expand Down
1 change: 0 additions & 1 deletion src/components/Tours/ToursList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType, ToursListProps } from '@/@types/tours.types';
import { getTours } from '@api/tours';
import { useInfiniteQuery } from '@tanstack/react-query';
import React, { useEffect, useState } from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/components/Wish/WishItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType } from '@/@types/tours.types';
import { HeartIcon, StarIcon } from '@components/common/icons/Icons';
import Like from '@components/common/like/Like';
import { useEffect, useState } from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/components/Wish/WishList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import InfiniteScroll from 'react-infinite-scroller';
import { v4 as uuidv4 } from 'uuid';
import WishItem from './WishItem';
import ToursItemSkeleton from '@components/Tours/ToursItemSkeleton';
import { TourType } from '@/@types/tours.types';
import { Spinner } from '@components/common/spinner/Spinner';

interface WishListProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/nav/InputComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const InputComment: React.FC<InputCommentProps> = () => {
};

return (
<div className="fixed bottom-0 mt-auto flex flex h-[64px] w-[412px] items-center justify-center border border-solid border-[#EDEDED] bg-white ">
<div className="fixed bottom-0 mt-auto flex flex h-[64px] w-full items-center justify-center border border-solid border-[#EDEDED] bg-white ">
<div className="ml-4 mr-4 flex h-[40px] w-[375px] items-center rounded-md border border-solid border-[#EDEDED]">
<div className="pl-1 pr-0.5 text-sm font-bold text-[#29ddf6]"></div>
<div className="flex w-full ">
Expand Down
1 change: 0 additions & 1 deletion src/components/search/ResultCategory.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ButtonWhite } from '@components/common/button/Button';
import { TourType } from '@/@types/tours.types';
import { InfiniteQueryObserverResult } from '@tanstack/react-query';
import { ResultItem } from './ResultItem';

Expand Down
1 change: 0 additions & 1 deletion src/components/search/ResultItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType } from '@/@types/tours.types';
import { useNavigate } from 'react-router-dom';

export const ResultItem = ({ result }: { result: TourType }) => {
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useReviewStats.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import { getToursReviews } from '@api/tours';
import { TourKeywordInfo } from '@/@types/tours.types';
import { useParams } from 'react-router-dom';

type UseGetToursReviewsReturn = {
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useReviewStatsCalculator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from 'react';
import { TourKeywordInfo } from '@/@types/tours.types';

const getMaxMinCounts = (reviewStats: TourKeywordInfo[]) => {
const counts = reviewStats.map((item) => item.keywordCount);
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/AddToTripPlan/OurLikedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import InfiniteScroll from 'react-infinite-scroller';
import { v4 as uuidv4 } from 'uuid';
import { OurLikedListItem } from './OurLikedListItem';
import { LikedListType } from '@/@types/tours.types';
import { Spinner } from '@components/common/spinner/Spinner';

interface WishListProps {
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/AddToTripPlan/OurLikedListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { LikedListType } from '@/@types/tours.types';
import { ListCheckBtn } from '@components/common/button/ListSelectBtn';
import { StarIcon } from '@components/common/icons/Icons';
import { selectedItemsState } from '@recoil/listItem';
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/addToOurPlace/MyLikedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import InfiniteScroll from 'react-infinite-scroller';
import { v4 as uuidv4 } from 'uuid';
import { MyLikedListItem } from './MyLikedListItem';
import { TourType } from '@/@types/tours.types';
import { Spinner } from '@components/common/spinner/Spinner';

interface WishListProps {
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/addToOurPlace/MyLikedListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType } from '@/@types/tours.types';
import { ListCheckBtn } from '@components/common/button/ListSelectBtn';
import { StarIcon } from '@components/common/icons/Icons';
import { selectedItemsState } from '@recoil/listItem';
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/addToOurPlace/ResultCategoryPlan.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ButtonWhite } from '@components/common/button/Button';
import { TourType } from '@/@types/tours.types';
import { InfiniteQueryObserverResult } from '@tanstack/react-query';
import { ResultItemPlan } from './ResultItem';
import AddToListButton from './AddtoListBtn';
Expand Down
1 change: 0 additions & 1 deletion src/pages/plan/addToOurPlace/ResultItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TourType } from '@/@types/tours.types';
import { ListSelectBtn } from '@components/common/button/ListSelectBtn';
import { StarIcon } from '@components/common/icons/Icons';
import { selectedItemsState } from '@recoil/listItem';
Expand Down
12 changes: 0 additions & 12 deletions src/recoil/review.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import { atom } from 'recoil';

export interface ReviewRequest {
tourItemId: number;
rating: number;
keywords: Keyword[];
content: string;
}

type Keyword = {
keywordId: number;
content: string;
};

export const ratingState = atom({
key: 'ratingState',
default: 0,
Expand Down
12 changes: 0 additions & 12 deletions src/recoil/trip.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import { atom } from 'recoil';

type Participant = {
memberId: number;
nickname: string;
thumbnail: string;
};

export type Participants = {
tripSurveyMemberCount: number;
tripSurveySetMemberInfos: Participant[];
nonTripSurveySetMemberInfos: Participant[];
};

export const participantsState = atom<Participants>({
key: 'participantsState',
default: {
Expand Down
Loading

0 comments on commit 9af0c24

Please sign in to comment.