참가인원 계산 로직 수정#468
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughStudy 관련 컴포넌트들에서 선택적 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
시
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/common/ui/study-active-ticker.tsx (1)
20-21:⚠️ Potential issue | 🟠 Major
remaining계산 시NaN방어가 필요합니다.Line 20에서
maxMembersCount/approvedCount가undefined면remaining이NaN이 되고, Line 46에서NaN자리가 노출될 수 있습니다(호출부:src/components/pages/group-study-detail-page.tsx:307-314, 타입:src/api/openapi/models/group-study-basic-info-response-dto.ts:50-65).수정 제안
export default function StudyActiveTicker({ - approvedCount, - maxMembersCount, + approvedCount = 0, + maxMembersCount = 0, viewCount = 0, className = '', }: StudyActiveTickerProps) { - const remaining = Math.max(0, maxMembersCount - approvedCount); - const totalCount = maxMembersCount - remaining; + const safeApproved = Number.isFinite(approvedCount) ? approvedCount : 0; + const safeMaxMembers = Number.isFinite(maxMembersCount) ? maxMembersCount : 0; + const remaining = Math.max(0, safeMaxMembers - safeApproved); + const totalCount = safeApproved;Also applies to: 46-46
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/common/ui/study-active-ticker.tsx` around lines 20 - 21, The calculation for remaining and totalCount can produce NaN when maxMembersCount or approvedCount are undefined; update the logic in StudyActiveTicker (the remaining and totalCount assignments) to coerce inputs to numbers with safe defaults (e.g., const max = Number(maxMembersCount ?? 0); const approved = Number(approvedCount ?? 0)) and then compute remaining = Math.max(0, max - approved) and totalCount = max - remaining (or use Math.max(0, max - remaining)); also guard with Number.isFinite if you prefer to fallback to 0 to ensure no NaN is rendered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/components/common/ui/study-active-ticker.tsx`:
- Around line 20-21: The calculation for remaining and totalCount can produce
NaN when maxMembersCount or approvedCount are undefined; update the logic in
StudyActiveTicker (the remaining and totalCount assignments) to coerce inputs to
numbers with safe defaults (e.g., const max = Number(maxMembersCount ?? 0);
const approved = Number(approvedCount ?? 0)) and then compute remaining =
Math.max(0, max - approved) and totalCount = max - remaining (or use Math.max(0,
max - remaining)); also guard with Number.isFinite if you prefer to fallback to
0 to ensure no NaN is rendered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c90370b8-5766-4b2b-801b-af43c4c0312c
📒 Files selected for processing (3)
src/components/card/study-card.tsxsrc/components/common/ui/study-active-ticker.tsxsrc/components/pages/group-study-detail-page.tsx
💤 Files with no reviewable changes (1)
- src/components/pages/group-study-detail-page.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/common/ui/editor/markdown-content.tsx (1)
245-245:⚠️ Potential issue | 🟡 MinorTailwind 임의 값 사용 - 코딩 가이드라인 위반
max-h-[400px]와max-w-[min(100%,400px)]는 프로젝트 코딩 가이드라인에서 금지하는 임의 값(arbitrary values)입니다. 프로젝트 커스텀 디자인 토큰을 사용해야 합니다.
global.css에 커스텀 유틸리티 클래스를 정의하거나, 기존 디자인 토큰으로 대체하는 것을 권장합니다.🛠️ 권장 수정 방안
global.css에 커스텀 유틸리티 추가:`@layer` utilities { .max-h-markdown-img { max-height: 400px; } .max-w-markdown-img { max-width: min(100%, 400px); } }그 후 컴포넌트에서 사용:
-'[&_img]:rounded-100 [&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-[400px] [&_img]:max-w-[min(100%,400px)] [&_img]:border [&_img]:object-contain', +'[&_img]:rounded-100 [&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-markdown-img [&_img]:max-w-markdown-img [&_img]:border [&_img]:object-contain',As per coding guidelines: "Forbidden: Tailwind arbitrary values (e.g.,
p-[4px],w-[320px]). Use only project custom design tokens."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/common/ui/editor/markdown-content.tsx` at line 245, The Tailwind arbitrary values in the MarkdownContent image class string (the array entry containing '[&_img]:rounded-100 [&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-[400px] [&_img]:max-w-[min(100%,400px)] [&_img]:border [&_img]:object-contain') violate the coding guideline; add two custom utility classes in global.css (e.g., .max-h-markdown-img and .max-w-markdown-img) that implement max-height: 400px and max-width: min(100%,400px), then update the MarkdownContent component to replace [&_img]:max-h-[400px] and [&_img]:max-w-[min(100%,400px)] with [&_img]:max-h-markdown-img and [&_img]:max-w-markdown-img respectively so the component uses project design tokens instead of arbitrary Tailwind values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/components/common/ui/editor/markdown-content.tsx`:
- Line 245: The Tailwind arbitrary values in the MarkdownContent image class
string (the array entry containing '[&_img]:rounded-100
[&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto
[&_img]:max-h-[400px] [&_img]:max-w-[min(100%,400px)] [&_img]:border
[&_img]:object-contain') violate the coding guideline; add two custom utility
classes in global.css (e.g., .max-h-markdown-img and .max-w-markdown-img) that
implement max-height: 400px and max-width: min(100%,400px), then update the
MarkdownContent component to replace [&_img]:max-h-[400px] and
[&_img]:max-w-[min(100%,400px)] with [&_img]:max-h-markdown-img and
[&_img]:max-w-markdown-img respectively so the component uses project design
tokens instead of arbitrary Tailwind values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2eb3d1f0-83cd-4e02-a057-55eeb15ba2cd
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (8)
.eslintrc.cjs.husky/pre-commitnext.config.tssrc/components/common/ui/editor/markdown-content.tsxsrc/components/one-on-one/one-on-one-page.tsxsrc/features/mentoring/ui/registration/markdown/mentor-markdown-rendering.tssrc/types/css.d.tstsconfig.json
💤 Files with no reviewable changes (2)
- .husky/pre-commit
- src/components/one-on-one/one-on-one-page.tsx
✅ Files skipped from review due to trivial changes (1)
- src/types/css.d.ts
Summary by CodeRabbit
버그 수정
리팩토링
스타일
잡무