(#97) 운동점수 정책UI, 점수획득 축하UI, 점수획득 가능UI 개발 - #106
Merged
Merged
Conversation
…ature/exercise-celebrate
…ature/exercise-celebrate
SimYunSup
suggested changes
Jul 30, 2025
Comment on lines
+154
to
+169
|
|
||
| {warningText && ( | ||
| <div className={styles['score-warning']}> | ||
| <WarningIcon className={styles['warning-icon']} /> | ||
| <Typography | ||
| as="span" | ||
| variant="text12" | ||
| className={styles['warning-text']} | ||
| > | ||
| {warningText} | ||
| </Typography> | ||
| </div> | ||
| )} |
There was a problem hiding this comment.
suggestion:
- warningText 대신 description이 더 일반적이여서 만약 넣고 싶으면 description으로 넣는 것이 좋아보입니다.
- 굳이 dateTimePicker에 포함시켜야 하는 이유라도 있을까요? 없다면 밖에 놓는 것이 좋아보입니다.
<DateTimePicker/>가 너무 많은 것을 담당하는 것처럼 보여서입니다.
Contributor
Author
There was a problem hiding this comment.
처음에는 description부분을 exerciseFrom에 추가하였지만 각 필드마다 marginbottom이 들어가있어 description을 필드아래 붙이는대 방해가되어 description을 DateTimePicker안으로 넣게되는 잘못된 판단을 하게된것 같습니다.
윤섭님의 말씀대로 밖으로 빼내고 css를 조정하였습니다!
Comment on lines
+138
to
+163
| const scoreWarningMessage = ((): string => { | ||
| if (!isCreate || !scoreData || !startedDate) { | ||
| return '' | ||
| } | ||
|
|
||
| const selectedDate = new Date(startedDate) | ||
|
|
||
| // 점수가 최대치인 경우 | ||
| if (scoreData.currentScore >= scoreData.maxScore) { | ||
| return '점수가 최대치에 도달했어요!' | ||
| } | ||
|
|
||
| // 획득 가능 기간보다 이전 날짜를 선택한 경우 | ||
| const validWindowStart = new Date(scoreData.validPeriod.startedAt) | ||
| if (selectedDate < validWindowStart) { | ||
| return '점수를 획득할 수 있는 기간이 지났어요' | ||
| } | ||
|
|
||
| // 획득 가능 기간 내이지만, 이미 점수를 받은 날인 경우 | ||
| const selectedDateStr = format(selectedDate, 'yyyy-MM-dd') | ||
| if (!scoreData.ValidDate.includes(selectedDateStr)) { | ||
| return '이 날은 이미 점수를 획득했어요' | ||
| } | ||
|
|
||
| return '' | ||
| })() |
There was a problem hiding this comment.
question(blocking): IIFE로 구성한 이유가 있을까요?
Contributor
Author
There was a problem hiding this comment.
윤섭님의 말씀을 듣고 즉시실행 함수와 헬퍼함수의 차이점에 대하여 공부해보았습니다.
즉시실행 함수의 핵심 가치는 외부에 영향을 주지 않는 독립적인 실행 환경을 만들기 인것같습니다.
제 코드상황의 경우 즉시실행함수로 하는것보다 헬퍼함수로 만들어서 가독성을 높이고 다른사람이 보았을때 의도전달이 더 명확할 수 있도록 헬퍼 함수로 작성하는것이 더 적합한것같습니다.
const calculateScoreDescription = (): string => {
if (!isCreate || !scoreData || !startedDate) {
return ''
}
...
if (!scoreData.ValidDate.includes(selectedDateStr)) {
return '이 날은 이미 점수를 획득했어요'
}
return ''
}
const scoreDescription = calculateScoreDescription()
위와같이 즉시실행함수에서 헬퍼함수로 바꿧습니다.
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.
📝작업 내용
운동점수 정책 조회 API 연결
기존의
useApiGetuseApiMutation훅들은 토큰이 있다는걸 전재로 개발되었지만 운동점수 정책조회 및 추후 정책조회 관련 API에는 토큰이 필요하지 않아usePublicApiGet훅을 추가하였습니다.운동점수 획득, 예측조회 API 연결
메인페이지에서 운동점수 클릭 시 운동점수 획득 정책 UI 개발
관련 이슈
#97