From 1cbbddb1be8281a6ccf043efc1d5de5e0f1042c9 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Wed, 8 May 2024 13:40:58 +0530 Subject: [PATCH] [WEB-1215] chore: display `favorite module` filter in applied filter section. (#4402) * [WEB-1215] chore: display `favorite module` filter in applied filter section. * fix: build errors. --- .../modules/applied-filters/root.tsx | 46 +++++++++++++++++-- .../modules/archived-modules/root.tsx | 1 + web/components/modules/module-view-header.tsx | 2 +- web/components/modules/modules-list-view.tsx | 14 +----- .../projects/[projectId]/modules/index.tsx | 18 ++++++-- web/store/module_filter.store.ts | 1 + 6 files changed, 61 insertions(+), 21 deletions(-) diff --git a/web/components/modules/applied-filters/root.tsx b/web/components/modules/applied-filters/root.tsx index 3011df084..e48b8562f 100644 --- a/web/components/modules/applied-filters/root.tsx +++ b/web/components/modules/applied-filters/root.tsx @@ -1,5 +1,5 @@ import { X } from "lucide-react"; -import { TModuleFilters } from "@plane/types"; +import { TModuleDisplayFilters, TModuleFilters } from "@plane/types"; // components import { AppliedDateFilters, AppliedMembersFilters, AppliedStatusFilters } from "@/components/modules"; // helpers @@ -8,19 +8,30 @@ import { replaceUnderscoreIfSnakeCase } from "@/helpers/string.helper"; type Props = { appliedFilters: TModuleFilters; + isFavoriteFilterApplied?: boolean; handleClearAllFilters: () => void; + handleDisplayFiltersUpdate?: (updatedDisplayProperties: Partial) => void; handleRemoveFilter: (key: keyof TModuleFilters, value: string | null) => void; alwaysAllowEditing?: boolean; + isArchived?: boolean; }; const MEMBERS_FILTERS = ["lead", "members"]; const DATE_FILTERS = ["start_date", "target_date"]; export const ModuleAppliedFiltersList: React.FC = (props) => { - const { appliedFilters, handleClearAllFilters, handleRemoveFilter, alwaysAllowEditing } = props; + const { + appliedFilters, + isFavoriteFilterApplied, + handleClearAllFilters, + handleRemoveFilter, + handleDisplayFiltersUpdate, + alwaysAllowEditing, + isArchived = false, + } = props; - if (!appliedFilters) return null; - if (Object.keys(appliedFilters).length === 0) return null; + if (!appliedFilters && !isFavoriteFilterApplied) return null; + if (Object.keys(appliedFilters).length === 0 && !isFavoriteFilterApplied) return null; const isEditingAllowed = alwaysAllowEditing; @@ -73,6 +84,33 @@ export const ModuleAppliedFiltersList: React.FC = (props) => { ); })} + {!isArchived && isFavoriteFilterApplied && ( +
+
+ Modules +
+ Favorite + {isEditingAllowed && ( + + )} +
+
+
+ )} {isEditingAllowed && (