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

[WEB-2294] fix: remove 'Add Project' button from archives route and remove it from the dropdown in header #5469

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

sharma01ketan
Copy link
Collaborator

@sharma01ketan sharma01ketan commented Aug 29, 2024

Changes:

Previous State:
image

New State:
image

image image image

Reference:

[WEB-2294]

Summary by CodeRabbit

  • New Features

    • Removed the option to filter archived projects from the project filtering interface.
    • Enhanced the logic for displaying applied filters to exclude archived projects, improving clarity in the user interface.
  • Bug Fixes

    • Adjusted button visibility in the project header to ensure it only appears for authorized users viewing active projects, enhancing user experience.
  • Style

    • Improved the clarity of the message displayed when no projects match the search criteria.

Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Walkthrough

The changes involve modifications to the project filtering and header components in the application. The ProjectFiltersSelection component has removed the option to filter archived projects, while the ProjectsBaseHeader now conditionally renders a button based on whether the project is archived. Additionally, the Root component has refined the logic for displaying applied filters, ensuring that filters related to archived projects are excluded from the display.

Changes

Files Change Summary
web/core/components/project/dropdowns/filters/root.tsx
web/core/components/project/header.tsx
web/core/components/project/root.tsx
Removed the FilterOption for archived projects, adjusted button visibility based on project state, and refined filter display logic to exclude archived projects.
web/core/components/project/card-list.tsx Updated the message displayed when no projects match search criteria for clarity.

Poem

🐰 In the meadow where projects play,
Archived ones have gone away.
Buttons shine for those who dare,
To filter fresh with joyful flair.
Hooray for changes, bright and new,
A hop, a skip, let's filter through! 🌼✨


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

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.

@sharma01ketan sharma01ketan self-assigned this Aug 29, 2024
@sharma01ketan sharma01ketan added 🐛bug Something isn't working 🌐frontend labels Aug 29, 2024
@sharma01ketan sharma01ketan added this to the v0.23-dev milestone Aug 29, 2024
@gakshita gakshita marked this pull request as ready for review August 30, 2024 07:04
<div className="border-b border-custom-border-200 px-5 py-3">
<ProjectAppliedFiltersList
appliedFilters={currentWorkspaceFilters ?? {}}
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters ?? []}
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters?.filter(filter => filter !== "archived_projects") ?? []}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Define a variable for this and use that variable only in lines 72-74 to just check the length

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6930855 and ee9bb5c.

Files selected for processing (3)
  • web/core/components/project/dropdowns/filters/root.tsx (1 hunks)
  • web/core/components/project/header.tsx (1 hunks)
  • web/core/components/project/root.tsx (1 hunks)
Additional comments not posted (3)
web/core/components/project/root.tsx (1)

78-78: Correct implementation of filter exclusion.

The implementation correctly filters out "archived_projects" from the displayed filters, aligning with the PR objectives to streamline the user interface.

The code changes are approved.

web/core/components/project/dropdowns/filters/root.tsx (1)

Line range hint 1-50: Approval of Changes in ProjectFiltersSelection Component

The removal of the FilterOption for archived projects, as described in the summary, aligns with the PR objectives to streamline the interface. The remaining implementation of the component appears correct and well-structured.

web/core/components/project/header.tsx (1)

180-180: Approval of Changes in ProjectsBaseHeader Component

The addition of the !isArchived condition to the button rendering logic is a thoughtful change that aligns with the PR objectives to streamline interactions within archived projects. The overall implementation of the component remains robust and well-structured.

Comment on lines 72 to 74
(currentWorkspaceAppliedDisplayFilters?.length !== 0 &&
!(currentWorkspaceAppliedDisplayFilters?.length==1 &&
!(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))) && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Refine conditional rendering logic for clarity.

The updated condition effectively prevents the display of the filter section when only "archived_projects" is present. However, the logic can be simplified for better readability and maintainability.

Consider refactoring the condition to use more descriptive variable names or decompose it into smaller, more readable conditions. Here's a suggested refactor:

- (currentWorkspaceAppliedDisplayFilters?.length !== 0 &&
-  !(currentWorkspaceAppliedDisplayFilters?.length==1 && 
-    !(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))
+ const isOnlyArchived = currentWorkspaceAppliedDisplayFilters?.length === 1 && currentWorkspaceAppliedDisplayFilters.includes("archived_projects");
+ (currentWorkspaceAppliedDisplayFilters?.length !== 0 && !isOnlyArchived)
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(currentWorkspaceAppliedDisplayFilters?.length !== 0 &&
!(currentWorkspaceAppliedDisplayFilters?.length==1 &&
!(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))) && (
const isOnlyArchived = currentWorkspaceAppliedDisplayFilters?.length === 1 && currentWorkspaceAppliedDisplayFilters.includes("archived_projects");
(currentWorkspaceAppliedDisplayFilters?.length !== 0 && !isOnlyArchived) && (

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ee9bb5c and 965b9ac.

Files selected for processing (1)
  • web/core/components/project/root.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/core/components/project/root.tsx

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 965b9ac and a725131.

Files selected for processing (2)
  • web/core/components/project/card-list.tsx (1 hunks)
  • web/core/components/project/root.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
  • web/core/components/project/card-list.tsx
Additional comments not posted (5)
web/core/components/project/root.tsx (5)

33-34: Simplify the isArchived check.

The current implementation of isArchived is straightforward and correctly checks if the pathname includes "/archives". This is a clean and efficient way to determine the archived status.

The code changes are approved.


35-38: Refine the filtering logic for display filters.

The logic to exclude "archived_projects" from allowedDisplayFilters is implemented correctly. This ensures that archived projects are not displayed inappropriately, aligning with the PR's objectives to streamline the UI.

The code changes are approved.


64-64: Ensure consistent filter updates for archived projects.

The conditional update of display filters based on isArchived status within handleClearAllFilters is a smart way to manage the state dynamically. This ensures that the filter state reflects the current UI context, which is crucial for maintaining a consistent user experience.

The code changes are approved.


68-69: Optimize the useEffect hook for updating display filters.

The use of a ternary operator to conditionally update display filters based on the isArchived status is a clean and efficient approach. This minimizes unnecessary updates and ensures that the filters are correctly set based on the current route.

The code changes are approved.


77-81: Validate the condition for displaying the filter section.

The condition to display the filter section only when there are allowed display filters or non-zero total filters is a good practice. It prevents the display of an empty or irrelevant filter section, enhancing the user interface by showing only pertinent information.

The code changes are approved.

@sharma01ketan sharma01ketan requested a review from gakshita August 30, 2024 09:29
@pushya22 pushya22 merged commit 2e890e4 into preview Aug 30, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants