Skip to content

Conversation

@DrCloy
Copy link
Collaborator

@DrCloy DrCloy commented Feb 26, 2025

#️⃣ 연관된 이슈

📝 작업 내용

  • 강의명, 대학명, 학수번호 유효성 검사 추가
  • 강의 명이 숫자일 경우 줄바꿈 적용 안 되는 버그 수정

Summary by CodeRabbit

  • Style

    • Enhanced text wrapping on course cards to prevent overflow and improve readability.
  • New Features

    • Added input validations in the course modal to display helpful error messages when course details exceed the allowed character limits.

- 강의명, 대학명, 학수번호 유효성 검사 추가
- 강의 명이 숫자일 경우 줄바꿈 적용 안 되는 버그 수정
@DrCloy DrCloy added 🐞 Fix 버그 수정 (기능 오류 및 예외 처리 등) ⚛️ FE 프론트엔드 관련 labels Feb 26, 2025
@DrCloy DrCloy requested a review from wwweric12 February 26, 2025 03:45
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2025

Walkthrough

The pull request introduces two changes. First, it updates the course card CSS to include word-break: break-all; and overflow-wrap: break-word; for handling text overflow in the .title class for both medium and large layouts. Second, it adds onBlur validation checks in the course modal component to ensure that the name, code, and university fields do not exceed defined character limits, updating error messages accordingly.

Changes

File Path Change Summary
front-end/src/pages/professor/home/.../CourseCard.module.css Added CSS properties word-break: break-all; and overflow-wrap: break-word; to the .title class in .medium and .large sections to control text overflow.
front-end/src/pages/professor/home/.../CourseModal.tsx Enhanced the CourseModal component with onBlur validations for the name, code, and university fields, setting error messages when character limits are exceeded.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant M as CourseModal
    U->>M: onBlur event on input field (name/code/university)
    M->>M: Validate field length
    alt Input Valid
        M->>U: No error message displayed
    else Input Exceeds Limit
        M->>U: Display appropriate error message
    end
Loading

Suggested labels

✨ Feat

Suggested reviewers

  • wwweric12
  • wwweric12

Poem

I’m a bouncing rabbit with a coder’s flair,
Hopping through CSS and validations with care.
When text overflows, I split and mend,
With error checks, the bugs all end.
Carrots and code, a joyful affair!
🥕🐇

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (2)
front-end/src/pages/professor/home/components/CourseCard.module.css (1)

292-293: Consider applying these properties to .title instead of .text

The text-wrapping properties are applied to the .large .text container which affects all child elements. For consistency with the medium layout (where you applied it to .title), consider applying these properties directly to .large .title instead.

 .large .text {
   display: flex;
   flex-direction: column;
   gap: 42px;
-  word-break: break-all;
-  overflow-wrap: break-word;
 }

 .large .university {
   font: var(--web-caption1-bold);
   color: var(--sub-orange-500);
 }

 .large .title {
   font: var(--web-title1-bold);
   color: var(--gray-900);
+  word-break: break-all;
+  overflow-wrap: break-word;
 }
front-end/src/pages/professor/home/modal/CourseModal.tsx (1)

114-121: Consider adding the new validation checks to the initial formError state

For consistency, consider adding error messages for character limit violations to the initial formError state, especially for cases where the initial value from props might exceed the limits.

  const [formError, setFormError] = useState<CourseError>({
    name: '',
    code: '',
    capacity: '',
    university: '',
    classType: courseForm.classType === '' ? '강의 유형을 선택해 주세요' : '',
    schedule: '',
  });

+ // Add initial validation for character limits
+ useEffect(() => {
+   if (courseForm.name.length > 30) {
+     setFormError(prev => ({ ...prev, name: '강의 이름은 30자 이하로 입력해 주세요' }));
+   }
+   if (courseForm.code.length > 10) {
+     setFormError(prev => ({ ...prev, code: '학수번호는 10자 이하로 입력해 주세요' }));
+   }
+   if (courseForm.university.length > 20) {
+     setFormError(prev => ({ ...prev, university: '대학이름은 20자 이하로 입력해 주세요' }));
+   }
+ }, []);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5b115 and e9d7fca.

📒 Files selected for processing (2)
  • front-end/src/pages/professor/home/components/CourseCard.module.css (2 hunks)
  • front-end/src/pages/professor/home/modal/CourseModal.tsx (3 hunks)
🔇 Additional comments (3)
front-end/src/pages/professor/home/components/CourseCard.module.css (1)

174-175: Looks good! These CSS properties will help with text overflow.

Adding word-break: break-all and overflow-wrap: break-word to the medium title ensures that long text, including numeric content, will break properly and not overflow the container.

front-end/src/pages/professor/home/modal/CourseModal.tsx (2)

341-345: Validation looks good for code field

The validation for the code field correctly checks for a 10-character limit and provides an appropriate error message.


397-401: Validation looks good for university field

The validation for the university field correctly checks for a 20-character limit and provides an appropriate error message.

Comment on lines +243 to +247
} else if (courseForm.name.length > 35) {
setFormError((prev) => ({
...prev,
name: '강의 이름은 30자 이하로 입력해 주세요',
}));
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix inconsistent character limit messaging

There's a discrepancy between the check and the error message. The check tests for length > 35, but the error message indicates a 30-character limit.

-            } else if (courseForm.name.length > 35) {
+            } else if (courseForm.name.length > 30) {
               setFormError((prev) => ({
                 ...prev,
                 name: '강의 이름은 30자 이하로 입력해 주세요',
               }));
📝 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
} else if (courseForm.name.length > 35) {
setFormError((prev) => ({
...prev,
name: '강의 이름은 30자 이하로 입력해 주세요',
}));
} else if (courseForm.name.length > 30) {
setFormError((prev) => ({
...prev,
name: '강의 이름은 30자 이하로 입력해 주세요',
}));

@DrCloy DrCloy merged commit 245d3db into dev Feb 27, 2025
2 checks passed
@DrCloy DrCloy deleted the fix/fe/course-validation branch February 27, 2025 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚛️ FE 프론트엔드 관련 🐞 Fix 버그 수정 (기능 오류 및 예외 처리 등)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FE] 수업 이름, 대학명, 학수번호 최대 글자수 제한 누락

3 participants