Skip to content

(#97) 운동점수 정책UI, 점수획득 축하UI, 점수획득 가능UI 개발 - #106

Merged
ldg-96 merged 7 commits into
developfrom
feature/exercise-celebrate
Jul 30, 2025
Merged

(#97) 운동점수 정책UI, 점수획득 축하UI, 점수획득 가능UI 개발#106
ldg-96 merged 7 commits into
developfrom
feature/exercise-celebrate

Conversation

@ldg-96

@ldg-96 ldg-96 commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

📝작업 내용

  • 운동점수 정책 조회 API 연결
    기존의 useApiGet useApiMutation훅들은 토큰이 있다는걸 전재로 개발되었지만 운동점수 정책조회 및 추후 정책조회 관련 API에는 토큰이 필요하지 않아 usePublicApiGet 훅을 추가하였습니다.

  • 운동점수 획득, 예측조회 API 연결

  • 메인페이지에서 운동점수 클릭 시 운동점수 획득 정책 UI 개발

image
  • 운동점수 기록페이지에서 시작 시간에 따른 점수 획득 가능 여부 표시
image
  • 운동기록 완료시 점수 획득 축하 UI 개발
image

관련 이슈

#97

@ldg-96
ldg-96 requested a review from SimYunSup July 29, 2025 18:48
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>
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion:

  1. warningText 대신 description이 더 일반적이여서 만약 넣고 싶으면 description으로 넣는 것이 좋아보입니다.
  2. 굳이 dateTimePicker에 포함시켜야 하는 이유라도 있을까요? 없다면 밖에 놓는 것이 좋아보입니다. <DateTimePicker/>가 너무 많은 것을 담당하는 것처럼 보여서입니다.

@ldg-96 ldg-96 Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

처음에는 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 ''
})()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question(blocking): IIFE로 구성한 이유가 있을까요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

윤섭님의 말씀을 듣고 즉시실행 함수와 헬퍼함수의 차이점에 대하여 공부해보았습니다.

즉시실행 함수의 핵심 가치는 외부에 영향을 주지 않는 독립적인 실행 환경을 만들기 인것같습니다.

제 코드상황의 경우 즉시실행함수로 하는것보다 헬퍼함수로 만들어서 가독성을 높이고 다른사람이 보았을때 의도전달이 더 명확할 수 있도록 헬퍼 함수로 작성하는것이 더 적합한것같습니다.

  const calculateScoreDescription = (): string => {
    if (!isCreate || !scoreData || !startedDate) {
      return ''
    }
   ...
    if (!scoreData.ValidDate.includes(selectedDateStr)) {
      return '이 날은 이미 점수를 획득했어요'
    }
    return ''
  }

  const scoreDescription = calculateScoreDescription()

위와같이 즉시실행함수에서 헬퍼함수로 바꿧습니다.

@ldg-96
ldg-96 requested a review from SimYunSup July 30, 2025 13:56
@ldg-96 ldg-96 closed this Jul 30, 2025
@ldg-96 ldg-96 reopened this Jul 30, 2025
@ldg-96
ldg-96 merged commit 59b57db into develop Jul 30, 2025
1 check passed
@ldg-96
ldg-96 deleted the feature/exercise-celebrate branch November 30, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants