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

Figma: People Page Violates The Figma Style Guide #3408

Conversation

abhassen44
Copy link

@abhassen44 abhassen44 commented Jan 24, 2025

What kind of change does this PR introduce?

bugfix, feature, refactoring

Issue Number:

Fixes #3171

Snapshots/Videos:

Screenshot 2025-01-24 171342

If relevant, did you update the documentation?

no

Summary

it refactor mainly OraganisationPeople.tsx

Does this PR introduce a breaking change?

no

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Have you read the contributing guide?
Yes

Summary by CodeRabbit

Release Notes

  • New Features

    • Added sorting options for users in Organization People view.
    • Enhanced modal management for adding new members.
  • UI/UX Improvements

    • Updated button colors and styles.
    • Refined DataGrid appearance and interactions.
    • Modified color schemes for various UI components.
  • Style Changes

    • Introduced new CSS variables for consistent theming.
    • Updated color palette for buttons and hover states.
    • Adjusted font weights and color schemes.
  • Performance

    • Simplified modal state management with custom hook.

Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Walkthrough

This pull request focuses on updating the styling for buttons and CSS variables across multiple files. The changes primarily involve modifying color schemes in CSS files, specifically targeting the .btn-danger class and introducing new color variables. The modifications aim to improve visual consistency and adhere to the Figma style guide by consolidating CSS variables and removing hardcoded color references.

Changes

File Change Summary
src/assets/css/app.css Updated .btn-danger class color variables for button text, background, and hover states
src/screens/OrganizationPeople/AddMember.tsx Refactored modal state management using a custom useModal hook and updated type definitions
src/screens/OrganizationPeople/OrganizationPeople.tsx Updated imports, sorting functionality, and DataGrid styling
src/style/app.module.css Added new color variables, updated existing variables, and modified class styles

Assessment against linked issues

Objective Addressed Explanation
Consolidate CSS into src/style/app.module.css
Remove HTML color codes except in app.module.css
Use variable names describing color function
Buttons have shadows only on hover

Possibly related issues

Possibly related PRs

Suggested reviewers

  • palisadoes

Poem

🐰 Styling rabbits hop with glee,
Colors dancing, CSS so free!
Variables bloom like spring's delight,
Buttons gleaming, colors just right!
A code garden, neat and bright! 🎨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ea6cb5d and b36673b.

📒 Files selected for processing (1)
  • src/style/app.module.css (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (5)
src/style/app.module.css (5)

85-85: LGTM! CSS variables improve maintainability.

The new color variables enhance code maintainability and align with the Figma style guide:

  • --org-people-hover-blue: Light blue shade for hover states
  • --delete-theme-color: Bootstrap's danger color
  • --close-button-bg: Light red shade for close buttons

Also applies to: 95-95, 98-98


792-794: LGTM! Input field styles enhance visual consistency.

The styles provide a clean and consistent appearance for input fields with appropriate spacing and subtle depth.


817-824: LGTM! Search button styles ensure proper alignment.

The styles provide correct positioning and layering for search buttons within their containers.


895-895: LGTM! Remove button border uses theme color consistently.

The border color now uses the delete theme variable, maintaining consistency across delete/remove actions.


1805-1805: LGTM! Text color update improves consistency.

The text color now uses the standard black color variable, maintaining consistency across the application.


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

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Project coverage is 6.30%. Comparing base (da20828) to head (b36673b).
Report is 15 commits behind head on develop-postgres.

Files with missing lines Patch % Lines
src/screens/OrganizationPeople/AddMember.tsx 0.00% 8 Missing ⚠️
.../screens/OrganizationPeople/OrganizationPeople.tsx 0.00% 8 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           develop-postgres   #3408      +/-   ##
===================================================
- Coverage              6.31%   6.30%   -0.01%     
===================================================
  Files                   315     315              
  Lines                  8270    8274       +4     
  Branches               1859    1856       -3     
===================================================
  Hits                    522     522              
- Misses                 7688    7692       +4     
  Partials                 60      60              
Flag Coverage Δ
jest 6.30% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🧹 Nitpick comments (3)
src/screens/OrganizationPeople/OrganizationPeople.tsx (1)

452-453: Cell borders removed.
Eliminating cell borders can enhance the modern feel, but watch out for large data sets where visuals may blur row boundaries.

src/screens/OrganizationPeople/AddMember.tsx (2)

451-451: Modal header style.
Consider verifying that the new class name .createUserModalHeader is well-documented or tested, if relevant.


554-561: Button styling for user creation.
The inline style overrides are permissible but might be better consolidated into the global CSS to keep styling consistent.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4eede and 6924b47.

📒 Files selected for processing (4)
  • src/assets/css/app.css (1 hunks)
  • src/screens/OrganizationPeople/AddMember.tsx (13 hunks)
  • src/screens/OrganizationPeople/OrganizationPeople.tsx (7 hunks)
  • src/style/app.module.css (5 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
src/screens/OrganizationPeople/AddMember.tsx

[warning] 113-116: src/screens/OrganizationPeople/AddMember.tsx#L113-L116
Added lines #L113 - L116 were not covered by tests


[warning] 118-118: src/screens/OrganizationPeople/AddMember.tsx#L118
Added line #L118 was not covered by tests


[warning] 124-124: src/screens/OrganizationPeople/AddMember.tsx#L124
Added line #L124 was not covered by tests


[warning] 142-142: src/screens/OrganizationPeople/AddMember.tsx#L142
Added line #L142 was not covered by tests

src/screens/OrganizationPeople/OrganizationPeople.tsx

[warning] 42-42: src/screens/OrganizationPeople/OrganizationPeople.tsx#L42
Added line #L42 was not covered by tests


[warning] 188-190: src/screens/OrganizationPeople/OrganizationPeople.tsx#L188-L190
Added lines #L188 - L190 were not covered by tests


[warning] 375-375: src/screens/OrganizationPeople/OrganizationPeople.tsx#L375
Added line #L375 was not covered by tests


[warning] 389-389: src/screens/OrganizationPeople/OrganizationPeople.tsx#L389
Added line #L389 was not covered by tests


[warning] 403-403: src/screens/OrganizationPeople/OrganizationPeople.tsx#L403
Added line #L403 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (22)
src/screens/OrganizationPeople/OrganizationPeople.tsx (9)

22-23: Imports look clean and purposeful.
No concerns here; these imports replace or supplement prior solutions neatly and make the code more self-contained.


178-192: Validate row numbering for paginated data.
This new column logic seems correct for local sorting, but be mindful if you move to server-side pagination, as row indices can become ambiguous. Also note lines 188-190 aren't covered by tests.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 188-190: src/screens/OrganizationPeople/OrganizationPeople.tsx#L188-L190
Added lines #L188 - L190 were not covered by tests


201-201: Profile image cell uses correct class name.
Looks consistent with the rest of the styling approach.


349-349: Confirm the test selector.
The data-testid="searchbtn" attribute is clear. Ensure you have a matching test to validate search button behavior.


356-410: Dropdown-based sorting approach is workable; consider removing defaultChecked.
Using defaultChecked on <Dropdown.Item> is unconventional. Rely on the state to indicate active selection or integrate a highlighted class instead. Also, lines 375, 389, and 403 are flagged as uncovered by tests.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 375-375: src/screens/OrganizationPeople/OrganizationPeople.tsx#L375
Added line #L375 was not covered by tests


[warning] 389-389: src/screens/OrganizationPeople/OrganizationPeople.tsx#L389
Added line #L389 was not covered by tests


[warning] 403-403: src/screens/OrganizationPeople/OrganizationPeople.tsx#L403
Added line #L403 was not covered by tests


418-420: Ensure data presence checks.
When switching between memberData, adminFilteredData, and usersData, guard against potential undefined objects. Otherwise, the condition is sound for controlling the DataGrid display.


439-459: DataGrid styling is consistent with Figma guidelines.
This lines up well with the Figma style guide, especially removing row borders and applying a custom hover color.


455-459: New hover color from CSS variable.
Applying var(--org-people-hover-blue) keeps the table theming consistent.


42-42: Add test coverage for extracting orgId from URL.
Line 42 is not covered by tests per static analysis. Consider adding a test that ensures orgId is successfully retrieved and used.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 42-42: src/screens/OrganizationPeople/OrganizationPeople.tsx#L42
Added line #L42 was not covered by tests

src/screens/OrganizationPeople/AddMember.tsx (8)

2-2: Added new icon import for searching.
Please confirm that the places using <Search /> are tested so coverage for line #2 isn't flagged.


107-119: Custom hook useModal is a clean abstraction.
This is a strong approach for reusability. Add test coverage around open/close transitions and initial state handling.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 113-116: src/screens/OrganizationPeople/AddMember.tsx#L113-L116
Added lines #L113 - L116 were not covered by tests


[warning] 118-118: src/screens/OrganizationPeople/AddMember.tsx#L118
Added line #L118 was not covered by tests


120-124: Destructured modal logic looks good.
No immediate issues, but be cautious about passing these modal handlers around. Consider verifying if any child components require stronger type definitions.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 124-124: src/screens/OrganizationPeople/AddMember.tsx#L124
Added line #L124 was not covered by tests


142-142: Confirm orgId usage is covered by tests.
Line 142 is flagged as uncovered code. Add a simple test verifying that AddMember properly reads the URL param.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 142-142: src/screens/OrganizationPeople/AddMember.tsx#L142
Added line #L142 was not covered by tests


365-368: Translation for column headers is consistent.
Using translateOrgPeople aligns with the rest of the file. No concerns here.


410-410: Clear, descriptive link class name.
.membername plus .subtleBlueGrey fosters a uniform style. Looks good.


449-449: Closing the modal with closeCreateNewUserModal.
This direct approach is more explicit than toggling. Nice improvement for clarity.


Line range hint 643-643: Sync border color with new delete theme variable.
Replacing any hardcoded color with var(--delete-theme-color) keeps the color scheme unified. Good move.

src/style/app.module.css (5)

86-86: New variable --org-people-hover-blue.
A consistent naming scheme with your existing custom properties. Nicely done.


96-96: Introduced --delete-theme-color.
Centralizing the “danger” or “delete” color is excellent for brand consistency and maintainability.


99-99: --close-button-bg updated to a direct color.
Confirm that removing the reference to var(--white-color) doesn’t break existing usage.


643-643: Applying var(--delete-theme-color) in .removeButton.
Harmonizes with the new variable. Good consistency.


1472-1472: .eventsAttended, .membername { color: var(--black-color); }
Aligns the text color with the updated design. Just ensure this doesn’t clash with any theme-related text color.

src/assets/css/app.css Show resolved Hide resolved
@palisadoes
Copy link
Contributor

  1. Please fix the failing test
  2. @dhanagopu will be reviewing

@palisadoes
Copy link
Contributor

Please fix the conflicting file

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)

98-100: Consider using CSS variable references for better maintainability.

Instead of using direct color values, consider referencing existing CSS variables:

-  --close-button-bg: #f8d6dc;
+  --close-button-bg: var(--delete-button-bg);

The new --input-text-color variable is well-placed and follows naming conventions.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6924b47 and ea6cb5d.

📒 Files selected for processing (1)
  • src/style/app.module.css (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (4)
src/style/app.module.css (4)

85-85: LGTM! New CSS variable follows naming conventions.

The new CSS variable --org-people-hover-blue is well-named and appropriately placed within the root variables section.


95-95: LGTM! New CSS variable consolidates the danger color.

The new CSS variable --delete-theme-color appropriately consolidates the Bootstrap danger color (#dc3545) for consistent usage across the application.


899-899: LGTM! Improved color consistency.

The change to use --delete-theme-color for the button border color improves consistency in the color system.


1809-1809: LGTM! Improved color consistency using theme variables.

The change to use --black-color for both .eventsAttended and .membername classes improves theme consistency.

@abhassen44
Copy link
Author

abhassen44 commented Jan 26, 2025

can you guild me how to fix test application
i think its not because of my changes

@palisadoes
Copy link
Contributor

  1. Please merge your code with the latest upstream
  2. Make a commit, the PR will be updated and the tests should be OK

@abhassen44
Copy link
Author

i merged with upstream

@abhassen44
Copy link
Author

what should i do now

@palisadoes
Copy link
Contributor

Please ask the #talawa-projects slack channel. We recently did a major update that could be affecting this.

@palisadoes
Copy link
Contributor

Please fix the conflicting file

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.

  1. Change requested:
    image
  2. Please fix the conflicting file

@palisadoes
Copy link
Contributor

  1. We have to close this.
  2. The conflicting file is most likely due to our extensive changes migrating from Admin using a MongoDB backend to PostgreSQL
  3. Please create a new branch based on the latest upstream and resubmit your PR

@palisadoes palisadoes closed this Jan 28, 2025
@abhassen44
Copy link
Author

Alright, I will review these changes and work on improving them. Could you please let me know which API branch is suitable for develop-postgres admin branch

@palisadoes
Copy link
Contributor

develop-postgres until further notice

@palisadoes
Copy link
Contributor

Please note my previous review above

@abhassen44
Copy link
Author

ok i keep in mind

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