Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/api/review/review.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Review, ReviewDetailResponse, ReviewResponse } from '@/@types/review';

Check failure on line 1 in src/api/review/review.ts

View workflow job for this annotation

GitHub Actions / Code Test (22.x)

Module '"@/@types/review"' has no exported member 'ReviewDetailResponse'.

Check failure on line 1 in src/api/review/review.ts

View workflow job for this annotation

GitHub Actions / Code Test (22.x)

Module '"@/@types/review"' has no exported member 'ReviewResponse'.
import { ApiResponse } from '@/@types/api';
import { BaseResponse } from '@/@types/api';
import { TravelReviewRateScore } from '@/@types/travel';
import { http } from '../fetcher';

Expand Down Expand Up @@ -37,26 +37,26 @@
}

export const getPopularReview = () => {
return http.get<ApiResponse<Review[]>>('/reviews/popular');
return http.get<BaseResponse<Review[]>>('/reviews/popular');
};

export const getTravelReview = ({
travelId,
pageParam,
}: TravelReviewParams) => {
return http.get<ApiResponse<TravelReview>>(
return http.get<BaseResponse<TravelReview>>(
`/reviews?id=${travelId}&page=${pageParam}`,
);
};

export const getTravelReviewRate = ({ travelId }: { travelId: number }) => {
return http.get<ApiResponse<TravelReviewRate>>(
return http.get<BaseResponse<TravelReviewRate>>(
`/reviews/${travelId}/ratings`,
);
};

export const getReview = ({ pageParam, sortOrder }: ReviewParams) => {
return http.get<ApiResponse<ReviewResponse>>(
return http.get<BaseResponse<ReviewResponse>>(
`/reviews?page=${pageParam}&sortBy=${sortOrder}&size=12`,
);
};
Expand Down
12 changes: 6 additions & 6 deletions src/components/card/user/UserCard.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { UserList } from '@/@types/user';
import { PopularUser } from '@/@types/user';
import Link from 'next/link';
import UserIcon from '../../common/user/UserIcon';
import UserTag from '../../common/tag/UserTag';

const UserCard = ({
nickName,
nickname,
profileImage,
openTravelCount,
reviewCount,
hashTags,
userId,
}: UserList) => {
}: PopularUser) => {
return (
<Link
href={`/${userId}`}
aria-label={`${nickName} 프로필 보기`}
aria-label={`${nickname} 프로필 보기`}
className="flex h-[246px] w-[200px] flex-col items-center justify-center rounded border border-line-normal px-[21px] py-5 lg:h-[306px] lg:w-[332px]"
>
<UserIcon profileImage={profileImage} nickname={nickName} />
<UserIcon profileImage={profileImage} nickname={nickname} />
<div className="flex flex-col items-center justify-center gap-0.5 pb-4 pt-4 md:pt-6">
<h3 className="heading-1-b">{nickName}</h3>
<h3 className="heading-1-b">{nickname}</h3>
<p className="body-3-m whitespace-nowrap text-label-alternative">
모임장 {openTravelCount}회 • 리뷰 {reviewCount}개
</p>
Expand Down
32 changes: 32 additions & 0 deletions src/components/common/tag/DomesticTag.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Meta, StoryObj } from '@storybook/react';
import DomesticTag from './DomesticTag';

const meta = {
title: 'Components/Common/tag',
component: DomesticTag,
tags: ['autodocs'],
argTypes: {
isDomestic: {
control: 'boolean',
description: '여행 타입을 설정합니다. true는 국내, false는 해외입니다.',
},
},
} satisfies Meta<typeof DomesticTag>;

export default meta;

type Story = StoryObj<typeof meta>;

const Template = (args: { isDomestic: boolean }) => (
<div className="flex gap-3">
<DomesticTag {...args} isDomestic />
<DomesticTag {...args} isDomestic={false} />
</div>
);

export const AllVariants: Story = {
render: Template,
args: {
isDomestic: true,
},
};
6 changes: 3 additions & 3 deletions src/components/main/weeklyUser/WeeklyUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/css';
import 'swiper/css/pagination';
import { UserList } from '@/@types/user';
import { PopularUser } from '@/@types/user';
import Link from 'next/link';
import ButtonRounded from '@/components/common/button/ButtonRounded';
import UserCard from '../../card/user/UserCard';
import WeeklyUserHeader from './WeeklyUserHeader';

const WeeklyUser = ({ userList }: { userList: UserList[] }) => {
const WeeklyUser = ({ userList }: { userList: PopularUser[] }) => {
if (userList.length === 0) {
return (
<section className="mx-auto h-auto max-w-[1480px] px-5 pb-32 pt-12 sm:mb-14 md:px-10">
Expand Down Expand Up @@ -51,7 +51,7 @@ const WeeklyUser = ({ userList }: { userList: UserList[] }) => {
>
<UserCard
userId={user.userId}
nickName={user.nickName}
nickname={user.nickname}
profileImage={user.profileImage}
openTravelCount={user.openTravelCount}
reviewCount={user.reviewCount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('MySelfTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down Expand Up @@ -70,8 +70,8 @@ describe('MySelfTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand All @@ -81,8 +81,8 @@ describe('MySelfTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '부산',
image: 'https://example.com/image.jpg',
travelLocation: '부산',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const MySelfTravel = () => {
travelImage={travel.travelImage}
startAt={travel.startAt}
endAt={travel.endAt}
bookmarkFlag
bookmarkFlag={travel.bookmarkFlag}
formattedStartDate={checkTomorrow(travel.startAt)}
/>
<HorizontalDivider className="mt-5 xl:mt-6" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('CheckedTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down Expand Up @@ -70,8 +70,8 @@ describe('CheckedTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand All @@ -81,8 +81,8 @@ describe('CheckedTravel', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '부산',
image: 'https://example.com/image.jpg',
travelLocation: '부산',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const CheckedTravel = () => {
startAt={travel.startAt}
endAt={travel.endAt}
formattedStartDate={checkTomorrow(travel.startAt)}
bookmarkFlag
bookmarkFlag={travel.bookmarkFlag}
/>
<HorizontalDivider className="mt-5 xl:mt-6" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const PastTravel = () => {
startAt={travel.startAt}
endAt={travel.endAt}
formattedStartDate={checkTomorrow(travel.startAt)}
bookmarkFlag
bookmarkFlag={travel.bookmarkFlag}
closed
/>
<HorizontalDivider className="mt-5 xl:mt-6" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('Upcomming', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down Expand Up @@ -70,8 +70,8 @@ describe('Upcomming', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '서울',
image: 'https://example.com/image.jpg',
travelLocation: '서울',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand All @@ -81,8 +81,8 @@ describe('Upcomming', () => {
maxTravelMateCount: 5,
currentTravelMateCount: 2,
isDomestic: true,
location: '부산',
image: 'https://example.com/image.jpg',
travelLocation: '부산',
travelImage: 'https://example.com/image.jpg',
startAt: '2023-10-01',
endAt: '2023-10-10',
},
Expand Down
11 changes: 6 additions & 5 deletions src/components/mypage/contents/content/myTravel/Upcomming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Pagination from '@/components/common/pagination/Pagination';
import { checkTomorrow } from '@/utils/dateChangeKr';
import { useState } from 'react';
import { useUpcommingTravel } from '@/queries/travel/useGetMyTravel';
import { TravelList } from '@/@types/travel';
import { TravelCard as TravelCardProps } from '@/@types/travel';
import HorizontalDivider from '@/components/common/divider/HorizontalDivider';
import MyTravelCardSkeleton from '@/components/mypage/skeleton/MyTravelCardSkeleton';
import NoTravel from './NoTravel';
Expand All @@ -28,19 +28,20 @@ const Upcomming = () => {
>
{travels && travels.data.total > 0 ? (
<div className="grid w-full gap-5 xl:grid-cols-2 xl:gap-6">
{travels.data.content.map((travel: TravelList) => (
{travels.data.content.map((travel: TravelCardProps) => (
<div key={travel.travelId}>
<TravelCard
key={travel.travelId}
travelId={travel.travelId}
travelImage={travel.travelImage}
isDomestic={travel.isDomestic}
travelName={travel.travelName}
travelLocation={travel.travelLocation}
maxTravelMateCount={travel.maxTravelMateCount}
currentTravelMateCount={travel.currentTravelMateCount}
isDomestic={travel.isDomestic}
location={travel.location}
image={travel.image}
startAt={travel.startAt}
endAt={travel.endAt}
bookmarkFlag={travel.bookmarkFlag}
formattedStartDate={checkTomorrow(travel.startAt)}
/>
<HorizontalDivider className="mt-5 xl:mt-6" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/travel/detail/TravelDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const userInfoMock = {
userId: 1,
email: '[email protected]',
nickname: 'TestUser',
image: null,
profileImage: null,
description: null,
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/travel/detail/TravelDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const TravelDetail = ({ travelDetail }: { travelDetail: Travel }) => {
<TravelButtons
className="hidden xl:block"
travelId={travelDetail.travelId}
organizer={organizer?.id}
organizer={organizer?.userId}
participationFlag={travelDetail.participationFlag}
/>
)}
Expand All @@ -59,7 +59,7 @@ const TravelDetail = ({ travelDetail }: { travelDetail: Travel }) => {
<TravelButtons
className="xl:hidden"
travelId={travelDetail.travelId}
organizer={organizer?.id}
organizer={organizer?.userId}
participationFlag={travelDetail.participationFlag}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/travel/detail/TravelDetailCategory.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const mockTravelPlan = [
tripOrderNumber: 1,
destination: '서울',
description: '서울 탐방',
image: '/test1.png',
travelPlanImage: '/test1.png',
},
{
tripDay: 2,
tripOrderNumber: 1,
destination: '부산',
description: '부산 여행',
image: '/test1.png',
travelPlanImage: '/test1.png',
},
];
const mockStartAt = '2024-12-10';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const mock = {
travelId: 1,
participationFlag: true,
organizer: {
id: 1,
userId: 1,
nickname: '녹차라떼',
role: 'string',
profileImage: '/image.jpg',
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('여행 모임장이 아닐 때', () => {
travelId: 1,
participationFlag: true,
organizer: {
id: 2,
userId: 2,
nickname: '녹차라떼',
role: 'string',
profileImage: '/string.png',
Expand Down
2 changes: 1 addition & 1 deletion src/components/travel/detail/category/TabTravelDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const TabTravelDetail = ({
travelId={travelId}
bookmarkFlag={bookmarkFlag}
userId={user.userId}
organizerId={organizer.id}
organizerId={organizer.userId}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ const mockTravelPlan = [
tripOrderNumber: 1,
destination: '서울',
description: '서울 탐방',
image: '/test1.png',
travelPlanImage: '/test1.png',
},
{
tripDay: 2,
tripOrderNumber: 1,
destination: '부산',
description: '부산 여행',
image: '/test1.png',
travelPlanImage: '/test1.png',
},
{
tripDay: 3,
tripOrderNumber: 1,
destination: '제주도',
description: '제주도 여행',
image: '/test1.png',
travelPlanImage: '/test1.png',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('RecruitmentBox', () => {

describe('RecruitmentBox, 모집 중인 여행일 때', () => {
const mockParticipants = [
{ id: 1, nickname: 'string', role: 'string', profileImage: 'string' },
{ id: 2, nickname: 'string', role: 'string', profileImage: 'string' },
{ userId: 1, nickname: 'string', role: 'string', profileImage: 'string' },
{ userId: 2, nickname: 'string', role: 'string', profileImage: 'string' },
];

beforeEach(() =>
Expand Down
Loading
Loading