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

557-refactor: Widget numbers #585

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Conversation

Quiddlee
Copy link
Collaborator

@Quiddlee Quiddlee commented Oct 3, 2024

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

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

Description

Refactor Numbers widget

Related Tickets & Documents

Screenshots, Recordings

Before

Screenshot 2024-10-03 at 10 52 35β€―PM

After

Screenshot 2024-10-03 at 10 52 51β€―PM

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?

CrunchCatGIF (2)

Summary by CodeRabbit

  • New Features
    • Introduced the rsInNumbers constant for displaying RS School statistics.
    • Added new InfoCell component for structured title and description display.
    • Launched Numbers component to present information about "The Rolling Scopes" community.
  • Style
    • Implemented new SCSS modules for InfoCell and Numbers components to enhance layout and responsiveness.
  • Tests
    • Created new test files for InfoCell and Numbers components to ensure proper functionality.
  • Refactor
    • Updated export paths for improved organization of the Numbers entity.

@github-actions github-actions bot changed the title 557-refactor: Widget Numbers 557-refactor: Widget numbers Oct 3, 2024
@Quiddlee Quiddlee self-assigned this Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

Lighthouse Report:

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

View detailed report

@SpaNb4
Copy link
Collaborator

SpaNb4 commented Oct 5, 2024

run visual now

Copy link

Lighthouse Report:

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

View detailed report

@Quiddlee
Copy link
Collaborator Author

Update

Screenshot 2024-10-17 at 3 27 58β€―PM Screenshot 2024-10-17 at 3 29 31β€―PM Screenshot 2024-10-17 at 3 29 52β€―PM

Copy link

Lighthouse Report:

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

View detailed report

@SpaNb4
Copy link
Collaborator

SpaNb4 commented Oct 17, 2024

Shouldn't we apply white-space: nowrap; to the title for large screens?
image

@Quiddlee
Copy link
Collaborator Author

Shouldn't we apply white-space: nowrap; to the title for large screens? image

I don't quite get that, i have no wrapping even without white-space: nowrap;
Screenshot 2024-10-17 at 4 39 48β€―PM

@KristiBo KristiBo marked this pull request as ready for review October 18, 2024 08:11
Copy link

coderabbitai bot commented Oct 18, 2024

πŸ“ Walkthrough
πŸ“ Walkthrough

Walkthrough

The pull request introduces several changes, including the addition of a new constant rsInNumbers in dev-data/rs-in-numbers.data.ts and its export from dev-data/index.ts. It also modifies the export path for the Numbers entity in src/widgets/numbers/index.ts, while new components and test files for InfoCell and Numbers are created. Additionally, new SCSS modules are added for styling.

Changes

File Path Change Summary
dev-data/index.ts Added export for rsInNumbers from rs-in-numbers.data
dev-data/rs-in-numbers.data.ts Introduced constant rsInNumbers, an array of statistics related to RS School
src/widgets/numbers/index.ts Updated export path for Numbers from ./ui/numbers to ./ui/numbers/numbers
src/widgets/numbers/ui/info-cell/info-cell.module.scss Added new SCSS classes for .info-cell component
src/widgets/numbers/ui/info-cell/info-cell.test.tsx Created new test file for InfoCell component
src/widgets/numbers/ui/info-cell/info-cell.tsx Introduced new InfoCell component with title and description props
src/widgets/numbers/ui/numbers/numbers.module.scss Added new SCSS classes for Numbers component
src/widgets/numbers/ui/numbers/numbers.test.tsx Created new test file for Numbers component
src/widgets/numbers/ui/numbers.tsx Introduced new Numbers component displaying information about "The Rolling Scopes" community

Assessment against linked issues

Objective Addressed Explanation
Refactor numbers.tsx's SCSS ❌ No changes made to the SCSS as specified.
Replace div's with HTML5 tags in not-found.tsx ❓ Not applicable; not-found.tsx was not modified.
Encapsulate InfoCell in separate file βœ… InfoCell component created in its own file.
Move numbers.test.tsx to ui folder ❌ New test files were created but not moved.

Suggested reviewers

  • dzmitry-varabei
  • andron13
  • natanchik
  • SpaNb4
  • ansivgit

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

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

🧹 Outside diff range and nitpick comments (6)
src/widgets/numbers/ui/info-cell/info-cell.tsx (1)

12-17: Component structure is clean and follows best practices.

The InfoCell component is well-structured and uses semantic HTML. Consider adding ARIA labels for improved accessibility.

Here's a suggested improvement:

 export const InfoCell = ({ title, description }: InfoCellProps) => (
-  <article className={cx('info-cell')}>
+  <article className={cx('info-cell')} aria-label="Information Cell">
     <div className={cx('info-cell-number')}>{title}</div>
     <div className={cx('info-cell-text')}>{description}</div>
   </article>
 );
src/widgets/numbers/ui/info-cell/info-cell.test.tsx (1)

9-13: Assertions cover basic functionality.

Good checks for title and description. Consider adding tests for edge cases or different prop types.

src/widgets/numbers/ui/numbers/numbers.test.tsx (1)

10-15: Test case structure is solid.

Good use of screen queries. Consider adding more test cases for different scenarios.

src/widgets/numbers/ui/info-cell/info-cell.module.scss (1)

43-51: Consider flexible height for text.

Fixed height might truncate longer content. Maybe use min-height instead?

src/widgets/numbers/ui/numbers/numbers.module.scss (1)

27-37: Consider fallback for text-wrap: balance.

While text-wrap: balance improves readability, it's not universally supported. Consider adding a fallback for browsers that don't support it.

src/widgets/numbers/ui/numbers/numbers.tsx (1)

15-39: Content rendering looks good, with a minor suggestion.

The dynamic rendering of InfoCell components and the use of semantic HTML are commendable. The image includes alt text, which is great for accessibility.

Consider adding aria-label to the section element for improved accessibility:

- <section className={cx('container')}>
+ <section className={cx('container')} aria-label="The Rolling Scopes community statistics">
πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between a81dfef and 0647a74.

πŸ“’ Files selected for processing (12)
  • dev-data/index.ts (1 hunks)
  • dev-data/rs-in-numbers.data.ts (1 hunks)
  • src/widgets/numbers/index.ts (1 hunks)
  • src/widgets/numbers/numbers.test.tsx (0 hunks)
  • src/widgets/numbers/ui/info-cell/info-cell.module.scss (1 hunks)
  • src/widgets/numbers/ui/info-cell/info-cell.test.tsx (1 hunks)
  • src/widgets/numbers/ui/info-cell/info-cell.tsx (1 hunks)
  • src/widgets/numbers/ui/numbers.scss (0 hunks)
  • src/widgets/numbers/ui/numbers.tsx (0 hunks)
  • src/widgets/numbers/ui/numbers/numbers.module.scss (1 hunks)
  • src/widgets/numbers/ui/numbers/numbers.test.tsx (1 hunks)
  • src/widgets/numbers/ui/numbers/numbers.tsx (1 hunks)
πŸ’€ Files with no reviewable changes (3)
  • src/widgets/numbers/numbers.test.tsx
  • src/widgets/numbers/ui/numbers.scss
  • src/widgets/numbers/ui/numbers.tsx
βœ… Files skipped from review due to trivial changes (2)
  • dev-data/rs-in-numbers.data.ts
  • src/widgets/numbers/index.ts
🧰 Additional context used
πŸ”‡ Additional comments (13)
src/widgets/numbers/ui/info-cell/info-cell.tsx (2)

1-5: Imports and setup look good.

The use of classnames/bind with CSS modules is a solid choice for managing dynamic class names.


7-10: Type definition is well-structured.

The InfoCellProps type clearly defines the expected props, adhering to the PR objective of using types instead of interfaces.

src/widgets/numbers/ui/info-cell/info-cell.test.tsx (2)

1-2: Imports look good.

Correct imports for testing library and component.


4-8: Well-structured test setup.

Good job defining test data outside and using descriptive test names.

src/widgets/numbers/ui/numbers/numbers.test.tsx (1)

1-8: Imports and test setup look good.

Proper imports and test structure using describe and beforeEach.

src/widgets/numbers/ui/info-cell/info-cell.module.scss (4)

1-10: Main container styles look good.

Flex layout and dimensions are well-defined.


12-28: Consider alternative for vertical line.

The pseudo-element works, but a border might be simpler. Why this approach?


30-41: Number styles are well-defined.

Font properties and responsive adjustments look good.


53-62: Responsive adjustments look good.

Media queries appropriately handle different screen sizes.

src/widgets/numbers/ui/numbers/numbers.module.scss (2)

1-7: Flexbox layout for centering: Approved.

Effective use of flexbox for centering content vertically and horizontally.


9-25: Consider z-index implications.

The negative z-index might cause issues if there are other elements with a higher stacking context. Ensure this doesn't interfere with other components.

src/widgets/numbers/ui/numbers/numbers.tsx (1)

1-11: Imports and setup look good.

The necessary components and utilities are imported, and CSS modules are properly set up.

dev-data/index.ts (1)

36-36: New export added correctly.

The rsInNumbers export is consistent with the file's structure.

src/widgets/numbers/ui/numbers/numbers.tsx Outdated Show resolved Hide resolved
@Quiddlee
Copy link
Collaborator Author

Quiddlee commented Oct 18, 2024

Shouldn't we apply white-space: nowrap; to the title for large screens? image

fixed. The wrapping caused because of different system fonts

Copy link

Lighthouse Report:

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

View detailed report

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

🧹 Outside diff range and nitpick comments (2)
src/widgets/numbers/ui/numbers/numbers.module.scss (2)

1-11: Consider responsive text wrapping for .numbers-title.

The nowrap might cause overflow on smaller screens. Add a media query for mobile views.


31-41: Add fallback for text-wrap: balance.

This property has limited browser support. Consider a fallback solution.

πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 0647a74 and 3d24e89.

πŸ“’ Files selected for processing (2)
  • src/widgets/numbers/ui/numbers/numbers.module.scss (1 hunks)
  • src/widgets/numbers/ui/numbers/numbers.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/widgets/numbers/ui/numbers/numbers.tsx
🧰 Additional context used
πŸ”‡ Additional comments (2)
src/widgets/numbers/ui/numbers/numbers.module.scss (2)

13-29: Responsive map positioning looks good.

The absolute positioning and media query adjustments are well-implemented.


43-76: Simplify complex selectors as previously suggested.

Use semantic class names instead of nth-child selectors for better maintainability.

Copy link
Collaborator

@SpaNb4 SpaNb4 left a comment

Choose a reason for hiding this comment

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

image

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 Numbers
5 participants