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 FundCompaignPledge styles into global app.module.css #2706

Merged

Conversation

mandeepnh5
Copy link
Contributor

@mandeepnh5 mandeepnh5 commented Dec 22, 2024

What kind of change does this PR introduce?

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

Issue Number:

Fixes #2507

Did you add tests for your changes?

No

Summary

It is my second 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

    • Enhanced styling for the fundraising campaign pledge interface with numerous new CSS classes.
    • Improved error handling specific to pledge functionality.
  • Bug Fixes

    • Refined pledge error messages for better clarity.
  • Documentation

    • Updated component styling references to a new stylesheet for improved organization.
  • Chores

    • Removed the old CSS module related to the pledge component.

Copy link
Contributor

coderabbitai bot commented Dec 22, 2024

Warning

Rate limit exceeded

@mandeepnh5 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 95f23d4 and 7242230.

📒 Files selected for processing (1)
  • src/style/app.module.css (1 hunks)

Walkthrough

The pull request focuses on refactoring the CSS files in the src/screens/FundCampaignPledge directory. The primary changes involve deleting the FundCampaignPledge.module.css file and updating the related components to use styles from the global src/style/app.module.css file. This modification is part of a broader effort to streamline CSS files, improve UI/UX, and make the application more suitable for color-blind users.

Changes

File Change Summary
src/screens/FundCampaignPledge/FundCampaignPledge.module.css Deleted file containing comprehensive CSS styles for the fundraising campaign pledge interface
src/screens/FundCampaignPledge/FundCampaignPledge.tsx Updated import statement and class names to use global CSS file
src/screens/FundCampaignPledge/PledgeDeleteModal.tsx Updated import statement for styles
src/screens/FundCampaignPledge/PledgeModal.tsx Updated import statement and class names to use global CSS file
src/style/app.module.css Added multiple new CSS classes for pledge-related components and styling

Assessment against linked issues

Objective Addressed Explanation
Refactor CSS files in src/screens/FundCampaignPledge [#2507]
Merge CSS files into global CSS file
Delete original CSS files
Reference only global CSS file

Possibly related issues

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr

Suggested reviewers

  • palisadoes

Poem

🐰 Hop, hop, hooray! CSS is on its way,
Styles now centralized, no more disarray,
Global file shines bright, components align,
Pledge screens now sparkle, looking so fine!
A rabbit's design dance, clean and neat! 🎨


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

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 22, 2024
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: 3

🧹 Nitpick comments (1)
src/screens/FundCampaignPledge/FundCampaignPledge.tsx (1)

476-483: Consider accessibility improvements for search input

While the styling changes look good, consider adding ARIA labels for better accessibility.

Apply this enhancement:

 <Form.Control
   type="name"
   placeholder={t('searchPledger')}
   autoComplete="off"
   required
   className={styles.inputFieldPledge}
   value={searchTerm}
   onChange={(e) => setSearchTerm(e.target.value)}
   data-testid="searchPledger"
+  aria-label={t('searchPledger')}
 />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e84b98 and 8be933c.

📒 Files selected for processing (1)
  • src/screens/FundCampaignPledge/FundCampaignPledge.tsx (14 hunks)
🧰 Additional context used
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
src/screens/FundCampaignPledge/FundCampaignPledge.tsx

[failure] 210-210:
Property 'messagePledge' does not exist on type 'Error'.

🔇 Additional comments (2)
src/screens/FundCampaignPledge/FundCampaignPledge.tsx (2)

12-12: LGTM: Style import path updated correctly

The import statement has been updated to use the global styles from app.module.css, which aligns with the PR objective of consolidating styles.


502-502: LGTM: Consistent styling for table elements

The styling changes for dropdown, table rows, and images are consistent with the PR's objective of consolidating styles into the global CSS file.

Also applies to: 563-563, 613-613, 620-620

src/screens/FundCampaignPledge/FundCampaignPledge.tsx Outdated Show resolved Hide resolved
src/screens/FundCampaignPledge/FundCampaignPledge.tsx Outdated Show resolved Hide resolved
src/screens/FundCampaignPledge/FundCampaignPledge.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

Please fix the failing tests. Our test code coverage system will fail if any of these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. The code does not comply with our linting check or other related formatting requirements

Here are some steps to take:

  1. Click on the Details link for the tests to get an explanation of the cause(s)
  2. You may have to fix a test that is not related to this PR as in some rare cases we merge faulty test code. If this is the case, fix the test in this PR. Do not open another issue.

We do this to ensure the overall reliability of the code base is maintained. This is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Additional notes:

  1. Ensure that CodeRabbit.ai approves your work
  2. Please fix any conflicting files

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

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

688-700: Consolidate input styles and use CSS variables

The input and dropdown styles could be improved by:

  1. Using CSS variables for colors
  2. Consolidating with existing similar classes like .inputField and .dropdown
 .inputFieldPledge {
   background-color: white;
-  box-shadow: 0 1px 1px #31bb6b;
+  box-shadow: 0 1px 1px var(--bs-primary);
 }

 .dropdownPledge {
   background-color: white;
-  border: 1px solid #31bb6b;
+  border: 1px solid var(--bs-primary);
   position: relative;
   display: inline-block;
-  color: #31bb6b;
+  color: var(--bs-primary);
 }

730-741: Use CSS variables for consistent styling

The .pledgerContainer uses hardcoded colors and dimensions. Consider using CSS variables for better maintainability.

 .pledgerContainer {
   display: flex;
   align-items: center;
   justify-content: center;
   margin: 0.1rem 0.25rem;
   gap: 0.25rem;
   padding: 0.25rem 0.45rem;
   border-radius: 0.35rem;
-  background-color: #31bb6b33;
+  background-color: var(--bs-primary-light);
   height: 2.2rem;
   margin-top: 0.75rem;
 }

747-758: Consider using semantic class names

The .overviewContainer class could be made more reusable by using semantic class names that describe the component's purpose rather than its specific implementation.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8be933c and 7fd2a82.

📒 Files selected for processing (2)
  • src/screens/FundCampaignPledge/FundCampaignPledge.tsx (14 hunks)
  • src/style/app.module.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/FundCampaignPledge/FundCampaignPledge.tsx
🔇 Additional comments (3)
src/style/app.module.css (3)

611-623: LGTM: Container styles are clean and follow existing patterns

The container styles are well-structured and maintain consistency with the existing layout patterns.


701-717: LGTM: Table styles follow best practices

The table styles make good use of CSS variables and maintain consistency with existing patterns.


870-876: ⚠️ Potential issue

Fix incorrect attribute selector

The attribute selector for radio buttons is incorrect. It should be type='radio' instead of type='radioPledge'.

- input[type='radioPledge']:checked + label {
+ input[type='radio']:checked + label {
   background-color: #31bb6a50 !important;
 }

- input[type='radioPledge']:checked + label:hover {
+ input[type='radio']:checked + label:hover {
   color: black !important;
 }

Likely invalid or redundant comment.

src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
mandeepnh5 and others added 2 commits December 23, 2024 18:10
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 23, 2024
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

🔭 Outside diff range comments (2)
src/screens/FundCampaignPledge/FundCampaignPledge.tsx (2)

Line range hint 428-450: Fix radio button implementation inconsistencies.

There are two issues in the radio button implementation:

  1. Inconsistent use of btn-check class
  2. Missing type attribute value

Apply this diff to fix the issues:

-className={`btn-check ${styles.toggleBtnPledge}`}
+className="btn-check"

-type="radio"
+className="btn-check"

Line range hint 474-493: Improve search input accessibility.

The search implementation needs accessibility improvements:

  1. Add aria-label to the search button
  2. Add aria-hidden to the search icon

Apply these changes:

 <Button
   tabIndex={-1}
   className={`position-absolute z-10 bottom-0 end-0  d-flex justify-content-center align-items-center`}
   data-testid="searchBtn"
+  aria-label="Search pledgers"
 >
-  <Search />
+  <Search aria-hidden="true" />
 </Button>
🧹 Nitpick comments (1)
src/style/app.module.css (1)

713-784: Add responsive design for better mobile experience.

The overview and progress tracking components need responsive design improvements for better mobile display.

Add these media queries:

 .overviewContainer {
   display: flex;
   gap: 7rem;
   width: 100%;
   /* ... */
 }
+
+@media (max-width: 768px) {
+  .overviewContainer {
+    flex-direction: column;
+    gap: 2rem;
+    padding: 1rem;
+  }
+
+  .progressContainer {
+    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 7fd2a82 and ef7d9e2.

📒 Files selected for processing (3)
  • src/screens/FundCampaignPledge/FundCampaignPledge.tsx (7 hunks)
  • src/screens/FundCampaignPledge/PledgeModal.tsx (6 hunks)
  • src/style/app.module.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/FundCampaignPledge/PledgeModal.tsx
🔇 Additional comments (3)
src/screens/FundCampaignPledge/FundCampaignPledge.tsx (2)

12-12: LGTM! Style consolidation aligns with PR objectives.

The import statement has been updated to use the global app.module.css file, which aligns with the PR's goal of consolidating styles.


Line range hint 560-572: LGTM! DataGrid implementation is well structured.

The DataGrid implementation correctly uses:

  • Custom row styling
  • Proper data mapping
  • Appropriate height settings
src/style/app.module.css (1)

818-834: 🛠️ Refactor suggestion

Improve toggle button accessibility and consistency.

The toggle button styles need improvements:

  1. Use CSS variables for colors
  2. Add focus styles for keyboard navigation

Apply these changes:

 .toggleBtnPledge:hover {
-  color: #31bb6b !important;
+  color: var(--bs-primary) !important;
+}
+
+.toggleBtnPledge:focus-visible {
+  outline: 2px solid var(--bs-primary);
+  outline-offset: 2px;
 }

Likely invalid or redundant comment.

src/style/app.module.css Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 (4)
src/style/app.module.css (4)

611-623: Use CSS variables for consistent modal dimensions

Consider using the existing modal dimension variables for consistency:

 .pledgeModal {
-  max-width: 80vw;
+  max-width: var(--modal-max-width);
   margin-top: 2vh;
   margin-left: 13vw;
 }

688-722: Use CSS variables for colors and shadows

The styles use hardcoded RGBA colors and box shadow values instead of CSS variables.

 .overviewContainer {
-  background-color: rgba(255, 255, 255, 0.591);
+  background-color: var(--bs-white-rgb, 255, 255, 255, 0.591);
-  box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
+  box-shadow: var(--bs-box-shadow);
   border-radius: 0.5rem;
 }

724-782: Improve color consistency and style reusability

The title and progress styles use hardcoded colors that should be defined as CSS variables.

 .titleContainer h3 {
   font-size: 1.75rem;
   font-weight: 750;
-  color: #5e5e5e;
+  color: var(--bs-gray-700);
   margin-top: 0.2rem;
 }

 .titleContainer span {
   font-size: 0.9rem;
   margin-left: 0.5rem;
   font-weight: lighter;
-  color: #707070;
+  color: var(--bs-gray-600);
 }

784-833: Standardize UI component colors

The toggle button and popup styles use hardcoded colors instead of CSS variables.

 .toggleBtnPledge:hover {
-  color: #31bb6b !important;
+  color: var(--bs-primary) !important;
 }

 .popup {
   border-radius: 0.5rem;
   font-size: 0.875rem;
   margin-top: 0.5rem;
   padding: 0.75rem;
-  border: 1px solid #e2e8f0;
+  border: 1px solid var(--bs-gray-300);
   background-color: white;
-  color: #1e293b;
+  color: var(--bs-gray-900);
-  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 0.15);
+  box-shadow: var(--bs-box-shadow-lg);
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ef7d9e2 and 95f23d4.

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

625-667: 🛠️ Refactor suggestion

Consolidate duplicate button styles and use CSS variables

The .greenregbtnPledge class is nearly identical to the existing .greenregbtn class. Also, some styles use hardcoded colors instead of CSS variables.

 .inputFieldPledge {
   background-color: white;
-  box-shadow: 0 1px 1px #31bb6b;
+  box-shadow: 0 1px 1px var(--bs-primary);
 }

-/* Remove .greenregbtnPledge and use existing .greenregbtn class */
-.greenregbtnPledge {
-  margin-top: 15px;
-  border: 1px solid var(--bs-gray-300);
-  /* ... rest of the properties ... */
-}

Likely invalid or redundant comment.

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

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.08%. Comparing base (fd0fe5c) to head (7242230).
Report is 3 commits behind head on develop-postgres.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           develop-postgres    #2706       +/-   ##
=====================================================
+ Coverage             75.84%   87.08%   +11.24%     
=====================================================
  Files                   295      312       +17     
  Lines                  7289     8148      +859     
  Branches               1593     1840      +247     
=====================================================
+ Hits                   5528     7096     +1568     
+ Misses                 1497      875      -622     
+ Partials                264      177       -87     

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

@mandeepnh5
Copy link
Contributor Author

Please fix the failing tests. Our test code coverage system will fail if any of these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. The code does not comply with our linting check or other related formatting requirements

Here are some steps to take:

  1. Click on the Details link for the tests to get an explanation of the cause(s)
  2. You may have to fix a test that is not related to this PR as in some rare cases we merge faulty test code. If this is the case, fix the test in this PR. Do not open another issue.

We do this to ensure the overall reliability of the code base is maintained. This is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Additional notes:

  1. Ensure that CodeRabbit.ai approves your work
  2. Please fix any conflicting files

@palisadoes I have fixed everything now please check

@palisadoes palisadoes self-requested a review December 23, 2024 17:24
@palisadoes palisadoes merged commit 86d59c2 into PalisadoesFoundation:develop-postgres Dec 23, 2024
13 checks passed
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