Skip to content

Comments

Feat(client): remind card remaining timer 기능 추가#160

Merged
constantly-dev merged 1 commit intodevelopfrom
feat/#159/remind-card-timer
Sep 29, 2025
Merged

Feat(client): remind card remaining timer 기능 추가#160
constantly-dev merged 1 commit intodevelopfrom
feat/#159/remind-card-timer

Conversation

@constantly-dev
Copy link
Member

@constantly-dev constantly-dev commented Sep 28, 2025

📌 Related Issues

관련된 Issue를 태그해주세요. (e.g. - close #25)

📄 Tasks

  • remind card remaining timer 기능 추가

⭐ PR Point (To Reviewer)

📷 Screenshot

Summary by CodeRabbit

  • 새 기능
    • RemindCard에 실시간 타이머가 추가되었습니다. 남은 시간이 “X시간 Y분” 형식으로 표시되며 1분마다 자동 업데이트됩니다. 만료 시에는 “시간 만료”로 안내합니다.
    • 기존의 정적/플레이스홀더 시간 표기 대신 동적으로 계산된 남은 시간을 표시하여 알림 카드의 가독성과 신뢰성을 향상했습니다.

@vercel
Copy link

vercel bot commented Sep 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
pinback-client-client Ready Ready Preview Comment Sep 28, 2025 6:14am
pinback-client-landing Ready Ready Preview Comment Sep 28, 2025 6:14am

@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Walkthrough

RemindCard 컴포넌트에 로컬 타이머 표시 로직이 추가되었습니다. timeRemaining을 기준으로 만료 시각을 계산하고, 매 분 상태를 업데이트하여 “XX시간 XX분” 또는 “시간 만료”를 렌더링합니다. useEffect로 인터벌을 설정/해제하며, UI는 기존 아이콘과 레이아웃을 유지합니다.

Changes

Cohort / File(s) Summary
RemindCard 타이머 표시 로직 추가
packages/design-system/src/components/card/RemindCard.tsx
useState/useEffect 도입, timeRemaining을 만료 기준으로 계산하여 매 분 displayTime 업데이트. 만료 시 “시간 만료” 표시, 그렇지 않으면 “시간 분” 형식으로 표시. 인터벌 클린업 추가.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant RC as RemindCard
    participant T as Timer (setInterval)

    U->>RC: 컴포넌트 마운트 (timeRemaining 전달)
    RC->>RC: endTime 계산 (timeRemaining + 24h)
    RC->>T: setInterval(매 분)
    T-->>RC: 현재 시간 기준 남은시간 계산
    alt 남은시간 > 0
        RC->>RC: displayTime = "H시간 M분"
    else 만료
        RC->>RC: displayTime = "시간 만료"
    end
    RC-->>U: displayTime 렌더링
    U->>RC: 언마운트/prop 변경
    RC->>T: clearInterval
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

feat

Suggested reviewers

  • jllee000
  • jjangminii

Poem

토끼 시계 똑딱, 분침이 춤을 춰요 ⏱️
남은 시간 한 입, 달빛처럼 줄어요.
“시간 만료!” 속삭이면, 귀가 쫑긋 서고—
아직이라면, “두 시간 십오 분!” 폴짝 외치죠.
카드 속 시간도, 오늘은 나와 뛰네요. 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning PR은 이슈 #159의 타이머 기능 추가 요구사항을 충족하지만, 연결된 이슈 #25에 명시된 프로그레스 바 구현 작업이 포함되지 않아 모든 이슈의 요구사항을 완전하게 이행하지 못했습니다. 이슈 #25에 따른 프로그레스 바 기능을 구현하거나 해당 이슈의 연결을 제거하여 요구사항을 일치시켜야 합니다.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed 제목은 주요 변경 사항인 RemindCard의 남은 시간 타이머 기능 추가를 명확하게 반영하고 있어 PR의 핵심을 잘 요약하고 있습니다.
Out of Scope Changes Check ✅ Passed PR의 변경 내용은 remind card timer 기능 추가에 한정되어 있어 이슈 #159의 범위 내에 있으며 불필요한 코드 변경은 발견되지 않습니다.
Description Check ✅ Passed PR 설명은 관련 이슈(close #159)와 작업 내용이 Tasks 섹션에 명확히 서술되어 있어 주요 변경 사항이 잘 전달되며 필수 항목이 충실하게 작성되었습니다.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#159/remind-card-timer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

✅ Storybook chromatic 배포 확인:
🐿️ storybook

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae83b9a and a93091f.

📒 Files selected for processing (1)
  • packages/design-system/src/components/card/RemindCard.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: constantly-dev
PR: Pinback-Team/pinback-client#2
File: pnpm-workspace.yaml:3-3
Timestamp: 2025-08-18T13:48:59.065Z
Learning: constantly-dev는 docs 디렉터리를 컨벤션 문서 추가용으로 사용할 예정이라고 명시했습니다.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: storybook

Comment on lines +31 to +53
const endTime = new Date(timeRemaining).getTime() + 24 * 60 * 60 * 1000;

const updateRemainingTime = () => {
const now = new Date().getTime();
const remainingMilliseconds = endTime - now;

if (remainingMilliseconds <= 0) {
setDisplayTime('시간 만료');
} else {
const totalMinutes = Math.floor(remainingMilliseconds / (1000 * 60));
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
setDisplayTime(`${hours}시간 ${minutes}분`);
}
};

const intervalId = setInterval(updateRemainingTime, 60000);

updateRemainingTime();

return () => {
clearInterval(intervalId);
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

날짜 파싱 실패 시 남은 시간이 NaN시간 NaN분으로 깨집니다.

이번 변경은 timeRemaining을 ISO 날짜 문자열이라고 가정하고 new Date(timeRemaining)로 파싱한 뒤 24시간을 더하고 있습니다. 하지만 이 필드가 빈 문자열이거나 기존처럼 "3시간 20분" 같은 표현식 문자열로 넘어오면 Date.parse 결과가 NaN이 되어 UI에 NaN시간 NaN분이 노출됩니다. 실제 백엔드 응답 포맷이 날짜가 아닐 경우 프로덕션에서 바로 재현되는 치명적인 기능 오류입니다. 최소한 파싱 실패 시 기존 문자열을 그대로 보여주는 방어 로직이 필요합니다. 아래와 같이 가드를 추가해 주세요.

-    const endTime = new Date(timeRemaining).getTime() + 24 * 60 * 60 * 1000;
+    const parsed = Date.parse(timeRemaining);
+    if (Number.isNaN(parsed)) {
+      setDisplayTime(timeRemaining ?? '');
+      return;
+    }
+
+    const endTime = parsed + 24 * 60 * 60 * 1000;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const endTime = new Date(timeRemaining).getTime() + 24 * 60 * 60 * 1000;
const updateRemainingTime = () => {
const now = new Date().getTime();
const remainingMilliseconds = endTime - now;
if (remainingMilliseconds <= 0) {
setDisplayTime('시간 만료');
} else {
const totalMinutes = Math.floor(remainingMilliseconds / (1000 * 60));
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
setDisplayTime(`${hours}시간 ${minutes}분`);
}
};
const intervalId = setInterval(updateRemainingTime, 60000);
updateRemainingTime();
return () => {
clearInterval(intervalId);
};
const parsed = Date.parse(timeRemaining);
if (Number.isNaN(parsed)) {
setDisplayTime(timeRemaining ?? '');
return;
}
const endTime = parsed + 24 * 60 * 60 * 1000;
const updateRemainingTime = () => {
const now = new Date().getTime();
const remainingMilliseconds = endTime - now;
if (remainingMilliseconds <= 0) {
setDisplayTime('시간 만료');
} else {
const totalMinutes = Math.floor(remainingMilliseconds / (1000 * 60));
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
setDisplayTime(`${hours}시간 ${minutes}분`);
}
};
const intervalId = setInterval(updateRemainingTime, 60000);
updateRemainingTime();
return () => {
clearInterval(intervalId);
};

@constantly-dev constantly-dev merged commit c4a3a07 into develop Sep 29, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 기능 개발하라 개발 달려라 달려

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 라미인드 카드 remaining time 측정 timer 추가

1 participant