-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#110 fix : 헤더 진행률 & 알람 종류 추가 #111
Conversation
<S.GraphProgress blockProgress={progress.toFixed(1)}></S.GraphProgress> | ||
</S.GraphWrapper> | ||
<span>{blockProgress}%</span> | ||
<span>{progress.toFixed(1)}%</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터로 1은 왜 전달하는지 궁금합니다!~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 저게 소수점 밑에 1자리 수로 나오게 하려고 전달한거에요~
//시작점 상태에서 종착지가 시작점 상태와는 다른 상태일때 그 아이템 개수 -1 | ||
if (source.droppableId === 'todo' && destination.droppableId !== 'todo') | ||
setBlockTotal(prev => ({ | ||
...prev, | ||
todo: blockTotal.todo - 1, | ||
[destination.droppableId]: | ||
blockTotal[destination.droppableId as keyof typeof blockTotal] + 1, | ||
})); | ||
else if (source.droppableId === 'doing' && destination.droppableId !== 'doing') | ||
setBlockTotal(prev => ({ | ||
...prev, | ||
doing: blockTotal.doing - 1, | ||
[destination.droppableId]: | ||
blockTotal[destination.droppableId as keyof typeof blockTotal] + 1, | ||
})); | ||
else if (source.droppableId === 'completed' && destination.droppableId !== 'completed') | ||
setBlockTotal(prev => ({ | ||
...prev, | ||
completed: blockTotal.completed - 1, | ||
[destination.droppableId]: | ||
blockTotal[destination.droppableId as keyof typeof blockTotal] + 1, | ||
})); | ||
else if (source.droppableId === 'delete' && destination.droppableId !== 'delete') | ||
setBlockTotal(prev => ({ | ||
...prev, | ||
delete: blockTotal.completed - 1, | ||
[destination.droppableId]: | ||
blockTotal[destination.droppableId as keyof typeof blockTotal] + 1, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function updateBlockTotal(sourceId: string, destinationId: string) {
if (sourceId !== destinationId) {
setBlockTotal(prev => ({
...prev,
[sourceId]: blockTotal[sourceId as keyof typeof blockTotal] - 1,
[destinationId]: blockTotal[destinationId as keyof typeof blockTotal] + 1,
}));
}
}
// 호출 부분
updateBlockTotal(source.droppableId, destination.droppableId);
위와 같이 중복되는 부분을 함수로 분리하면 더 간결하게 작성할 수 있을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
조언 감사합니다!
추후에 수정할게요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다~~👍🏻👍🏻
🪄 목적
💻 상세 작업 내용
📸 스크린샷
👼🏻 리뷰 요구사항 (선택)