feat: 커뮤니티·멘토 입력 글자수 카운터와 작성 후처리 UI를 정리#532
Conversation
📝 Walkthrough개요Walkthrough보이는 텍스트 길이 카운팅 기능을 위한 새로운 UI 컴포넌트를 추가하고, 마크다운 에디터 및 관련 컴포넌트들에 이를 통합했습니다. 커뮤니티 및 멘토링 폼에서 사용할 수 있도록 관련 검증 로직과 상수들도 추가했습니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/components/common/ui/rich-text/markdown-editor-core.tsx (1)
187-189: 카운터 비활성 시 길이 계산을 건너뛰는 최적화를 권장합니다.현재는
visibleTextCounter가 없는 경우에도 매 렌더마다 visible text 길이를 계산합니다. 코어 컴포넌트 사용 빈도를 고려하면 조건부 계산으로 줄이는 편이 좋습니다.♻️ 제안 코드
- const currentVisibleTextLength = useMemo(() => { - return getRichContentVisibleTextLength(value); - }, [value]); + const currentVisibleTextLength = useMemo(() => { + if (!visibleTextCounter) { + return 0; + } + return getRichContentVisibleTextLength(value); + }, [value, visibleTextCounter]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/common/ui/rich-text/markdown-editor-core.tsx` around lines 187 - 189, The current useMemo always calls getRichContentVisibleTextLength even when visibleTextCounter is disabled; update the memo for currentVisibleTextLength (the useMemo block) to early-return (e.g., 0 or null) when visibleTextCounter is falsy and include visibleTextCounter in the dependency array so the length is only computed when the counter is enabled; specifically modify the useMemo that references getRichContentVisibleTextLength(value) to check visibleTextCounter first and skip the expensive call when it's not present.src/components/common/ui/editor/editor-visible-text-counter.tsx (1)
3-7:visibleTextCounter설정 타입을 공용 타입으로 추출하면 드리프트를 줄일 수 있습니다.현재 동일한 shape가 여러 파일에 반복 선언되어 있어, 추후 필드 변경 시 누락 가능성이 있습니다. 공용 타입 export 후 각 에디터 props에서 재사용하는 쪽을 권장합니다.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/common/ui/editor/editor-visible-text-counter.tsx` around lines 3 - 7, EditorVisibleTextCounterProps와 동일한 shape인 visibleTextCounter 타입이 여러 곳에 중복 선언되어 있어 향후 드리프트 위험이 있습니다; 이를 해결하려면 현재의 EditorVisibleTextCounterProps를 공용으로 export 가능한 타입(예: VisibleTextCounterProps)으로 추출하고, EditorVisibleTextCounterProps를 정의한 파일에서 export한 후 다른 에디터 컴포넌트들의 props(visibleTextCounter 관련 필드)에서 해당 공용 타입을 import·재사용하도록 변경하세요; 참조할 심볼: EditorVisibleTextCounterProps, visibleTextCounter.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/common/ui/editor/editor-visible-text-counter.tsx`:
- Around line 3-7: EditorVisibleTextCounterProps와 동일한 shape인 visibleTextCounter
타입이 여러 곳에 중복 선언되어 있어 향후 드리프트 위험이 있습니다; 이를 해결하려면 현재의
EditorVisibleTextCounterProps를 공용으로 export 가능한 타입(예: VisibleTextCounterProps)으로
추출하고, EditorVisibleTextCounterProps를 정의한 파일에서 export한 후 다른 에디터 컴포넌트들의
props(visibleTextCounter 관련 필드)에서 해당 공용 타입을 import·재사용하도록 변경하세요; 참조할 심볼:
EditorVisibleTextCounterProps, visibleTextCounter.
In `@src/components/common/ui/rich-text/markdown-editor-core.tsx`:
- Around line 187-189: The current useMemo always calls
getRichContentVisibleTextLength even when visibleTextCounter is disabled; update
the memo for currentVisibleTextLength (the useMemo block) to early-return (e.g.,
0 or null) when visibleTextCounter is falsy and include visibleTextCounter in
the dependency array so the length is only computed when the counter is enabled;
specifically modify the useMemo that references
getRichContentVisibleTextLength(value) to check visibleTextCounter first and
skip the expensive call when it's not present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b06eebee-366c-456e-b302-d30ad16fdec6
📒 Files selected for processing (15)
src/components/common/ui/editor/editor-visible-text-counter.tsxsrc/components/common/ui/editor/markdown-editor.tsxsrc/components/common/ui/rich-text/markdown-editor-core.tsxsrc/features/community/ui/community-markdown-editor.tsxsrc/features/community/ui/community-meta-badge.test.tssrc/features/community/ui/community-meta-badge.tsxsrc/features/community/ui/community-qna-answer-compose-section.tsxsrc/features/community/ui/pages/community-qna-question-write-page-client.tsxsrc/features/community/ui/pages/community-write-page-client.tsxsrc/features/mentoring/ui/registration/markdown/mentor-markdown-editor.tsxsrc/features/mentoring/ui/registration/step-content/mentor-registration-description-step.tsxsrc/types/schemas/community-qna-answer-write-schema.tssrc/types/schemas/community-qna-question-write-schema.tssrc/types/schemas/community-write-schema.tssrc/types/schemas/mentor-registration-schema.ts
작업 내용
개발자, 그 외는IT문자로 정리하고 테스트를 추가했습니다.변경 이유
검증 방법
yarn lint --fixyarn prettier:fixyarn typecheckgit push과정의 pre-pushnext build브랜치 정보
developcommunity-visible-text-counter-11