diff --git a/.vscode/settings.json b/.vscode/settings.json index 79c788d8..7d890c54 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -61,7 +61,7 @@ ] } }, - "cSpell.words": ["crewcrew", "mantine", "tailwindcss", "tanstack"], + "cSpell.words": ["CODEIT", "crewcrew", "mantine", "pretendard", "tailwindcss", "tanstack"], // Prettier를 기본 포맷터로 설정하고 저장 시 자동 포맷팅 "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, diff --git a/next.config.mjs b/next.config.mjs index efd2c845..652ed24d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -17,8 +17,8 @@ const nextConfig = { { key: 'Access-Control-Allow-Origin', value: - process.env.NEXT_PUBLIC_API_BASE_URL || 'https://foggy-sideways-saltasaurus.glitch.me/', - + process.env.NEXT_PUBLIC_API_BASE_URL || + 'https://foggy-sideways-saltasaurus.glitch.me/', }, { key: 'Access-Control-Allow-Methods', value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT' }, { diff --git a/public/assets/images/crew-sample/index.tsx b/public/assets/images/crew-sample/index.tsx index 828102eb..0eac6777 100644 --- a/public/assets/images/crew-sample/index.tsx +++ b/public/assets/images/crew-sample/index.tsx @@ -2,10 +2,6 @@ import ImgCrewSample01 from './crew-sample-1.jpg'; import ImgCrewSample02 from './crew-sample-2.jpg'; import ImgCrewSample03 from './crew-sample-3.jpg'; -const ImgCrewSamples = [ - ImgCrewSample01, - ImgCrewSample02, - ImgCrewSample03, -]; +const ImgCrewSamples = [ImgCrewSample01, ImgCrewSample02, ImgCrewSample03]; -export default ImgCrewSamples; \ No newline at end of file +export default ImgCrewSamples; diff --git a/public/assets/images/gathering-sample/index.tsx b/public/assets/images/gathering-sample/index.tsx index 915a51b4..6bba3587 100644 --- a/public/assets/images/gathering-sample/index.tsx +++ b/public/assets/images/gathering-sample/index.tsx @@ -2,10 +2,6 @@ import ImgGatheringSample01 from './gathering-sample-1.jpg'; import ImgGatheringSample02 from './gathering-sample-2.jpg'; import ImgGatheringSample03 from './gathering-sample-3.jpg'; -const ImgGatheringSamples = [ - ImgGatheringSample01, - ImgGatheringSample02, - ImgGatheringSample03, -]; +const ImgGatheringSamples = [ImgGatheringSample01, ImgGatheringSample02, ImgGatheringSample03]; -export default ImgGatheringSamples; \ No newline at end of file +export default ImgGatheringSamples; diff --git a/src/_apis/crew/get-crew-list.ts b/src/_apis/crew/get-crew-list.ts index ddaf21f3..15b132c7 100644 --- a/src/_apis/crew/get-crew-list.ts +++ b/src/_apis/crew/get-crew-list.ts @@ -1,9 +1,9 @@ import { fetchApi } from '@/src/utils/api'; -import { CrewCardInform, CrewCardInformResponse } from '@/src/types/crew-card'; +import { MainCrewList, MainCrewListResponse } from '@/src/types/crew-card'; -export async function getCrewList(page: number, limit: number): Promise { +export async function getCrewList(page: number, limit: number): Promise { try { - const response = await fetchApi( + const response = await fetchApi( `/crews?_page=${page + 1}&_limit=${limit}`, { method: 'GET', @@ -15,10 +15,10 @@ export async function getCrewList(page: number, limit: number): Promise { const response = await fetchApi('/crewDetail', { diff --git a/src/_apis/detail/get-gathering-list.ts b/src/_apis/detail/get-gathering-list.ts index 2959bfb6..53e1ee3d 100644 --- a/src/_apis/detail/get-gathering-list.ts +++ b/src/_apis/detail/get-gathering-list.ts @@ -1,18 +1,8 @@ import { fetchApi } from '@/src/utils/api'; +import { GatheringType } from '@/src/types/gathering-data'; -export type GatheringList = { - id: number; - title: string; - dateTime: string; - location: string; - currentCount: number; - totalCount: number; - imageUrl: string; - isLiked: boolean; -}; - -export async function getGatheringList(): Promise { - return fetchApi('/gatherings', { +export async function getGatheringList(): Promise { + return fetchApi('/gatherings', { method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/src/_apis/getUser.ts b/src/_apis/getUser.ts deleted file mode 100644 index 49dddbc5..00000000 --- a/src/_apis/getUser.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { fetchApi } from '@/src/utils/api'; - -type User = { - id: number; - name: string; - profile_url: string; -}; - -export function getUsers(): Promise<{ data: User[] }> { - return fetchApi<{ data: User[] }>('http://localhost:3000/api/test-api'); -} diff --git a/src/_queries/crew-queries.tsx b/src/_queries/crew-queries.tsx index 1417c333..f6386fd4 100644 --- a/src/_queries/crew-queries.tsx +++ b/src/_queries/crew-queries.tsx @@ -1,39 +1,20 @@ -import { CrewCardInform } from '@/src/types/crew-card'; +import { MainCrewList } from '@/src/types/crew-card'; import { getCrewList } from '../_apis/crew/get-crew-list'; -// Crew data 변환 로직을 간소화한 helper 함수 -const mapCrewData = (crew: CrewCardInform) => ({ - crewId: crew.crewId, - type: crew.type, - subType: crew.subType, - name: crew.name, - location: crew.location, - detailedLocation: crew.detailedLocation, - participantCount: crew.participantCount, - capacity: crew.capacity, - images: crew.images, - createdBy: crew.createdBy, - createdDate: crew.createdDate, - updatedDate: crew.updatedDate, - isConfirmed: crew.isConfirmed, - gatheringCount: crew.gatheringCount, - crewMember: crew.crewMember, -}); - export function useGetCrewQuery() { interface QueryParams { pageParam?: number; } interface Page { - hasNextPage: boolean; + hasNext: boolean; } return { queryKey: ['crew'], queryFn: ({ pageParam = 0 }: QueryParams) => getCrewList(pageParam, 3), getNextPageParam: (lastPage: Page, allPages: Page[]) => - lastPage.hasNextPage ? allPages.length + 1 : undefined, - select: (data: CrewCardInform[]) => data.map(mapCrewData), + lastPage.hasNext ? allPages.length + 1 : undefined, + select: (data: MainCrewList[]) => data, // 그대로 반환 }; } diff --git a/src/_queries/useGetUserQuery.ts b/src/_queries/useGetUserQuery.ts deleted file mode 100644 index 52fb0023..00000000 --- a/src/_queries/useGetUserQuery.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { getUsers } from '@/src/_apis/getUser'; - -export function transformUserData(data: { - data: { id: number; name: string; profile_url: string }[]; -}) { - return data.data.map((user) => ({ - id: user.id, - name: user.name, - profileUrl: user.profile_url, - })); -} - -export function getUsersQuery() { - return { - queryKey: ['users'], - queryFn: getUsers, - select: transformUserData, - }; -} diff --git a/src/app/(crew)/api-test/page.tsx b/src/app/(crew)/api-test/page.tsx deleted file mode 100644 index eca9ed48..00000000 --- a/src/app/(crew)/api-test/page.tsx +++ /dev/null @@ -1,62 +0,0 @@ -'use client'; - -import Image from 'next/image'; -import { useQuery } from '@tanstack/react-query'; -import { getUsersQuery } from '@/src/_queries/useGetUserQuery'; -import { ApiError } from '@/src/utils/api'; - -// FIX: react-query로 임시로 작성된 코드입니다. 추후 삭제 - -export default function TestPage() { - const { data: users, error, isLoading, isError } = useQuery(getUsersQuery()); - - if (isLoading) { - return
Loading...
; - } - - if (isError && error instanceof ApiError) { - return ( -
- Error {error.status}: {error.message} -
- ); - } - return ( -
-

Users

-
    - {users?.map((user) => ( -
  • -

    {user.name}

    - {`${user.name}'s -
  • - ))} -
-
- ); -} - -// SSR - -// import Image from 'next/image'; -// import { getUsers } from '@/src/_apis/getUser'; -// import { transformUserData } from '@/src/_queries/useGetUserQuery'; - -// export default async function TestPage() { -// const rawData = await getUsers(); -// const users = transformUserData(rawData); - -// return ( -//
-//

Users

-//
    -// {users.map((user) => ( -//
  • -//

    {user.name}

    -// {`${user.name}'s -//
  • -// ))} -//
-//
-// ); -// } diff --git a/src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx b/src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx index f3662666..14d61f83 100644 --- a/src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx +++ b/src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx @@ -64,9 +64,9 @@ ModalWithUser.args = { totalCount: 10, imageUrl: 'https://www.dabur.com/Blogs/Doshas/Importance%20and%20Benefits%20of%20Yoga%201020x450.jpg', - isLiked: false, - isGatherCaptain: false, - isParticipant: false, + liked: false, + gatheringCaptain: false, + participant: false, participants: [ { id: 1, @@ -106,9 +106,9 @@ ModalWithCaptain.args = { totalCount: 10, imageUrl: 'https://www.dabur.com/Blogs/Doshas/Importance%20and%20Benefits%20of%20Yoga%201020x450.jpg', - isLiked: false, - isGatherCaptain: true, - isParticipant: true, + liked: false, + gatheringCaptain: true, + participant: true, participants: [ { id: 1, @@ -148,9 +148,9 @@ ModalWithCrew.args = { totalCount: 10, imageUrl: 'https://www.dabur.com/Blogs/Doshas/Importance%20and%20Benefits%20of%20Yoga%201020x450.jpg', - isLiked: false, - isGatherCaptain: false, - isParticipant: true, + liked: false, + gatheringCaptain: false, + participant: true, participants: [ { id: 1, diff --git a/src/app/(crew)/crew/_components/gathering-detail-modal/presenter.tsx b/src/app/(crew)/crew/_components/gathering-detail-modal/presenter.tsx index 5ed5812d..8039903b 100644 --- a/src/app/(crew)/crew/_components/gathering-detail-modal/presenter.tsx +++ b/src/app/(crew)/crew/_components/gathering-detail-modal/presenter.tsx @@ -120,7 +120,7 @@ export default function GatheringDetailModalPresenter({ > 닫기 - {!data?.isParticipant && ( + {!data?.participant && (