From 7be038ac5a1417acda0cd7f1052fd03704eeb5b1 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:04:55 +0530 Subject: [PATCH] refactor: filter components (#2359) * fix: calendar layout dividers * refactor: filter selection components * fix: dropdown closing after selection * refactor: filters components --- web/components/core/views/all-views.tsx | 4 +- .../issue-layouts/calendar/calendar.tsx | 2 +- .../calendar/dropdowns/months-dropdown.tsx | 127 ++++++------- .../issues/issue-layouts/calendar/header.tsx | 2 +- .../issue-layouts/calendar/week-days.tsx | 6 +- .../filters/applied-filters/filters-list.tsx | 77 ++------ .../filters/applied-filters/index.ts | 1 + .../filters/applied-filters/root.tsx | 79 ++++++++ .../filters/header/filters/assignee.tsx | 30 ++- .../filters/header/filters/created-by.tsx | 30 ++- .../header/filters/filters-selection.tsx | 177 +++++++----------- .../filters/header/filters/labels.tsx | 20 +- .../filters/header/filters/start-date.tsx | 9 +- .../filters/header/filters/state-group.tsx | 12 +- .../filters/header/filters/state.tsx | 21 +-- .../filters/header/filters/target-date.tsx | 9 +- 16 files changed, 280 insertions(+), 326 deletions(-) create mode 100644 web/components/issues/issue-layouts/filters/applied-filters/root.tsx diff --git a/web/components/core/views/all-views.tsx b/web/components/core/views/all-views.tsx index c5fcc7300..85830ee27 100644 --- a/web/components/core/views/all-views.tsx +++ b/web/components/core/views/all-views.tsx @@ -6,7 +6,7 @@ import useSWR from "swr"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components -import { AppliedFiltersList, CalendarLayout, GanttLayout, KanBanLayout, SpreadsheetLayout } from "components/issues"; +import { AppliedFiltersRoot, CalendarLayout, GanttLayout, KanBanLayout, SpreadsheetLayout } from "components/issues"; export const AllViews: React.FC = observer(() => { const router = useRouter(); @@ -35,7 +35,7 @@ export const AllViews: React.FC = observer(() => { return (
No matches found
diff --git a/web/components/issues/issue-layouts/filters/header/filters/state-group.tsx b/web/components/issues/issue-layouts/filters/header/filters/state-group.tsx index fd22cd10d..c5551a30d 100644 --- a/web/components/issues/issue-layouts/filters/header/filters/state-group.tsx +++ b/web/components/issues/issue-layouts/filters/header/filters/state-group.tsx @@ -13,10 +13,11 @@ type Props = { handleUpdate: (val: string) => void; itemsToRender: number; searchQuery: string; + viewButtons: React.ReactNode; }; export const FilterStateGroup: React.FCNo matches found
)} diff --git a/web/components/issues/issue-layouts/filters/header/filters/state.tsx b/web/components/issues/issue-layouts/filters/header/filters/state.tsx index 6a1232588..ae719758a 100644 --- a/web/components/issues/issue-layouts/filters/header/filters/state.tsx +++ b/web/components/issues/issue-layouts/filters/header/filters/state.tsx @@ -1,8 +1,5 @@ import React, { useState } from "react"; -import { observer } from "mobx-react-lite"; -// mobx store -import { useMobxStore } from "lib/mobx/store-provider"; // components import { FilterHeader, FilterOption } from "components/issues"; // ui @@ -11,25 +8,24 @@ import { Loader } from "components/ui"; import { StateGroupIcon } from "components/icons"; // helpers import { getStatesList } from "helpers/state.helper"; +// types +import { IStateResponse } from "types"; type Props = { appliedFilters: string[] | null; handleUpdate: (val: string) => void; itemsToRender: number; - projectId: string; searchQuery: string; + states: IStateResponse | undefined; + viewButtons: React.ReactNode; }; -export const FilterState: React.FCNo matches found
@@ -71,4 +68,4 @@ export const FilterState: React.FCNo matches found