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

feat: manage tags UI (GSoC) #2185

Merged
merged 8 commits into from
Aug 17, 2024

Conversation

meetulr
Copy link

@meetulr meetulr commented Aug 16, 2024

What kind of change does this PR introduce?

Implements Manage Tag Screen.

Issue Number:

Fixes #2184

Did you add tests for your changes?

Yes

Snapshots/Videos:

manage.Tags.mp4

Does this PR introduce a breaking change?

No

Additional Context

Previous PR: #2175

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive tag management interface for adding and unassigning users to tags.
    • Added support for tag management in multiple languages: English, French, Hindi, Spanish, and Chinese.
  • Bug Fixes

    • Updated routing paths for managing tags, enhancing user navigation and interaction.
  • Documentation

    • Enhanced user interface with detailed prompts and feedback related to tag management actions.
  • Tests

    • Implemented unit tests for the new manage tag component to ensure functionality and user interactions.
  • Style

    • Improved styling for the manage tag interface to enhance usability across devices.

Copy link

coderabbitai bot commented Aug 16, 2024

Walkthrough

The update enhances the application's tag management functionality, introducing a new ManageTag UI component along with corresponding GraphQL queries and mutations. It includes localized strings for tag management in multiple languages, improved routing for user interaction, and comprehensive unit tests for reliability. Overall, this implementation facilitates a more interactive and efficient user experience when handling tags.

Changes

Files Change Summary
public/locales/*.json Added new manageTag sections with localized strings for tag management in English, French, Hindi, Spanish, and Chinese.
src/App.tsx Adjusted routing by removing old tag detail components and adding a new route for ManageTag.
src/GraphQl/Mutations/TagMutations.ts Enabled UNASSIGN_USER_TAG and UPDATE_USER_TAG mutations by uncommenting code.
src/GraphQl/Queries/userTagQueries.ts Introduced new GraphQL queries for user tags: USER_TAGS_ASSIGNED_MEMBERS, USER_TAG_CHILD_TAGS, and USER_TAG_ANCESTORS.
src/screens/ManageTag/* Implemented the ManageTag component with CSS for styling, unit tests for functionality, and mock data for testing GraphQL queries.
src/screens/OrganizationTags/* Updated routes and test assertions to reflect the new tag management functionality.
src/utils/interfaces.ts Introduced new interface InterfaceQueryUserTagsAssignedMembers for structured user tag queries.

Assessment against linked issues

Objective Addressed Explanation
Implement Manage Tags UI (GSoC) (Issue #2184)
Add support for managing tags in the admin (Issue #2184)
Improve user interaction with tags (Issue #2184)

🐇 In the garden, tags grow tall,
A new UI to manage them all!
With colors bright and paths anew,
Each click brings joy, a better view!
So hop along and take your part,
Tag management made with love and heart! 🌸


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if 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. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

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

@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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a3c3555 and b6ef346.

Files selected for processing (15)
  • public/locales/en/translation.json (1 hunks)
  • public/locales/fr/translation.json (1 hunks)
  • public/locales/hi/translation.json (1 hunks)
  • public/locales/sp/translation.json (1 hunks)
  • public/locales/zh/translation.json (1 hunks)
  • src/App.tsx (2 hunks)
  • src/GraphQl/Mutations/TagMutations.ts (1 hunks)
  • src/GraphQl/Queries/userTagQueries.ts (1 hunks)
  • src/screens/ManageTag/ManageTag.module.css (1 hunks)
  • src/screens/ManageTag/ManageTag.test.tsx (1 hunks)
  • src/screens/ManageTag/ManageTag.tsx (1 hunks)
  • src/screens/ManageTag/ManageTagMocks.ts (1 hunks)
  • src/screens/OrganizationTags/OrganizationTags.test.tsx (2 hunks)
  • src/screens/OrganizationTags/OrganizationTags.tsx (1 hunks)
  • src/utils/interfaces.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/screens/ManageTag/ManageTag.module.css
Additional comments not posted (26)
src/GraphQl/Mutations/TagMutations.ts (4)

32-37: LGTM!

The comments for the UNASSIGN_USER_TAG mutation are clear and provide a good explanation of the parameters.


39-45: LGTM!

The UNASSIGN_USER_TAG mutation is correctly defined and ready for use.


47-52: LGTM!

The comments for the UPDATE_USER_TAG mutation are clear and provide a good explanation of the parameters.


54-60: LGTM!

The UPDATE_USER_TAG mutation is correctly defined and ready for use.

src/GraphQl/Queries/userTagQueries.ts (3)

1-36: LGTM!

The USER_TAGS_ASSIGNED_MEMBERS query is well-structured and includes pagination, which is essential for handling large datasets.


38-71: LGTM!

The USER_TAG_CHILD_TAGS query is well-structured and includes pagination. It effectively retrieves child tags and their associated data.


73-80: LGTM!

The USER_TAG_ANCESTORS query is straightforward and efficiently retrieves ancestor tags.

src/screens/ManageTag/ManageTagMocks.ts (3)

1-5: LGTM!

The imports for GraphQL queries and mutations are correctly set up for use in mocks.


7-219: LGTM!

The mock data for USER_TAGS_ASSIGNED_MEMBERS and USER_TAG_ANCESTORS queries, as well as the UNASSIGN_USER_TAG mutation, is comprehensive and well-structured.


222-245: LGTM!

The error mocks provide a good way to test error handling in the application.

src/screens/OrganizationTags/OrganizationTags.test.tsx (2)

62-63: Route path updated successfully.

The route path has been updated to /orgtags/:orgId/managetag/:tagId, reflecting the shift in functionality. Ensure that all test cases are aligned with this change.


165-165: Test case for navigation to manage tag page is correct.

The test case correctly verifies that the navigation to the manage tag page is functioning as expected.

src/screens/ManageTag/ManageTag.test.tsx (4)

1-23: Test setup and imports are appropriate.

The imports and setup for translations and mock links are appropriate for the tests being conducted.


51-64: Caching strategy is well-defined.

The InMemoryCache with a type policy for getUserTag is appropriately set up to handle data merging.


111-119: Test case for component loading is correct.

The test case correctly verifies that the ManageTag component loads as expected.


175-188: Test case for navigation to member's profile is correct.

The test case correctly verifies that navigation to the member's profile screen is functioning as expected.

src/App.tsx (2)

24-24: Import of ManageTag is correct.

The ManageTag component is correctly imported, aligning with the new routing logic.


152-154: New route for ManageTag is correctly defined.

The route orgtags/:orgId/managetag/:tagId is correctly integrated into the application's routing logic.

src/utils/interfaces.ts (1)

232-250: Interface addition looks good.

The InterfaceQueryUserTagsAssignedMembers interface is well-structured and follows TypeScript best practices. It includes all necessary properties for managing user tags and their assigned members.

src/screens/OrganizationTags/OrganizationTags.tsx (1)

188-188: Navigation path update is appropriate.

The change in the handleClick function to navigate to /orgtags/${currentUrl}/managetag/${tagId} aligns with the new functionality for managing tags. This enhances the user experience by directing users to the appropriate section for tag management.

src/screens/ManageTag/ManageTag.tsx (1)

1-524: Comprehensive component implementation.

The ManageTag component is well-structured and implements the required functionality for managing tag assignments effectively. Here are some observations:

  • State Management: The use of useState for managing local state is appropriate. Consider using a state management library if the state becomes more complex in the future.
  • Error Handling: Error handling is implemented using try-catch blocks and toast notifications, which is good for user feedback.
  • UI/UX: The component provides a clear interface for managing tags, with modals for adding and unassigning users. Ensure that all user interactions are intuitive.
  • Performance: The use of useQuery and useMutation hooks for data fetching and mutations is efficient. Ensure that the network requests are optimized for performance.
  • Accessibility: Consider adding ARIA attributes to improve accessibility, especially for modals and interactive elements.

Overall, the component adheres to React best practices and provides a solid foundation for managing tags.

public/locales/zh/translation.json (1)

221-232: Translations for manageTag added successfully.

The new translations for the manageTag section are well-structured and consistent with the existing format. Ensure that these entries are used correctly in the application.

public/locales/en/translation.json (1)

221-232: Translations for manageTag added successfully.

The new translations for the manageTag section are well-structured and consistent with the existing format. Ensure that these entries are used correctly in the application.

public/locales/hi/translation.json (1)

221-232: Translations for manageTag are well-implemented.

The translations for the manageTag section are accurate and consistent with the rest of the file. They effectively cover the necessary functionalities for managing tags in Hindi.

public/locales/fr/translation.json (1)

221-231: Translations look accurate and consistent.

The added French translations for the "manageTag" section are well-structured and align with the application's functionality. Ensure these keys are used correctly in the UI components.

public/locales/sp/translation.json (1)

315-325: Translations look accurate and consistent.

The added Spanish translations for the "manageTag" section are well-structured and align with the application's functionality. Ensure these keys are used correctly in the UI components.

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 16, 2024
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.60%. Comparing base (a3c3555) to head (efc5821).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2185      +/-   ##
===========================================
+ Coverage    97.57%   97.60%   +0.02%     
===========================================
  Files          241      244       +3     
  Lines         6857     6942      +85     
  Branches      1993     2000       +7     
===========================================
+ Hits          6691     6776      +85     
  Misses         151      151              
  Partials        15       15              

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

@rishav-jha-mech rishav-jha-mech self-requested a review August 16, 2024 05:47
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b6ef346 and efc5821.

Files selected for processing (3)
  • src/screens/ManageTag/ManageTag.test.tsx (1 hunks)
  • src/screens/ManageTag/ManageTag.tsx (1 hunks)
  • src/screens/ManageTag/ManageTagMocks.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/screens/ManageTag/ManageTag.test.tsx
  • src/screens/ManageTag/ManageTag.tsx
  • src/screens/ManageTag/ManageTagMocks.ts

Copy link
Contributor

@Nitya-Pasrija Nitya-Pasrija left a comment

Choose a reason for hiding this comment

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

Please update the UI so that all the fields are aligned accordingly
image

@meetulr
Copy link
Author

meetulr commented Aug 16, 2024

Please update the UI so that all the fields are aligned accordingly

That member profile screen is not associated with this issue, the view profile button just takes us to that existing screen. Do you want me to make changes there as part of this issue?

@Nitya-Pasrija
Copy link
Contributor

Please update the UI so that all the fields are aligned accordingly

That member profile screen is not associated with this issue, the view profile button just takes us to that existing screen. Do you want me to make changes there as part of this issue?

Yes, you can create a separate issue and link it up with this PR to address these changes as well

@Nitya-Pasrija
Copy link
Contributor

Nitya-Pasrija commented Aug 17, 2024

Please update the UI so that all the fields are aligned accordingly
image

@meetulr
As discussed via text, let's have this as a separate issue instead to align and rectify the minor UI fixes

@palisadoes palisadoes merged commit 0f78540 into PalisadoesFoundation:develop Aug 17, 2024
11 checks passed
@meetulr meetulr deleted the manageTagScreen branch August 18, 2024 15:07
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.

4 participants