-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[WEB-2294] fix: remove 'Add Project' button from archives route and remove it from the dropdown in header #5469
Conversation
…om the dropdown in header
WalkthroughThe changes involve modifications to the project filtering and header components in the application. The Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
web/core/components/project/root.tsx
Outdated
<div className="border-b border-custom-border-200 px-5 py-3"> | ||
<ProjectAppliedFiltersList | ||
appliedFilters={currentWorkspaceFilters ?? {}} | ||
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters ?? []} | ||
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters?.filter(filter => filter !== "archived_projects") ?? []} |
There was a problem hiding this comment.
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
There was a problem hiding this 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
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 inProjectFiltersSelection
ComponentThe 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 inProjectsBaseHeader
ComponentThe 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.
web/core/components/project/root.tsx
Outdated
(currentWorkspaceAppliedDisplayFilters?.length !== 0 && | ||
!(currentWorkspaceAppliedDisplayFilters?.length==1 && | ||
!(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))) && ( |
There was a problem hiding this comment.
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.
(currentWorkspaceAppliedDisplayFilters?.length !== 0 && | |
!(currentWorkspaceAppliedDisplayFilters?.length==1 && | |
!(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))) && ( | |
const isOnlyArchived = currentWorkspaceAppliedDisplayFilters?.length === 1 && currentWorkspaceAppliedDisplayFilters.includes("archived_projects"); | |
(currentWorkspaceAppliedDisplayFilters?.length !== 0 && !isOnlyArchived) && ( |
There was a problem hiding this 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
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
There was a problem hiding this 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
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 theisArchived
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 withinhandleClearAllFilters
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.
Changes:
Previous State:
![image](https://private-user-images.githubusercontent.com/81684683/362874230-388d503e-c861-4704-b4b5-1e79a1033480.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NjQyNTYsIm5iZiI6MTczOTk2Mzk1NiwicGF0aCI6Ii84MTY4NDY4My8zNjI4NzQyMzAtMzg4ZDUwM2UtYzg2MS00NzA0LWI0YjUtMWU3OWExMDMzNDgwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDExMTkxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5YzdmYTMxYWI2N2U2OWVjYTAzMWI2MjJiYjM3ZWEwOWRhYmM0NDk5YTY5ZGI3YTViMWY2MTdkZjYwNmY0NDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.gQyeywOmvJSDl66TQQc9pUcG3CehJN8PZxUZgKS7Oew)
New State:
![image](https://private-user-images.githubusercontent.com/81684683/362875194-b2a9eb28-10f5-435a-ad74-52e266823d3c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NjQyNTYsIm5iZiI6MTczOTk2Mzk1NiwicGF0aCI6Ii84MTY4NDY4My8zNjI4NzUxOTQtYjJhOWViMjgtMTBmNS00MzVhLWFkNzQtNTJlMjY2ODIzZDNjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDExMTkxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUwYmRkMzE0NTVhNjFmOTdjZTMzY2NmNTU4NDk3NWIzZTU3MDcyNjYyYjQ2MWU0N2E3MmRjNzE1YTQ1MjdmMzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.O6uIzNq3cjcRzqVK264P14KEx_66Pqz9X0CoBi0gwBw)
Reference:
[WEB-2294]
Summary by CodeRabbit
New Features
Bug Fixes
Style