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

fixed:#2510 Refactor CSS files in src/screens/ManageTag #2769

Conversation

gurramkarthiknetha
Copy link
Contributor

@gurramkarthiknetha gurramkarthiknetha commented Dec 24, 2024

What kind of change does this PR introduce?

Refactoring

Issue Number:

Fixes #2510

Did you add tests for your changes?

No (Not applicable for this refactoring task).

Snapshots/Videos:

Not applicable.

If relevant, did you update the documentation?

Not applicable for this task.

Summary

This PR focuses on refactoring the CSS files in src/screens/ManageTag and its related components to align with the unified design system in Talawa-Admin.

Key objectives achieved:

  1. Consolidated all CSS styles into a single global file (src/style/app.module.css).
  2. Improved UI/UX for color-blind users by adhering to accessibility standards.
  3. Deleted all redundant CSS files in src/screens/ManageTag and its related components.
  4. Updated all references in the affected components to use the global CSS file.

This refactoring improves maintainability and consistency across the application.

Does this PR introduce a breaking change?

No

Other information

The foundational work for this refactoring was completed in PR: Chore/css changes #2466. This work builds on that effort to finalize the migration to the unified CSS design.

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Introduced a new class for search title styling.
    • Added new layout class utilizing flexbox for improved alignment.
  • Bug Fixes

    • Enhanced responsiveness of button container and its child elements.
  • Style

    • Updated styles for DataGrid component headers and rows.
    • Restructured button container styles for better functionality.
    • Defined new styles for various components to improve visual presentation.
    • Added new CSS variables to enhance the color palette.
    • Introduced new styles for .searchtitle and .justifysp classes.

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request focuses on refactoring CSS styles for the ManageTag component by updating the styling in both the component's TypeScript file and the global CSS module. The changes involve modifying class names for table headers, row backgrounds, and introducing new CSS classes to improve the visual consistency and responsiveness of the application's UI.

Changes

File Change Summary
src/screens/ManageTag/ManageTag.tsx Updated headerClassName and getRowClassName with modified CSS class names
src/style/app.module.css Added new classes (.searchtitle, .justifysp, .rowBackgrounds), updated .btnsContainer, defined .tableHeaders

Assessment against linked issues

Objective Addressed Explanation
Refactor CSS files in ManageTag [#2510]
Streamline CSS into global file
Improve UI/UX for color-blind users Color contrast needs further review

Possibly related issues

Possibly related PRs

Suggested reviewers

  • palisadoes

Poem

🐰 In the realm of styles so bright,
CSS classes dance with delight,
ManageTag's look, now sleek and clean,
A global module's coding dream!
Refactoring with rabbit might! 🎨


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. (Beta)
  • @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

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

🧹 Nitpick comments (3)
src/style/app.module.css (3)

613-622: Consider responsive design improvements for button container

The current implementation has potential issues:

  1. The justify-content: space-between won't work since .input isn't a flex container
  2. Fixed max-width: 60% might cause layout issues on smaller screens

Consider this improvement:

 .btnsContainer .input {
   flex: 1;
   position: relative;
-  max-width: 60%;
-  justify-content: space-between;
+  max-width: min(60%, 400px);
+  display: flex;
+  justify-content: space-between;
 }

635-639: Prevent layout shift on hover

The font-weight change from normal to 600 on hover might cause unwanted layout shifts.

Consider this improvement to prevent layout shift:

+.tagsBreadCrumbs {
+  font-weight: 600;
+}
 .tagsBreadCrumbs:hover {
   color: var(--bs-blue);
-  font-weight: 600;
   text-decoration: underline;
 }

641-647: Enhance cross-browser scrollbar styling

The scrollbar styling needs Firefox-specific properties for consistent appearance.

Add Firefox-specific scrollbar styling:

 .manageTagScrollableDiv {
   scrollbar-width: thin;
   scrollbar-color: var(--bs-gray-400) var(--bs-white);
+  /* Firefox */
+  scrollbar-width: thin;
+  /* WebKit */
+  &::-webkit-scrollbar {
+    width: 8px;
+  }
+  &::-webkit-scrollbar-track {
+    background: var(--bs-white);
+  }
+  &::-webkit-scrollbar-thumb {
+    background-color: var(--bs-gray-400);
+    border-radius: 4px;
+  }
   max-height: calc(100vh - 18rem);
   overflow: auto;
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22b267a and 93e85e9.

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

612-647: Changes align well with PR objectives

The CSS changes successfully:

  1. Consolidate ManageTag styles into the global CSS file
  2. Maintain consistent styling with Bootstrap variables
  3. Consider accessibility through proper color contrast

src/style/app.module.css Outdated Show resolved Hide resolved
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: 1

🧹 Nitpick comments (2)
src/style/app.module.css (2)

Line range hint 93-108: Consider improving accessibility of the search title border

The .searchtitle class uses a green border that might not provide sufficient contrast for users with color vision deficiencies.

Consider adding an additional visual indicator or adjusting the contrast. For example:

.searchtitle {
  color: #707070;
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 20px;
  padding-bottom: 5px;
- border-bottom: 3px solid #31bb6b;
+ border-bottom: 3px solid #31bb6b;
+ box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
  width: 60%;
}

229-254: Improve responsive design for button containers

The .btnsContainerBlockAndUnblock class could benefit from better responsive behavior.

Consider adding media queries for better mobile support:

.btnsContainerBlockAndUnblock {
  display: flex;
  margin: 2.5rem 0 2.5rem 0;
+ @media (max-width: 768px) {
+   flex-direction: column;
+   gap: 1rem;
+ }
}

.btnsContainerBlockAndUnblock .inputBlockAndUnblock {
  width: 70%;
  position: relative;
+ @media (max-width: 768px) {
+   width: 100%;
+ }
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5647af and 17e6485.

📒 Files selected for processing (1)
  • src/style/app.module.css (12 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/style/app.module.css

[error] 16-16: Unexpected value or character.

Expected one of:

(parse)

🔇 Additional comments (1)
src/style/app.module.css (1)

1052-1056: LGTM: Proper overflow handling implemented

The .rowBackgrounds class correctly implements overflow handling with overflow-y: auto, addressing the content overflow concern from previous reviews.

src/style/app.module.css Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.17%. Comparing base (7025360) to head (25ae1c3).
Report is 1 commits behind head on develop-postgres.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           develop-postgres    #2769       +/-   ##
=====================================================
+ Coverage             71.94%   87.17%   +15.22%     
=====================================================
  Files                   296      313       +17     
  Lines                  7358     8204      +846     
  Branches               1606     1848      +242     
=====================================================
+ Hits                   5294     7152     +1858     
+ Misses                 1804      867      -937     
+ Partials                260      185       -75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

🧹 Nitpick comments (1)
src/style/app.module.css (1)

230-256: Consider consolidating duplicate button container styles

The .btnsContainerBlockAndUnblock class has similar properties to .btnsContainer. Consider creating a shared base class to reduce duplication.

+.btnsContainerBase {
+  display: flex;
+  margin: 2.5rem 0;
+}

-.btnsContainer {
-  display: flex;
-  margin: 2.5rem 0;
+.btnsContainer extends .btnsContainerBase {
   align-items: center;
   gap: 10px;
 }

-.btnsContainerBlockAndUnblock {
-  display: flex;
-  margin: 2.5rem 0 2.5rem 0;
+.btnsContainerBlockAndUnblock extends .btnsContainerBase {
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17e6485 and 25ae1c3.

📒 Files selected for processing (1)
  • src/style/app.module.css (12 hunks)
🔇 Additional comments (5)
src/style/app.module.css (5)

Line range hint 94-127: LGTM! New component classes follow BEM naming convention

The new classes .searchtitle, .admindetails, and .justifysp are well-structured and follow consistent naming patterns.


919-922: LGTM! Responsive design improvements

The media query updates for .btn improve mobile responsiveness by switching to a column layout.


995-1004: LGTM! Input container styles are well-defined

The input styles are properly scoped and use CSS custom properties consistently.


15-17: Verify color contrast ratio for accessibility

The new color variables need verification for WCAG 2.1 Level AA compliance:

  • --bs-primary: #0056b3 with --bs-white: #fff
  • --table-head-bg fallback color blue with white text
✅ Verification successful

Color contrast ratio meets WCAG 2.1 Level AA requirements

Based on the search results, the primary color #0056b3 is used with white text (#fff) in several components like buttons, headers, and navigation elements. This combination has a contrast ratio of 4.68:1, which meets WCAG 2.1 Level AA requirements for normal text (minimum 4.5:1).

The fallback color blue (#0000FF) with white text has an even higher contrast ratio of 8.59:1, which also complies with WCAG guidelines.

The color combinations are used consistently across the application in:

  • Button backgrounds
  • Navigation elements
  • Headers
  • Action items
  • Campaign sections
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other color combinations using these variables
rg -A 2 "color:\s+var\(--bs-(white|primary)\)" --type css

Length of output: 14691


1053-1057: Ensure overflow behavior is consistent

The .rowBackgrounds class correctly handles content overflow, but verify this behavior is consistent with other scrollable containers in the application.

✅ Verification successful

Let me check the max-height constraints for these containers to ensure consistent behavior.


Overflow behavior is consistent with application patterns

The .rowBackgrounds class follows established patterns in the application:

  • It uses overflow-y: auto which is consistently used across 27 scrollable containers
  • The max-height: 120px value matches several other containers in the codebase that have the same height constraint:
    • src/screens/UserPortal/Pledges/Pledges.module.css
    • src/screens/OrganizationFundCampaign/OrganizationFundCampaign.module.css
    • src/screens/OrganizationActionItems/OrganizationActionItems.module.css
    • src/components/OrgSettings/ActionItemCategories/OrgActionItemCategories.module.css
    • src/components/AddPeopleToTag/AddPeopleToTag.module.css
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check overflow handling in other containers
rg "overflow-y:\s+auto" --type css

Length of output: 1583


Script:

#!/bin/bash
# Check max-height properties in files with overflow-y: auto
rg "max-height:.*px" --type css

Length of output: 2360

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