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

Refactoring CSS files: merged PageNotFound styles into global app.module.css #2536

Conversation

mandeepnh5
Copy link
Contributor

@mandeepnh5 mandeepnh5 commented Dec 1, 2024

What kind of change does this PR introduce?

Refactoring CSS files: merged PageNotFound styles into global app.module.css

Issue Number:

Fixes #2524

Did you add tests for your changes?

Yes

Summary

It is my first PR on Palisadoes Foundation and I am looking forward to contribute more to this organization.
This PR solves the problem of having a single global CSS file instead of having many CSS files in sub directories.

Does this PR introduce a breaking change?

No

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features
    • Introduced enhanced styling for the "Not Found" page, improving visual presentation and responsiveness.
  • Bug Fixes
    • Updated the import path for styles in the PageNotFound component to ensure correct styling is applied.
  • Documentation
    • Improved clarity of the "Not Found" state through new CSS classes and media queries for better user experience across devices.

Copy link
Contributor

coderabbitai bot commented Dec 1, 2024

Walkthrough

The changes in this pull request involve the removal of the PageNotFound.module.css file, which contained styles for a "Not Found" page, and the introduction of a new .notfound class in the global app.module.css file. The PageNotFound.tsx component was updated to import styles from the new global CSS file instead of the deleted module. This restructuring aligns with the goal of consolidating CSS into a single global file for better maintainability.

Changes

File Path Change Summary
src/screens/PageNotFound/PageNotFound.module.css Deleted the CSS module file containing styles for the "Not Found" page.
src/screens/PageNotFound/PageNotFound.tsx Updated import statement to reference styles from ../../style/app.module.css.
src/style/app.module.css Added new .notfound class with styles for headings, spans, and responsive media queries.

Assessment against linked issues

Objective Addressed Explanation
Refactor CSS files in src/screens/PageNotFound (Issue #2524)
Streamline all CSS into a single global file (Issue #2524)
Make the application more suitable for color blind users (Issue #2524) No specific adjustments for color blindness made.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • varshith257
  • palisadoes

🐰 "In the world of code, where styles once did roam,
A rabbit found a path to a new global home.
With CSS merged, the Not Found page shines bright,
Streamlined and clear, it’s a beautiful sight!
Hopping along, we embrace the new way,
For a cleaner design, hip-hip-hooray!" 🐇✨


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

github-actions bot commented Dec 1, 2024

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

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

🧹 Outside diff range and nitpick comments (2)
src/style/app.module.css (2)

578-603: Use CSS variables for colors and consider layout constraints

  1. The hardcoded color value #31bb6b should use a CSS variable for consistency.
  2. The very large font size (250px) might cause layout issues on some screens.

Consider these improvements:

+:root {
+  --color-primary: #31bb6b;
+  --heading-max-size: min(250px, 25vh);
+}

-.notfound h1.head {
+.notFound h1.head {
-  font-size: 250px;
+  font-size: var(--heading-max-size);
   font-weight: 900;
-  color: #31bb6b;
+  color: var(--color-primary);
   letter-spacing: 25px;
   margin: 10px 0 0 0;
 }

605-667: Optimize media queries for better maintainability

  1. Consider using CSS variables for breakpoints
  2. Some media queries could be combined to reduce code duplication
  3. Font sizes between 640px and 768px breakpoints are identical

Consider this optimization:

+:root {
+  --breakpoint-xl: 1024px;
+  --breakpoint-lg: 768px;
+  --breakpoint-md: 480px;
+  --breakpoint-sm: 320px;
+}

-@media (max-width: 1024px) {
+@media (max-width: var(--breakpoint-xl)) {
   /* ... */
 }

-@media (max-width: 768px) {
+@media (max-width: var(--breakpoint-lg)) {
   /* ... */
 }

-@media (max-width: 640px) {  /* Remove this duplicate breakpoint */
-  .notfound h1.head {
-    font-size: 150px;
-    letter-spacing: 0;
-  }
-}

-@media (max-width: 480px) {
+@media (max-width: var(--breakpoint-md)) {
   /* ... */
 }

-@media (max-width: 320px) {
+@media (max-width: var(--breakpoint-sm)) {
   /* ... */
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c2630ae and 8c8e8b7.

📒 Files selected for processing (3)
  • src/screens/PageNotFound/PageNotFound.module.css (0 hunks)
  • src/screens/PageNotFound/PageNotFound.tsx (1 hunks)
  • src/style/app.module.css (1 hunks)
💤 Files with no reviewable changes (1)
  • src/screens/PageNotFound/PageNotFound.module.css
✅ Files skipped from review due to trivial changes (1)
  • src/screens/PageNotFound/PageNotFound.tsx
🔇 Additional comments (1)
src/style/app.module.css (1)

559-667: Changes align with PR objectives

The PageNotFound styles have been successfully merged into the global CSS file, meeting the primary objective of the PR. While there are opportunities for improvement in terms of CSS best practices, the core functionality remains intact.

src/style/app.module.css Show resolved Hide resolved
Comment on lines +564 to +577
.notfound h3 {
font-family: 'Roboto', sans-serif;
font-weight: normal;
letter-spacing: 1px;
}

.notfound .brand span {
margin-top: 50px;
font-size: 40px;
}
.notfound .brand h3 {
font-weight: 300;
margin: 10px 0 0 0;
}
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 1, 2024

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use CSS variables for typography values

Consider using CSS variables for typography-related values to maintain consistency and make future updates easier. This includes font families, sizes, and weights.

Example refactor:

+:root {
+  --font-family-primary: 'Roboto', sans-serif;
+  --font-size-large: 40px;
+  --font-weight-normal: 300;
+  --letter-spacing-base: 1px;
+}

-.notfound h3 {
+.notFound h3 {
-  font-family: 'Roboto', sans-serif;
+  font-family: var(--font-family-primary);
   font-weight: normal;
-  letter-spacing: 1px;
+  letter-spacing: var(--letter-spacing-base);
 }

-.notfound .brand span {
+.notFound .brand span {
   margin-top: 50px;
-  font-size: 40px;
+  font-size: var(--font-size-large);
 }

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that notFound class is for component for NotFound and the class which I edited is for PageNotFound page, should I rename class to pageNotFound?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mandeepnh5, thank you for the clarification. Renaming the class to pageNotFound would be a good idea to reflect that it's specific to the PageNotFound page. This would help avoid confusion with the NotFound component and improve code readability.

🐰🤔


✏️ Learnings added
Learnt from: mandeepnh5
PR: PalisadoesFoundation/talawa-admin#2536
File: src/style/app.module.css:564-577
Timestamp: 2024-12-01T10:46:49.617Z
Learning: The `notFound` class is used in the `NotFound` component, whereas the `PageNotFound` page has its own styles. It's important to distinguish between them to avoid confusion.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@palisadoes
Copy link
Contributor

Please submit your PRs against our develop-postgres branch. To facilitate our reviews, the source and target branches in the PR must be different. The failing test indicates this. Closing.

@palisadoes palisadoes closed this Dec 1, 2024
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.

2 participants