Skip to content

Commit

Permalink
Improved Code Logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sharma01ketan committed Aug 30, 2024
1 parent ee9bb5c commit 965b9ac
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions web/core/components/project/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const Root = observer(() => {
// derived values
const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Projects` : undefined;

const allowedDisplayFilters = currentWorkspaceAppliedDisplayFilters?.filter(
(filter) => filter !== "archived_projects"
) ?? [];

const handleRemoveFilter = useCallback(
(key: keyof TProjectFilters, value: string | null) => {
if (!workspaceSlug) return;
Expand Down Expand Up @@ -64,18 +68,17 @@ const Root = observer(() => {
updateDisplayFilters(workspaceSlug.toString(), { archived_projects: false });
}
}, [pathname]);

return (
<>
<PageHead title={pageTitle} />
<div className="flex h-full w-full flex-col">
{(calculateTotalFilters(currentWorkspaceFilters ?? {}) !== 0 ||
(currentWorkspaceAppliedDisplayFilters?.length !== 0 &&
!(currentWorkspaceAppliedDisplayFilters?.length==1 &&
!(currentWorkspaceAppliedDisplayFilters?.indexOf("archived_projects")===-1)))) && (
(allowedDisplayFilters.length>0)) && (
<div className="border-b border-custom-border-200 px-5 py-3">
<ProjectAppliedFiltersList
appliedFilters={currentWorkspaceFilters ?? {}}
appliedDisplayFilters={currentWorkspaceAppliedDisplayFilters?.filter(filter => filter !== "archived_projects") ?? []}
appliedDisplayFilters={allowedDisplayFilters}
handleClearAllFilters={handleClearAllFilters}
handleRemoveFilter={handleRemoveFilter}
handleRemoveDisplayFilter={handleRemoveDisplayFilter}
Expand Down

0 comments on commit 965b9ac

Please sign in to comment.