Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

533-refactor: Widget courses #545

Merged
merged 20 commits into from
Sep 27, 2024
Merged

533-refactor: Widget courses #545

merged 20 commits into from
Sep 27, 2024

Conversation

YulikK
Copy link
Collaborator

@YulikK YulikK commented Sep 24, 2024

What type of PR is this? (select all that apply)

  • πŸ• Feature
  • πŸ› Bug Fix
  • 🚧 Breaking Change
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ“ Documentation Update

Description

  1. move courses.test.tsx to ui folder
  2. rename other-courses.test.tsx to courses.test.tsx
  3. update tests
  4. make scss module file
  5. update classes names
  6. change div to ul-li
  7. move title text to localization variable

Related Tickets & Documents

Screenshots, Recordings

Please replace this line with any relevant images for UI changes.

Added/updated tests?

  • πŸ‘Œ Yes
  • πŸ™…β€β™‚οΈ No, because they aren't needed
  • πŸ™‹β€β™‚οΈ No, because I need help

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Summary by CodeRabbit

  • New Features

    • Introduced a centralized constant for the courses path to enhance maintainability.
    • Added a new SCSS file for improved styling of the Courses component.
    • Implemented unit tests for the Courses component to verify rendering and behavior under various states.
  • Bug Fixes

    • Removed outdated unit tests for the Courses component to streamline testing.
  • Refactor

    • Updated the Courses component to use CSS modules for styling, improving class name management.

@YulikK YulikK self-assigned this Sep 24, 2024
@github-actions github-actions bot changed the title Refactor/533 widget courses 533-refactor: Widget courses Sep 24, 2024
Copy link

Lighthouse Report:

  • Performance: 88 / 100
  • Accessibility: 98 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.test.tsx Outdated Show resolved Hide resolved
Copy link

Lighthouse Report:

  • Performance: 94 / 100
  • Accessibility: 98 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

Copy link

Lighthouse Report:

  • Performance: 98 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

src/widgets/courses/ui/courses.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.test.tsx Outdated Show resolved Hide resolved
src/widgets/courses/ui/courses.test.tsx Outdated Show resolved Hide resolved
Copy link

Lighthouse Report:

  • Performance: 97 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@KristiBo KristiBo marked this pull request as ready for review September 26, 2024 20:50
Copy link
Contributor

coderabbitai bot commented Sep 26, 2024

πŸ“ Walkthrough
πŸ“ Walkthrough

Walkthrough

The pull request introduces several changes across multiple files related to the Courses component. Key modifications include the addition of a new constant for centralized path management, refactoring of SCSS to CSS modules for improved styling practices, and the introduction of unit tests to ensure component functionality under various states.

Changes

File(s) Change Summary
src/widgets/courses/constants.ts Added a new constant path with the value 'courses'.
src/widgets/courses/other-courses.test.tsx Deleted the file containing unit tests for the Courses component.
src/widgets/courses/ui/courses.module.scss Introduced a new SCSS module with styles for .courses-content and .courses-list.
src/widgets/courses/ui/courses.test.tsx Added new unit tests for the Courses component, covering rendering, loading, and error states.
src/widgets/courses/ui/courses.tsx Refactored to use CSS modules and updated class names for dynamic styling with classNames.

Assessment against linked issues

Objective Addressed Explanation
Refactor courses.tsx's scss to scss modules (533) βœ…
Move courses.test.tsx to ui folder (533) βœ…
Rename other-courses.test.tsx to courses.test.tsx (533) βœ…

Possibly related issues

  • None identified as the changes in this PR do not address objectives from the similar issues listed.

Possibly related PRs

Suggested reviewers

  • dzmitry-varabei
  • andron13
  • natanchik
  • Quiddlee
  • SpaNb4

πŸ“œ Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between a5dad1b and 901b11f.

πŸ“’ Files selected for processing (1)
  • src/widgets/courses/ui/courses.test.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/widgets/courses/ui/courses.test.tsx

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 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.

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
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (1)
src/widgets/courses/ui/courses.test.tsx (1)

49-81: Test cases cover main scenarios, but could be more specific.

The test cases effectively cover rendering, loading, and error states. Consider enhancing the rendering test to check for specific course details in the cards, such as start date or language.

Example addition to the rendering test:

courseCards.forEach((card, index) => {
  expect(card).toBeVisible();
  expect(card).toHaveTextContent(mockCourses[index].title);
  expect(card).toHaveTextContent(mockCourses[index].startDate);
  expect(card).toHaveTextContent(mockCourses[index].language.join(', '));
});
πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 3f9cb1f and a5dad1b.

πŸ“’ Files selected for processing (6)
  • src/widgets/courses/constants.ts (1 hunks)
  • src/widgets/courses/other-courses.test.tsx (0 hunks)
  • src/widgets/courses/ui/courses.module.scss (1 hunks)
  • src/widgets/courses/ui/courses.scss (0 hunks)
  • src/widgets/courses/ui/courses.test.tsx (1 hunks)
  • src/widgets/courses/ui/courses.tsx (2 hunks)
πŸ’€ Files not reviewed due to no reviewable changes (2)
  • src/widgets/courses/other-courses.test.tsx
  • src/widgets/courses/ui/courses.scss
πŸ”‡ Additional comments (11)
src/widgets/courses/constants.ts (1)

1-1: Approved: Good use of constants.

Centralizing the path improves maintainability.

src/widgets/courses/ui/courses.module.scss (3)

1-9: LGTM: .courses-content implementation.

The flexbox layout with responsive adjustments is well-implemented.


11-24: LGTM: .courses-list implementation.

The grid layout with responsive adjustments is well-implemented, addressing previous grid-related comments.


1-24: Verify padding implementation.

The past comment from KristiBo about unified paddings for container and content isn't explicitly addressed in this file. Please confirm if this is handled elsewhere or if it still needs attention.

src/widgets/courses/ui/courses.tsx (5)

1-2: Improved styling approach and imports.

The changes to import statements and the setup for CSS modules align well with the refactoring objectives. Good job on using classNames for flexible class management.

Also applies to: 10-12


15-15: Improved data fetching with constant.

Using the path constant in useDataByName enhances maintainability. Good refactoring choice.


36-36: Refactored section element styling.

The use of cx for class names and the removal of the unused id attribute improve the code. These changes align with the refactoring goals and past review discussions.


37-37: Updated content div styling.

The content div now correctly uses cx for multiple class names, following the CSS modules approach. This change addresses previous review comments effectively.


39-39: Refined courses list structure.

The courses list div now uses cx for styling, adhering to the CSS modules approach. The decision to keep it as a div instead of changing to a ul-li structure is noted and aligns with the previous discussion about the appropriateness of list elements in this context.

src/widgets/courses/ui/courses.test.tsx (2)

1-37: Imports and mock data are well-structured.

The imports and mock data are appropriate for the testing setup.


39-47: Mock setup for useDataByName is correct.

The mock setup will provide consistent data for testing.

Copy link

Lighthouse Report:

  • Performance: 94 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@SpaNb4 SpaNb4 merged commit 7200da2 into main Sep 27, 2024
4 checks passed
@SpaNb4 SpaNb4 deleted the refactor/533-widget-courses branch September 27, 2024 17:34
@coderabbitai coderabbitai bot mentioned this pull request Dec 6, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FSD: Widget Courses
7 participants