Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
72b26de
design: asset 추가
pepperdad Nov 23, 2023
1ceafaa
feat: keyword 필터 추가
pepperdad Nov 23, 2023
6d58287
feat: 카드 UI 추가
pepperdad Nov 23, 2023
e24398e
feat: 태그, 정렬 컴포넌트 추가
pepperdad Nov 24, 2023
68dbaf9
feat: 카드 데이터 동적으로 불러오기
pepperdad Nov 24, 2023
0619ed8
feat: msw로 카드 데이터 불러오기
pepperdad Nov 24, 2023
d38cc30
feat: findSchedule handler 추가
pepperdad Nov 24, 2023
7e4172e
fix: 헤더 라우팅, z-index 수정
pepperdad Nov 24, 2023
9d20423
feat: 카드 UI shadow, padding 수정
pepperdad Nov 25, 2023
ce063e0
design: asset 추가
pepperdad Dec 6, 2023
f395356
fix: 경로 추가
pepperdad Dec 7, 2023
d05ee8f
feat: 상세 페이지 mock API, data 추가 및 mock server 추가
pepperdad Dec 7, 2023
9a46f3a
design: asset 추가
pepperdad Dec 7, 2023
a588386
feat: 상세 페이지 SSG로 불러옴
pepperdad Dec 7, 2023
8c539ae
refactor: ScheduleContent 컴포넌트 props spread
pepperdad Dec 7, 2023
563a374
feat: 카드 클릭시, 상세 페이지로 라우팅
pepperdad Dec 7, 2023
d52be9e
feat: 게시글 상세 정보 컴포넌트 추가
pepperdad Dec 7, 2023
b796842
feat: 화면 우측 따라다니는 HostInfo 컴포넌트 추가
pepperdad Dec 7, 2023
0fc32ce
feat: 이미지, 제목 컴포넌트 추가
pepperdad Dec 7, 2023
ae03185
feat: 일시, 위치 컴포넌트 추가
pepperdad Dec 7, 2023
ff65960
feat: 참여인원, 참여자 정보 컴포넌트 추가
pepperdad Dec 7, 2023
c1a42c7
feat: DetailIntroduce 컴포넌트 추가
pepperdad Dec 7, 2023
7001613
feat: 댓글 관련 컴포넌트 추가
pepperdad Dec 7, 2023
288d340
feat: 비밀 댓글 관련 로직 추가
pepperdad Dec 7, 2023
cdad9a4
fix: 댓글 갯수 계산 함수 util로 이동
pepperdad Dec 7, 2023
60cd9b3
fix: daysUntil 함수 util로 이동
pepperdad Dec 7, 2023
061fb1a
design: asset 추가
pepperdad Dec 7, 2023
a847fb2
fix: pre 태그 width 넘어가면 줄바꿈 되도록 style 추가
pepperdad Dec 7, 2023
4cd8eac
fix: mock data 수정
pepperdad Dec 7, 2023
b8980cb
feat: HostInfo 컴포넌트 추가
pepperdad Dec 7, 2023
ce11a83
fix: prop name 수정
pepperdad Dec 7, 2023
c0cf741
feat: 기본 댓글창 추가
pepperdad Dec 8, 2023
925adbb
feat: comment type별 UI 구분 추가
pepperdad Dec 8, 2023
c1e78e9
feat: 우측 Info에서 일정 참여, 신청완료, 대기 중 로직 추가
pepperdad Dec 8, 2023
2499665
feat: 우측 플로팅 메뉴 사용자에 따른 UI 구분 추가
pepperdad Dec 8, 2023
ab3fcf8
feat: (#44) PR comment 반영
pepperdad Dec 8, 2023
df223ac
Merge branch 'develop' of https://github.com/Project-Catcher/catcher-…
pepperdad Dec 8, 2023
d593a41
fix: pull develop
pepperdad Dec 8, 2023
781fbcf
feat: (#51) PR comment 반영
pepperdad Dec 10, 2023
fc13413
feat: SSG로 받아오던 로직 SSR로 수정
pepperdad Dec 17, 2023
839e2b5
feat: 댓글 state 변경 시, 반영 되도록 onFetchComments 함수 추가
pepperdad Dec 17, 2023
98d62f4
feat: PR comment 반영, 지역 state 추가
pepperdad Dec 17, 2023
eb3be13
feat: mockAPI Url 변경
pepperdad Dec 18, 2023
17b8db5
refactor: 데이터 fetching API 폴더의 함수로 분리
pepperdad Dec 18, 2023
b53e7cd
feat: 일정찾기 페이지 state 변경 최소화하도록 로직 수정, 필터 적용 버튼 추가
pepperdad Dec 18, 2023
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
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ NEXT_PUBLIC_REST_API_KEY_NAVER = API_KEY_HERE
NEXT_PUBLIC_CLIENT_SECRET_NAVER = API_KEY_HERE
NEXT_PUBLIC_REDIRECT_URI_NAVER = API_KEY_HERE
NEXT_PUBLIC_IMAGE_API_KEY=API_KEY_HERE
NEXT_PUBLIC_NODE_ENV = API_KEY_HERE
NEXT_PUBLIC_MOCK = API_KEY_HERE
NEXT_PUBLIC_BASE_URL = API_KEY_HERE

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

주어진 코드 패치에 대해 간단한 코드 리뷰를 도와드리겠습니다. 버그 위험과/또는 개선 제안을 언급하겠습니다.

  1. @@ -4,3 +4,6 행: 이 부분은 diff 형식으로 변경 사항을 보여줍니다. 코드 자체의 문제는 없습니다.

  2. NEXT_PUBLIC_NODE_ENV, NEXT_PUBLIC_MOCK, NEXT_PUBLIC_BASE_URL 변수: 이 세 가지 변수에는 API 키 대신 API 키를 설정할 문자열이 포함되어 있습니다. 변수 이름에서 예상되는 것보다 정작 API 키를 저장하는 용도로 사용하실 거 같지 않으며, 이름과 목적을 일치시켜 주셔야 합니다.

개선 제안:

  • 적절한 변수 이름을 사용하십시오. 예를 들어, "NEXT_PUBLIC_API_KEY_NAVER"는 네이버 API 키를 저장하는 데 더 나은 변수 이름입니다.
  • 실제 API 키 값을 사용해야 합니다. "API_KEY_HERE"로 표시된 값을 실제 API 키 값으로 대체하여 사용하십시오.

코드 패치에는 실제 코드가 포함되어 있지 않기 때문에 코드 자체에 대한 전체적인 검토는 제공하기 어렵습니다. 그러나 제공된 정보만으로는 코드 내에 오류나 개선 가능한 부분에 대해 자세히 언급할 수 없습니다. 코드의 실제 내용을 공유해주시면 더 자세하게 도움을 드릴 수 있습니다.

34 changes: 34 additions & 0 deletions pages/api/findSchedule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { CardType } from "@findSchedule/components/Card";
import axios from "axios";

interface scheduleListParams {
theme: string;
dateStart: string;
dateEnd: string;
expense?: number;
location: string;
personnel?: number;
keywordOption?: number;
keyword?: string;
}

export const findSchedule = async (params?: scheduleListParams) => {
try {
const res = await axios.get<CardType[]>(
`${process.env.NEXT_PUBLIC_BASE_URL}/schedule/list`,
{
params,
},
);

if (res.status === 200) {
console.log("res.data", res.data);
return res.data;
} else {
return [];
}
} catch (error) {
console.error("API 호출 중 오류 발생:", error);
throw error; // 오류를 호출자에게 전달
}
};
72 changes: 72 additions & 0 deletions pages/detail/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { CommentWithReComments } from "@detail/CommentBox";
import Detail from "@detail/Detail";
import { hostInfo } from "@detail/HostInfo";
import { participateInfoType } from "@detail/ParticipationStatus";
import axios from "axios";
import { GetServerSideProps } from "next";
import React from "react";

export interface DetailCard {
id: number;
hostInfo: hostInfo;
img: string;
theme: string;
title: string;
content: string;
location: string;
dateStart: string;
dateEnd: string;
expense: number;
tags: string[];
like: number;
likeStatus: boolean;
comment: number;
scrap: number;
isParticipate: number; // 0: 미신청, 1: 신청완료 (대기중), 2: 참여
scrapStatus: boolean;
recruitStart: string;
recruitEnd: string;
applicantNum: number;
participateNum: number;
participateCapacity: number;
participateInfos: participateInfoType[];
createdAt: string;
comments: CommentWithReComments[];
}

interface DetailProps {
detailData: DetailCard;
}

const detail = ({ detailData }: DetailProps) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Lv2] 가급적이면 컴포넌트명은 대문자로 시작하는게 좋습니다!

return (
<div className="flex justify-center mt-[78px]">
<Detail detailData={detailData}></Detail>
</div>
);
};

export default detail;

export const getServerSideProps: GetServerSideProps = async (context) => {
const { id } = context.params || {};

try {
const response = await axios.get(
`${process.env.NEXT_PUBLIC_BASE_URL}/getCardDetail`,
{ params: { id } },
);

const detailData = response.data;
console.log("datas", detailData);

return {
props: { detailData },
};
} catch (error) {
console.error("Error fetching data", error);
return {
props: { data: "" },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
props: { data: "" },
notFound: true

[Lv3] api 통신중 에러가 발생했다면 (데이터가 없거나) 여기서는 notFound 페이지를 띄워주는게 맞습니다!
404, 500 페이지는 따로 만들수있기때문에 우선 이렇게 해두는게 나을것같아요~

};
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

주어진 코드 패치는 다음과 같은 리뷰를 제공하고 있습니다. 수정 제안 및 버그 위험 사항 등을 포함합니다:

  1. import 문의 경로: @detail/CommentBox, @detail/Detail, @detail/HostInfo, @detail/ParticipationStatus 등이 상대 경로가 아닌 절대 경로로 import되고 있습니다. 경로 문제가 있는지 확인해야 합니다.

  2. isParticipate 프로퍼티의 값은 number 타입으로 선언되어 있지만, 주석에 나와있듯이 0, 1, 2 외의 다른 값이 들어갈 수도 있습니다. 이를 열거형(enum)으로 정의하여 잘못된 값을 방지할 수 있습니다.

  3. getStaticPaths 함수 내에서 경로를 하드코딩하여 정적 경로를 배열로 지정하는데, 현재는 단 하나의 경로만 포함되어 있습니다. 동적 경로 목록을 자동으로 생성하거나 변경 가능한 부분으로 개선할 수 있을 것입니다.

  4. getStaticProps 함수 내에서 axios를 사용하여 데이터를 가져오고 있습니다. 현재는 성공 및 실패 시 모두 비슷한 방식으로 처리하고 있지만, 에러 발생 시 빈 문자열("")을 반환하고 있으므로 실제 예외 처리에 대해 고려해야 합니다. 반환된 데이터를 명시적으로 체크하는 것도 유용할 수 있습니다.

  5. console.log를 사용하여 detailData를 확인하고 있습니다. 프로덕션 환경에서는 콘솔 로그를 제거하거나 개선된 로깅 방식을 사용하는 것이 좋습니다.

  6. 코드의 가독성과 일관성을 위해 변수 및 함수명에 일관된 스타일을 적용하는 것이 좋습니다. detail 컴포넌트 함수의 이름을 대문자로 시작하는 Detail로 변경하는 것을 고려해 볼 수 있습니다.

  7. 마지막으로, 상태 관리나 코드 구조와 관련된 부분은 주어진 코드 범위에서 파악하기 어렵기 때문에 추가 리뷰가 필요합니다.

이러한 리뷰는 코드 패치의 특정 부분에 대해서만 내용을 포함하고 있습니다. 전체 애플리케이션 또는 프로젝트에 대한 세부 내용이 제공되면 더 정확하고 철저한 리뷰를 제공할 수 있습니다.

30 changes: 28 additions & 2 deletions pages/find-schedule/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
import { CardType } from "@findSchedule/components/Card";
import Page from "findSchedule/components/Page";
import { GetServerSideProps } from "next";
import React from "react";
import { findSchedule } from "@pages/api/findSchedule";

const index = () => {
interface FindPageProps {
defaultCardList: CardType[];
}

const index = ({ defaultCardList }: FindPageProps) => {
return (
<div className="flex justify-center mt-[78px]">
<Page />
<Page defaultCardList={defaultCardList} />
</div>
);
};

export default index;

export const getServerSideProps: GetServerSideProps = async () => {
try {
const res = await findSchedule();

return {
props: {
defaultCardList: res,
},
};
} catch (error) {
console.error("Error fetching data1", error);
return {
props: {
defaultCardList: [],
},
};
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 코드 패치의 주요 변경 사항은 다음과 같습니다:

  1. CardType을 import하고 있으며, 이는 "@findSchedule/components/Card"에서 가져온 것으로 추정됩니다.
  2. axios를 import하고 있으며, API 호출을 위해 사용될 가능성이 높습니다.
  3. GetServerSideProps를 import하고 있으며, 이것은 Next.js에서 서버 측 데이터 가져오기를 위해 사용됩니다.
  4. index 함수에 FindPageProps 인터페이스를 추가했습니다. 이 인터페이스는 defaultCardList라는 CardType 배열을 포함하는 것으로 보입니다.
  5. getServerSideProps 함수는 서버 측에서 데이터를 가져오기 위해 axios를 사용합니다. 해당 데이터는 defaultCardList로 반환됩니다. 에러 발생 시 빈 배열이 반환됩니다.

이 코드 패치에서 특별한 버그나 큰 위험 요소는 보이지 않습니다. 하지만 몇 가지 개선 제안은 있습니다:

  1. 에러 처리: 현재 코드에서 에러가 발생하면 콘솔에 오류 메시지만 출력되고, 클라이언트에게는 어떤 문제가 발생했는지 알려주지 않습니다. 에러 처리 로직을 개선하여 적절한 에러 처리와 함께 사용자에게 알림을 제공하는 것이 좋습니다.
  2. 타입 안정성 강화: API 응답에서 가져온 데이터에 대해 추가적인 유효성 검사 및 타입 체크를 수행하는 것이 좋습니다. 이렇게 함으로써 프로그램의 안정성을 향상시킬 수 있습니다.
  3. Next.js 환경 변수 사용: process.env.NEXT_PUBLIC_BASE_URL를 사용하고 있는데, 해당 환경 변수가 올바르게 설정되어 있는지 확인하세요. 필요한 경우 .env 파일을 사용하여 환경 변수 값을 정의할 수 있습니다.

추가적인 정보나 팁이 필요한 경우 말씀해주세요!

10 changes: 10 additions & 0 deletions public/assets/detail/bell.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/bookmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/bookmark_pink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/detail/checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/comment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/comment_green.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/assets/detail/comment_toggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions public/assets/detail/default_profile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/heart_pink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/detail/list.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading