Skip to content

feat: 커뮤니티·멘토 입력 글자수 카운터와 작성 후처리 UI를 정리#532

Merged
Hyeonjun0527 merged 4 commits into
developfrom
community-visible-text-counter-1
Apr 6, 2026
Merged

feat: 커뮤니티·멘토 입력 글자수 카운터와 작성 후처리 UI를 정리#532
Hyeonjun0527 merged 4 commits into
developfrom
community-visible-text-counter-1

Conversation

@Hyeonjun0527

@Hyeonjun0527 Hyeonjun0527 commented Apr 6, 2026

Copy link
Copy Markdown
Member

작업 내용

  • 커뮤니티 일반 글, QnA 질문, QnA 답변, 멘토 소개 입력 영역에 visible text 기준 글자수 카운터를 추가했습니다.
  • 커뮤니티 본문과 멘토 소개 프론트 검증을 raw HTML 길이가 아니라 visible text 길이 기준으로 맞췄습니다.
  • 본문 카운터 스타일을 제목 입력 카운터와 같은 톤으로 맞추고, 하단 구분선을 제거했습니다.
  • 커뮤니티 작성자 역할 배지를 개발자/멘토는 개발자, 그 외는 IT문자로 정리하고 테스트를 추가했습니다.
  • 커뮤니티 글/질문 등록·수정 성공 시 토스트를 제거하고, mutation 후 invalidation이 라우팅을 막지 않도록 바꿔 전환 지연을 줄였습니다.

변경 이유

  • 제목 입력과 본문 입력의 카운터 UI가 서로 달라 보여 일관성이 깨지고 있었습니다.
  • 백엔드 visible text 정책과 프론트 카운터/검증 기준을 맞춰야 했습니다.
  • 등록/수정 후 성공 토스트와 후처리 대기 때문에 화면 전환이 느리게 체감되는 문제가 있었습니다.
  • 커뮤니티 역할 배지 문구를 현재 운영 기준에 맞게 정리할 필요가 있었습니다.

검증 방법

  • yarn lint --fix
  • yarn prettier:fix
  • yarn typecheck
  • git push 과정의 pre-push next build

브랜치 정보

  • base: develop
  • head: community-visible-text-counter-1
  • 순번: 1

@Hyeonjun0527 Hyeonjun0527 self-assigned this Apr 6, 2026
@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

개요

Walkthrough

보이는 텍스트 길이 카운팅 기능을 위한 새로운 UI 컴포넌트를 추가하고, 마크다운 에디터 및 관련 컴포넌트들에 이를 통합했습니다. 커뮤니티 및 멘토링 폼에서 사용할 수 있도록 관련 검증 로직과 상수들도 추가했습니다.

Changes

코호트 / 파일(s) 요약
에디터 텍스트 카운터 컴포넌트
src/components/common/ui/editor/editor-visible-text-counter.tsx
새로운 EditorVisibleTextCounter UI 컴포넌트를 추가하여 현재 텍스트 길이와 최대 길이를 표시합니다.
마크다운 에디터 통합
src/components/common/ui/editor/markdown-editor.tsx, src/components/common/ui/rich-text/markdown-editor-core.tsx
visibleTextCounter prop을 추가하고 EditorVisibleTextCounter 컴포넌트를 조건부로 렌더링하며, getRichContentVisibleTextLength를 사용하여 보이는 텍스트 길이를 계산합니다.
커뮤니티 에디터 통합
src/features/community/ui/community-markdown-editor.tsx, src/features/community/ui/community-qna-answer-compose-section.tsx, src/features/community/ui/pages/community-write-page-client.tsx, src/features/community/ui/pages/community-qna-question-write-page-client.tsx
visibleTextCounter prop을 추가하고 관련 상수들을 연결하여 커뮤니티 에디터에 텍스트 카운팅 기능을 적용합니다.
멘토링 에디터 통합
src/features/mentoring/ui/registration/markdown/mentor-markdown-editor.tsx, src/features/mentoring/ui/registration/step-content/mentor-registration-description-step.tsx
visibleTextCounter prop을 추가하고 최대/최소 길이 상수를 연결하여 멘토 등록 에디터에 텍스트 카운팅 기능을 적용합니다.
커뮤니티 역할 배지 로직
src/features/community/ui/community-meta-badge.tsx, src/features/community/ui/community-meta-badge.test.ts
역할별 배지 메타데이터 매핑 로직을 단순화하고 DEVELOPERMENTOR 역할을 통합한 새로운 테스트를 추가합니다.
스키마 검증 및 상수
src/types/schemas/community-write-schema.ts, src/types/schemas/community-qna-question-write-schema.ts, src/types/schemas/community-qna-answer-write-schema.ts, src/types/schemas/mentor-registration-schema.ts
validateCommunityWriteContent 검증 함수와 보이는 텍스트 길이 상수들을 추가하며, 마크다운 콘텐츠 검증 로직을 재구성합니다. MENTOR_DESCRIPTION_MAX_LENGTH를 30,000에서 5,000으로 감소시키고 보이는 텍스트 길이 검증을 추가합니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 카운팅 카운팅, 글자 세기는 신나는 일,
에디터에 카운터가 쏙, 쏙!
최대치까지 달려가며 길을 재고,
숨겨진 텍스트까지 찾아내는 마법,
마크다운은 더욱 똑똑해졌어! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 visible text 글자수 카운터와 검증 로직 반영이라는 주요 변경사항을 명확하게 설명하며, 커뮤니티와 멘토 UI 정리라는 핵심 의도를 잘 전달합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch community-visible-text-counter-1

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.

@vercel

vercel Bot commented Apr 6, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
study-platform-client-dev Error Error Apr 7, 2026 0:51am

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between e22914e and cf4a32c.

📒 Files selected for processing (15)
  • src/components/common/ui/editor/editor-visible-text-counter.tsx
  • src/components/common/ui/editor/markdown-editor.tsx
  • src/components/common/ui/rich-text/markdown-editor-core.tsx
  • src/features/community/ui/community-markdown-editor.tsx
  • src/features/community/ui/community-meta-badge.test.ts
  • src/features/community/ui/community-meta-badge.tsx
  • src/features/community/ui/community-qna-answer-compose-section.tsx
  • src/features/community/ui/pages/community-qna-question-write-page-client.tsx
  • src/features/community/ui/pages/community-write-page-client.tsx
  • src/features/mentoring/ui/registration/markdown/mentor-markdown-editor.tsx
  • src/features/mentoring/ui/registration/step-content/mentor-registration-description-step.tsx
  • src/types/schemas/community-qna-answer-write-schema.ts
  • src/types/schemas/community-qna-question-write-schema.ts
  • src/types/schemas/community-write-schema.ts
  • src/types/schemas/mentor-registration-schema.ts

@Hyeonjun0527 Hyeonjun0527 changed the title feat: 커뮤니티 본문과 멘토 소개 입력에 visible text 글자수 카운터 및 길이 검증 반영 feat: 커뮤니티·멘토 입력 글자수 카운터와 작성 후처리 UI를 정리 Apr 6, 2026
@Hyeonjun0527 Hyeonjun0527 merged commit 684c170 into develop Apr 6, 2026
8 of 9 checks passed
@Hyeonjun0527 Hyeonjun0527 deleted the community-visible-text-counter-1 branch April 6, 2026 14:41
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.

1 participant