Skip to content

Conversation

sori4606
Copy link
Collaborator

요구사항

기본

  • [x]
  • []
  • []

심화

  • [x]
  • []

주요 변경사항

스크린샷

image

멘토에게

  • media query 는 아직 구현하지 못했습니다.
  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@sori4606 sori4606 changed the title sprint-mission7 [송형진] sprint-mission7 Jan 19, 2025
@sori4606 sori4606 requested a review from devToram January 19, 2025 09:54
@sori4606 sori4606 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Jan 19, 2025
@sori4606 sori4606 changed the title [송형진] sprint-mission7 [송형진] Sprint7 Jan 20, 2025
Copy link
Collaborator

@devToram devToram left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 :)

}

export async function postCommentData({ productId, editContent }) {
const token =
Copy link
Collaborator

Choose a reason for hiding this comment

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

토큰의 경우 github 에 올리시기보다 환경변수로 로컬에서 관리해주셔야해요!
https://velog.io/@milkboy2564/Next.js-env%ED%99%98%EA%B2%BD-%EB%B3%80%EC%88%98-%EC%A0%95%EB%A6%AC

/>
</div>
<ul className={`all-product-list ${mode}`}>
{allItemList.map((item) => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 구조분해 할당해서 가져와도 좋겠네요!

Suggested change
{allItemList.map((item) => (
{allItemList.map(({id, images, name, price}) => (

ownerNickname,
createdAt,
}) {
const [users, setUsers] = useState([]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

user 타입 정의해주시면 좋을 거 같아요!

Comment on lines +48 to +56
const formatDate = (dateString) => {
const date = new Date(dateString);
const year = date.getFullYear();
// getMonth()는 0부터 시작하므로 +1을 해주고, padStart로 2자리 맞추기
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");

return `${year}.${month}.${day}`;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분은 실제 로직과 관련없는 계산부라 util 함수로 빼도 좋을 거 같아요!

Comment on lines +58 to +78
//..시간 전으로 렌더링되게.
function getTimeDifference(createdAt, updatedAt) {
const created = new Date(createdAt);
const updated = new Date(updatedAt);

// 밀리초 단위의 차이를 시간으로 변환
const diffInHours = Math.floor((updated - created) / (1000 * 60 * 60));

if (diffInHours === 0) {
// 1시간 미만인 경우 분 단위로 표시
const diffInMinutes = Math.floor((updated - created) / (1000 * 60));
return `${diffInMinutes}분 전`;
} else if (diffInHours < 24) {
// 24시간 미만인 경우
return `${diffInHours}시간 전`;
} else {
// 24시간 이상인 경우 일 단위로 표시
const diffInDays = Math.floor(diffInHours / 24);
return `${diffInDays}일 전`;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 util 함수인 거 같아요!

@devToram devToram merged commit bf040ef into codeit-bootcamp-frontend:React-송형진 Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants