[송형진] Sprint7#300
Merged
devToram merged 1 commit intocodeit-bootcamp-frontend:React-송형진from Jan 20, 2025
sori4606:React-송형진
Hidden character warning
The head ref may contain hidden characters: "React-\uc1a1\ud615\uc9c4"
Merged
[송형진] Sprint7#300devToram merged 1 commit intocodeit-bootcamp-frontend:React-송형진from sori4606:React-송형진
devToram merged 1 commit intocodeit-bootcamp-frontend:React-송형진from
sori4606:React-송형진
Conversation
devToram
approved these changes
Jan 20, 2025
| } | ||
|
|
||
| export async function postCommentData({ productId, editContent }) { | ||
| const token = |
Collaborator
There was a problem hiding this comment.
토큰의 경우 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
| @@ -58,6 +59,7 @@ function AllProducts() { | |||
| {allItemList.map((item) => ( | |||
Collaborator
There was a problem hiding this comment.
여기서 구조분해 할당해서 가져와도 좋겠네요!
Suggested change
| {allItemList.map((item) => ( | |
| {allItemList.map(({id, images, name, price}) => ( |
| ownerNickname, | ||
| createdAt, | ||
| }) { | ||
| const [users, setUsers] = useState([]); |
Collaborator
There was a problem hiding this comment.
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}`; | ||
| }; |
Collaborator
There was a problem hiding this comment.
이 부분은 실제 로직과 관련없는 계산부라 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}일 전`; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게