Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
{
Expand Down
8 changes: 2 additions & 6 deletions public/assets/images/crew-sample/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
export default ImgCrewSamples;
8 changes: 2 additions & 6 deletions public/assets/images/gathering-sample/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
export default ImgGatheringSamples;
12 changes: 6 additions & 6 deletions src/_apis/crew/get-crew-list.ts
Original file line number Diff line number Diff line change
@@ -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<CrewCardInformResponse> {
export async function getCrewList(page: number, limit: number): Promise<MainCrewListResponse> {
try {
const response = await fetchApi<CrewCardInformResponse>(
const response = await fetchApi<MainCrewListResponse>(
`/crews?_page=${page + 1}&_limit=${limit}`,
{
method: 'GET',
Expand All @@ -15,10 +15,10 @@ export async function getCrewList(page: number, limit: number): Promise<CrewCard
if (!Array.isArray(response)) {
throw new Error('μ„œλ²„ 응닡이 μ˜¬λ°”λ₯Έ ν˜•μ‹μ΄ μ•„λ‹™λ‹ˆλ‹€.');
}
const data = response as CrewCardInform[];
const hasNextPage = data.length === limit;
const data = response as MainCrewList[];
const hasNext = data.length === limit;

return { data, hasNextPage };
return { data, hasNext };
} catch (error) {
throw new Error('크루 리슀트λ₯Ό λΆˆλŸ¬μ˜€λŠ”λ° μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.');
}
Expand Down
22 changes: 1 addition & 21 deletions src/_apis/detail/get-crew-detail.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
import { fetchApi } from '@/src/utils/api';

type CrewMember = {
id: number;
nickname: string;
profileImageUrl?: string;
};

export type CrewDetail = {
id: number;
title: string;
mainLocation: string;
subLocation: string;
participantCount: number;
totalCount: number;
isConfirmed: boolean;
imageUrl: string;
totalGatheringCount: number;
CrewMembers: CrewMember[];
isCaptain: boolean;
isCrew: boolean;
};
import { CrewDetail } from '@/src/types/crew-card';

export async function getCrewDetail(): Promise<{ data: CrewDetail }> {
const response = await fetchApi<CrewDetail[]>('/crewDetail', {
Expand Down
16 changes: 3 additions & 13 deletions src/_apis/detail/get-gathering-list.ts
Original file line number Diff line number Diff line change
@@ -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<GatheringList[]> {
return fetchApi<GatheringList[]>('/gatherings', {
export async function getGatheringList(): Promise<GatheringType[]> {
return fetchApi<GatheringType[]>('/gatherings', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Expand Down
11 changes: 0 additions & 11 deletions src/_apis/getUser.ts

This file was deleted.

27 changes: 4 additions & 23 deletions src/_queries/crew-queries.tsx
Original file line number Diff line number Diff line change
@@ -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, // κ·ΈλŒ€λ‘œ λ°˜ν™˜
};
}
19 changes: 0 additions & 19 deletions src/_queries/useGetUserQuery.ts

This file was deleted.

62 changes: 0 additions & 62 deletions src/app/(crew)/api-test/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function GatheringDetailModalPresenter({
>
λ‹«κΈ°
</Button>
{!data?.isParticipant && (
{!data?.participant && (
<Button
type="button"
onClick={onJoin}
Expand All @@ -129,7 +129,7 @@ export default function GatheringDetailModalPresenter({
μ°Έμ—¬ν•˜κΈ°
</Button>
)}
{data?.isParticipant && !data?.isGatherCaptain && (
{data?.participant && !data?.gatheringCaptain && (
<Button
type="button"
onClick={onExit}
Expand All @@ -138,7 +138,7 @@ export default function GatheringDetailModalPresenter({
νƒˆν‡΄ν•˜κΈ°
</Button>
)}
{data?.isGatherCaptain && (
{data?.gatheringCaptain && (
<Button
type="button"
onClick={onDelete}
Expand Down
3 changes: 2 additions & 1 deletion src/app/(crew)/crew/detail/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export default async function CrewDetailPage() {
<div className="mx-3 my-7 space-y-10 md:mx-7 md:my-11 lg:mx-11 lg:my-16">
<section className="w-full">
<article>
<DetailCrewCard {...crewDetail} />
{/* //TODO: μΆ”ν›„ confirmedλΆ€λΆ„ μˆ˜μ • */}
<DetailCrewCard isConfirmed={false} {...crewDetail} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codebase verification

⚠️ Potential issue

Let me analyze the results from the shell scripts to verify the concern about the hardcoded isConfirmed value.

The results show:

  1. isConfirmed is defined as a required boolean prop in DetailCrewCardProps interface
  2. Mock data in mock.json and crew-data.ts shows both true and false values being used
  3. The component is used in stories with both true and false values
  4. In crew-card-list.tsx, isConfirmed is dynamically passed based on conditions
  5. The file in question ([id]/page.tsx) hardcodes it to false

I can now generate the final response:

crewDetail λ°μ΄ν„°μ—μ„œ isConfirmed 값을 μ‚¬μš©ν•΄μ•Ό ν•©λ‹ˆλ‹€

ν˜„μž¬ ν•˜λ“œμ½”λ”©λœ false κ°’ λŒ€μ‹  crewDetailμ—μ„œ μ œκ³΅λ˜λŠ” μ‹€μ œ isConfirmed 값을 μ‚¬μš©ν•΄μ•Ό ν•©λ‹ˆλ‹€. μ½”λ“œλ² μ΄μŠ€ 뢄석 κ²°κ³Ό:

  • DetailCrewCardλŠ” μ‹€μ œ 확인 μƒνƒœλ₯Ό ν‘œμ‹œν•˜λŠ” μ»΄ν¬λ„ŒνŠΈμž…λ‹ˆλ‹€
  • λ‹€λ₯Έ μ»΄ν¬λ„ŒνŠΈλ“€μ€ λ™μ μœΌλ‘œ isConfirmed 값을 μ „λ‹¬ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€
  • λ°±μ—”λ“œ API 응닡(mock.json)도 이 ν•„λ“œλ₯Ό ν¬ν•¨ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€

μˆ˜μ • μ œμ•ˆ:

<DetailCrewCard {...crewDetail} />
πŸ”— Analysis chain

ν•˜λ“œμ½”λ”©λœ isConfirmed κ°’μ˜ 검증이 ν•„μš”ν•©λ‹ˆλ‹€.

isConfirmedκ°€ false둜 ν•˜λ“œμ½”λ”©λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μž„μ‹œ ν•΄κ²°μ±…μœΌλ‘œ 보이며, λ‹€μŒ 사항듀을 ν™•μΈν•΄μ£Όμ‹œκΈ° λ°”λžλ‹ˆλ‹€:

  1. μ‹€μ œ 확인 μƒνƒœλ₯Ό λ°˜μ˜ν•˜λŠ” 동적 κ°’μœΌλ‘œ λŒ€μ²΄λ˜μ–΄μ•Ό ν•˜λŠ”μ§€
  2. λ°±μ—”λ“œ API의 응닡 νƒ€μž…κ³Ό μΌμΉ˜ν•˜λŠ”μ§€
  3. λ‹€λ₯Έ μ»΄ν¬λ„ŒνŠΈμ—μ„œμ˜ μ‚¬μš© 사둀와 일관성이 μžˆλŠ”μ§€
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: isConfirmed ν”„λ‘œνΌν‹°μ˜ μ‚¬μš© νŒ¨ν„΄μ„ κ²€μ¦ν•©λ‹ˆλ‹€.

# DetailCrewCard μ»΄ν¬λ„ŒνŠΈμ—μ„œ isConfirmed ν”„λ‘œνΌν‹°μ˜ μ‚¬μš©μ„ 확인
echo "DetailCrewCard μ»΄ν¬λ„ŒνŠΈμ—μ„œ isConfirmed ν”„λ‘œνΌν‹° μ •μ˜ 확인:"
ast-grep --pattern 'interface DetailCrewCardProps {
  $$$
  isConfirmed$_
  $$$
}'

# isConfirmed ν”„λ‘œνΌν‹°κ°€ λ‹€λ₯Έ κ³³μ—μ„œλ„ μ‚¬μš©λ˜λŠ”μ§€ 확인
echo "\nisConfirmed ν”„λ‘œνΌν‹°μ˜ λ‹€λ₯Έ μ‚¬μš© 사둀 확인:"
rg "isConfirmed" -A 2

Length of output: 5904

</article>
</section>
<section className="w-full space-y-6">
Expand Down
13 changes: 7 additions & 6 deletions src/app/(crew)/my-crew/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { useState } from 'react';
import { useGetCrewQuery } from '@/src/_queries/crew-queries';
import { useInfiniteScroll } from '@/src/hooks/useInfiniteScroll';
import { useInfiniteScroll } from '@/src/hooks/use-infinite-scroll';
import CrewCardList from '@/src/components/common/crew-list/crew-card-list';
import Tabs from '@/src/components/common/tab';
import { CrewCardInformResponse } from '@/src/types/crew-card';
import { MyCrewListResponse } from '@/src/types/crew-card';

export default function MyCrewPage() {
const myPageTabs = [
Expand All @@ -15,8 +15,9 @@ export default function MyCrewPage() {
const [currentTab, setCurrentTab] = useState(myPageTabs[0].id);

// TODO: fetchCrewData ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ 데이터λ₯Ό 뢈러였기 : νŒŒλΌλ―Έν„° μˆ˜μ • ν•„μš”
const { data, ref, isFetchingNextPage } =
useInfiniteScroll<CrewCardInformResponse>(useGetCrewQuery());
// TODO: λ¦¬μŠ€νŠΈμ™€λŠ” λ‹€λ₯Έ 데이터λ₯Ό μ‚¬μš©ν•΄μ•Όν•΄μ„œ μš°μ„  μ£Όμ„μ²˜λ¦¬ ν–ˆμŠ΅λ‹ˆλ‹€.
// const { data, ref, isFetchingNextPage } =
// useInfiniteScroll<MyCrewListResponse>(useGetCrewQuery());

return (
<div className="py-8 md:py-12.5">
Expand All @@ -31,12 +32,12 @@ export default function MyCrewPage() {
/>
</div>
<div className="mt-8 px-3 md:px-8 lg:px-11.5">
<CrewCardList
{/* <CrewCardList
inWhere="my-crew"
data={data}
ref={ref}
isFetchingNextPage={isFetchingNextPage}
/>
/> */}
Comment on lines +35 to +40
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

주석 처리된 μ½”λ“œμ˜ ν–₯ν›„ κ³„νš λͺ…μ‹œ ν•„μš”

CrewCardList μ»΄ν¬λ„ŒνŠΈκ°€ 주석 μ²˜λ¦¬λ˜μ–΄ μžˆμ–΄ ν˜„μž¬ νŽ˜μ΄μ§€μ—μ„œ 크루 λͺ©λ‘μ΄ ν‘œμ‹œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μ΄λŠ” μ‚¬μš©μž κ²½ν—˜μ— μ€‘λŒ€ν•œ 영ν–₯을 λ―ΈμΉ  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ 사항듀을 ν™•μΈν•΄μ£Όμ„Έμš”:

  1. μž„μ‹œ UIλ‚˜ λŒ€μ²΄ μ»΄ν¬λ„ŒνŠΈ κ΅¬ν˜„ κ³„νš
  2. μƒˆλ‘œμš΄ 데이터 ꡬ쑰에 λ§žλŠ” μ»΄ν¬λ„ŒνŠΈ μ—…λ°μ΄νŠΈ 일정
  3. μ‚¬μš©μžμ—κ²Œ 보여쀄 λ‘œλ”© μƒνƒœλ‚˜ μž„μ‹œ λ©”μ‹œμ§€

</div>
</div>
);
Expand Down
Loading