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: add subTags UI (GSoC) #2196

Merged
merged 6 commits into from
Aug 21, 2024
Merged

Conversation

meetulr
Copy link
Contributor

@meetulr meetulr commented Aug 18, 2024

What kind of change does this PR introduce?

Implements SubTags UI.

Issue Number:

Fixes #2195

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

Snapshots/videos

subTags.mp4

Additional Context

Previous PR: #2185

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a new route for managing sub-tags, enhancing navigation within the application.
    • Added a comprehensive SubTags component for viewing, adding, and removing sub-tags.
    • Implemented pagination for sub-tags display.
    • Enhanced error handling and user feedback through notifications for tag operations.
  • Styling Improvements

    • New CSS classes for improved styling of error messages and tag UI components.
    • Added responsive design elements to ensure a better user experience across devices.
  • Bug Fixes

    • Updated routing paths for clarity and consistency in navigation within the application.

Copy link
Contributor

coderabbitai bot commented Aug 18, 2024

Walkthrough

The changes implement a user-friendly interface for managing sub-tags within the organizational tagging system. This enhancement includes new routes for navigation, refined methods for navigating between tags, improved error handling styles, and a comprehensive test suite. The modifications aim to streamline user interactions with tags and subtags, resulting in a more intuitive experience in the admin interface.

Changes

Files Change Summary
src/App.tsx, src/GraphQl/Queries/userTagQueries.ts Added a new route for SubTags, improving navigation capabilities, and renamed a GraphQL query constant for enhanced clarity.
src/screens/ManageTag/*.tsx, src/screens/ManageTag/*.test.tsx Updated routing paths to improve clarity and consistency, and renamed navigation functions for better purpose alignment.
src/screens/ManageTag/ManageTag.module.css, src/screens/OrganizationTags/OrganizationTags.module.css, src/screens/SubTags/SubTags.module.css Introduced new CSS classes for enhanced error handling and improved styling of UI components related to tag management.
src/screens/SubTags/*.tsx Created a new SubTags component for managing sub-tags with GraphQL integration, which improves user interaction and functionality.
src/utils/interfaces.ts Introduced new TypeScript interfaces to enhance the organization and clarity of data structures in the codebase.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant SubTags
    participant GraphQL

    User->>App: Navigate to SubTags
    App->>SubTags: Render SubTags component
    SubTags->>GraphQL: Fetch sub-tags data
    GraphQL-->>SubTags: Return sub-tags data
    SubTags-->>User: Display sub-tags
    User->>SubTags: Add or remove sub-tag
    SubTags->>GraphQL: Send mutation for sub-tag
    GraphQL-->>SubTags: Return success/failure
    SubTags-->>User: Show feedback message
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement SubTags UI (GSoC) (#2195)
Add options to go to the subTags of a given tag
Improve user navigation and interaction
Enhance error handling and user feedback

Poem

🐰 In fields of tags, we hop and play,
New sub-tags bloom, in bright array.
With routes that guide, and styles that sing,
Managing tags is a joyous thing!
Let's leap with joy, our work's been done,
A brighter UI for everyone! 🌼


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

Outside diff range, codebase verification and nitpick comments (1)
src/screens/OrganizationTags/OrganizationTags.tsx (1)

41-44: Inconsistent border-radius styling detected.

The border-radius value of 0.1rem used in OrganizationTags.tsx is not consistent with the more common values found throughout the codebase, such as 5px, 10px, 16px, and 50%. This inconsistency could affect the visual design language of the application.

  • Consider aligning the border-radius value with the more commonly used values to maintain visual consistency.
Analysis chain

Styling adjustments for DataGrid.

The reduced border radius may affect the visual consistency. Ensure it aligns with the overall design language.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of DataGrid styling across the application.

# Test: Search for DataGrid styling definitions. Expect: Consistent use of border radius.
rg --type css --type tsx 'border-radius'

Length of output: 68


Script:

#!/bin/bash
# Find all .tsx files and search for 'border-radius'
fd --extension tsx --exec rg 'border-radius' {}

# Search for 'border-radius' in .css files
rg --type css 'border-radius'

Length of output: 37090

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 47bdf2b and eec2036.

Files selected for processing (13)
  • src/App.tsx (2 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 (2 hunks)
  • src/screens/OrganizationTags/OrganizationTags.module.css (1 hunks)
  • src/screens/OrganizationTags/OrganizationTags.test.tsx (1 hunks)
  • src/screens/OrganizationTags/OrganizationTags.tsx (6 hunks)
  • src/screens/SubTags/SubTags.module.css (1 hunks)
  • src/screens/SubTags/SubTags.test.tsx (1 hunks)
  • src/screens/SubTags/SubTags.tsx (1 hunks)
  • src/screens/SubTags/SubTagsMocks.ts (1 hunks)
  • src/utils/interfaces.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • src/GraphQl/Queries/userTagQueries.ts
  • src/screens/OrganizationTags/OrganizationTags.module.css
Additional comments not posted (34)
src/screens/ManageTag/ManageTag.module.css (3)

81-83: Ensure Consistent Styling.

The .errorContainer class sets a minimum height of 100vh, which ensures that the error display occupies the full viewport height. This is a good practice for full-page error messages.


85-91: Center Error Message Content.

The .errorMessage class centers its content both vertically and horizontally. This layout is effective for displaying error messages prominently.


93-97: Scale and Style Error Icon.

The .errorIcon class scales the icon and applies a danger color. This visually emphasizes the error state effectively.

src/screens/SubTags/SubTags.module.css (3)

1-4: Flexbox Layout for Buttons.

The .btnsContainer class uses flexbox for layout, which is a standard approach for responsive design.


81-83: Ensure Full-Height Error Display.

The .errorContainer class ensures the error display occupies the full viewport height, similar to the previous file.


109-113: Clickable SubTags Link.

The .subTagsLink class styles links for sub-tags, making them visually distinct and interactive.

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

66-66: Update Route Path for SubTags.

The path change from /orgtagChildTags/:tagId to /subtags/:tagId aligns with the new sub-tags feature, improving semantic clarity.

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

87-87: Update Route Path Consistency.

The route path has been updated to /orgtags/:orgId/subtags/:tagId. Ensure that all related components and tests reflect this change for consistency across the application.

src/App.tsx (2)

25-25: Import SubTags Component.

The SubTags component is now imported, which aligns with the new functionality for managing subtags. Ensure the component is correctly implemented and tested.


156-156: Add SubTags Route.

The new route orgtags/:orgId/subtags/:tagId has been added for the SubTags component. This enhances the application's routing for tag management. Verify that this route is correctly integrated with the rest of the application.

src/screens/SubTags/SubTags.test.tsx (1)

1-325: Comprehensive Test Coverage for SubTags Component.

The test suite for the SubTags component is comprehensive and covers various scenarios, including rendering, navigation, and CRUD operations. Ensure that all edge cases are tested and that the tests are reliable and maintainable.

src/screens/SubTags/SubTagsMocks.ts (4)

1-8: Good use of imports for GraphQL operations.

The imports for mutations and queries are well-organized and relevant to the mock data being set up.


10-344: Comprehensive mock data setup.

The mock data covers various scenarios, including pagination and different query results. This is beneficial for testing the UI interactions with the GraphQL API.


347-374: Effective error simulation for testing.

The error mock for USER_TAG_SUB_TAGS and USER_TAG_ANCESTORS queries is a good practice to ensure error handling in the UI is tested.


376-415: Thorough error case coverage.

The additional error mock for USER_TAG_ANCESTORS ensures robustness in testing error scenarios.

src/utils/interfaces.ts (3)

207-228: Introduction of InterfaceTagData improves modularity.

The new InterfaceTagData interface encapsulates tag-related data, promoting reusability and reducing redundancy.


230-231: Refactoring to use InterfaceTagData.

The InterfaceQueryOrganizationUserTags now uses InterfaceTagData, which simplifies the structure and enhances consistency.


254-257: New interface InterfaceQueryUserTagChildTags.

This interface provides a clear structure for querying child tags, utilizing the modular InterfaceTagData.

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

5-5: Addition of IconComponent for enhanced UI.

The import and usage of IconComponent contribute to a more visually appealing UI.


188-188: Renaming handler improves clarity.

The function name goToManageTag is more descriptive than handleClick, enhancing code readability.


192-194: New navigation function for sub-tags.

The goToSubTags function adds intuitive navigation to sub-tags, improving user interaction.


223-227: Clickable tag names for navigation.

The onClick handler on tag names provides direct navigation to sub-tags, enhancing usability.


369-381: Breadcrumb-like navigation enhances UX.

The breadcrumb-like component with IconComponent improves navigation clarity and user experience.


382-408: DataGrid configuration maintains functionality.

The DataGrid setup remains effective, with enhancements for no-row overlays and row class names.

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

169-169: URL Simplification Approved.

The updated URL structure in goToSubTags improves readability and maintainability.


172-172: Function Renaming Approved.

Renaming handleClick to goToManageTag clarifies the function's purpose and improves readability.


355-355: Consistent Function Naming Approved.

The use of goToManageTag in the JSX ensures consistency with the function renaming.

src/screens/SubTags/SubTags.tsx (7)

1-28: Import Statements Approved.

The imports are well-organized and relevant to the functionality of the SubTags component.


51-73: Function Setup Approved.

The SubTags function is well-structured, with clear separation of concerns for state management and data fetching.


128-175: Add and Remove Functions Approved.

The addSubTag and handleRemoveUserTag functions are implemented correctly with proper async/await usage and error handling.


181-193: Pagination Handlers Approved.

The handleNextPage and handlePreviousPage functions correctly manage pagination state.


195-211: Error Handling Approved.

The error handling provides user feedback and logs errors, which is a good practice.


346-584: JSX Structure Approved.

The JSX structure is well-organized and follows best practices for component design.


586-587: Export Statement Approved.

The export statement is correct for the SubTags component.

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

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.59%. Comparing base (989b154) to head (2836569).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2196      +/-   ##
===========================================
+ Coverage    97.55%   97.59%   +0.04%     
===========================================
  Files          244      247       +3     
  Lines         6939     7036      +97     
  Branches      1999     2000       +1     
===========================================
+ Hits          6769     6867      +98     
+ Misses         155      154       -1     
  Partials        15       15              

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

@meetulr
Copy link
Contributor Author

meetulr commented Aug 18, 2024

@coderabbitai review please

Copy link
Contributor

coderabbitai bot commented Aug 18, 2024

@meetulr: I will review the changes in the pull request now.

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between eec2036 and 72f9271.

Files selected for processing (2)
  • src/screens/OrganizationTags/OrganizationTags.test.tsx (2 hunks)
  • src/screens/OrganizationTags/OrganizationTags.tsx (6 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/screens/OrganizationTags/OrganizationTags.test.tsx
  • src/screens/OrganizationTags/OrganizationTags.tsx

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 18, 2024
@palisadoes
Copy link
Contributor

@beingnoble03 @rishav-jha-mech @Nitya-Pasrija Please review

Copy link
Member

@beingnoble03 beingnoble03 left a comment

Choose a reason for hiding this comment

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

@meetulr rest looks good. Please address the comments.

src/screens/ManageTag/ManageTag.tsx Outdated Show resolved Hide resolved
src/screens/ManageTag/ManageTag.tsx Outdated Show resolved Hide resolved
src/screens/SubTags/SubTags.tsx Outdated Show resolved Hide resolved
src/screens/SubTags/SubTags.tsx Outdated Show resolved Hide resolved
src/screens/SubTags/SubTags.tsx 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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 72f9271 and 14d883d.

Files selected for processing (6)
  • src/screens/ManageTag/ManageTag.test.tsx (2 hunks)
  • src/screens/ManageTag/ManageTag.tsx (9 hunks)
  • src/screens/OrganizationTags/OrganizationTags.tsx (14 hunks)
  • src/screens/SubTags/SubTags.test.tsx (1 hunks)
  • src/screens/SubTags/SubTags.tsx (1 hunks)
  • src/utils/organizationTagsUtils.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/utils/organizationTagsUtils.ts
Files skipped from review as they are similar to previous changes (5)
  • src/screens/ManageTag/ManageTag.test.tsx
  • src/screens/ManageTag/ManageTag.tsx
  • src/screens/OrganizationTags/OrganizationTags.tsx
  • src/screens/SubTags/SubTags.test.tsx
  • src/screens/SubTags/SubTags.tsx

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 21, 2024
@meetulr meetulr requested a review from beingnoble03 August 21, 2024 14:07
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 14d883d and 2836569.

Files selected for processing (4)
  • src/GraphQl/Queries/userTagQueries.ts (3 hunks)
  • src/screens/ManageTag/ManageTag.tsx (9 hunks)
  • src/screens/OrganizationTags/OrganizationTags.tsx (14 hunks)
  • src/screens/SubTags/SubTags.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • src/GraphQl/Queries/userTagQueries.ts
  • src/screens/ManageTag/ManageTag.tsx
  • src/screens/OrganizationTags/OrganizationTags.tsx
  • src/screens/SubTags/SubTags.tsx

Copy link
Member

@beingnoble03 beingnoble03 left a comment

Choose a reason for hiding this comment

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

@palisadoes this needs one more approval. Would lean on other maintainers for another look.

@palisadoes palisadoes merged commit 968c284 into PalisadoesFoundation:develop Aug 21, 2024
12 checks passed
@meetulr meetulr deleted the subtags branch August 22, 2024 06:37
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