chore: issue and properties filter dropdown improvement (#4733)

This commit is contained in:
Anmol Singh Bhatia 2024-06-07 19:33:13 +05:30 committed by GitHub
parent 17ce1bceb6
commit de8da176d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 46 additions and 17 deletions

View File

@ -156,6 +156,8 @@ export const CycleMobileHeader = () => {
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
labels={projectLabels} labels={projectLabels}
memberIds={projectMemberIds ?? undefined} memberIds={projectMemberIds ?? undefined}
states={projectStates} states={projectStates}

View File

@ -241,6 +241,8 @@ export const CycleIssuesHeader: React.FC = observer(() => {
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
labels={projectLabels} labels={projectLabels}
memberIds={projectMemberIds ?? undefined} memberIds={projectMemberIds ?? undefined}
states={projectStates} states={projectStates}

View File

@ -117,6 +117,8 @@ export const GlobalIssuesHeader: React.FC = observer(() => {
layoutDisplayFiltersOptions={ISSUE_DISPLAY_FILTERS_BY_LAYOUT.my_issues.spreadsheet} layoutDisplayFiltersOptions={ISSUE_DISPLAY_FILTERS_BY_LAYOUT.my_issues.spreadsheet}
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
labels={workspaceLabels ?? undefined} labels={workspaceLabels ?? undefined}
memberIds={workspaceMemberIds ?? undefined} memberIds={workspaceMemberIds ?? undefined}
/> />

View File

@ -239,6 +239,8 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -138,6 +138,8 @@ export const ProjectDraftIssueHeader: FC = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -182,6 +182,8 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -216,6 +216,8 @@ export const ProjectViewIssuesHeader: React.FC = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -77,6 +77,8 @@ export const ArchivedIssuesHeader: FC = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters || {}} filters={issueFilters?.filters || {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFiltersUpdate}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.archived_issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.archived_issues[activeLayout] : undefined
} }

View File

@ -7,7 +7,6 @@ import {
FilterDisplayProperties, FilterDisplayProperties,
FilterExtraOptions, FilterExtraOptions,
FilterGroupBy, FilterGroupBy,
FilterIssueType,
FilterOrderBy, FilterOrderBy,
FilterSubGroupBy, FilterSubGroupBy,
} from "@/components/issues"; } from "@/components/issues";
@ -111,20 +110,6 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
</div> </div>
)} )}
{/* issue type */}
{isDisplayFilterEnabled("type") && (
<div className="py-2">
<FilterIssueType
selectedIssueType={displayFilters?.type}
handleUpdate={(val) =>
handleDisplayFiltersUpdate({
type: val,
})
}
/>
</div>
)}
{/* Options */} {/* Options */}
{layoutDisplayFiltersOptions?.extra_options.access && ( {layoutDisplayFiltersOptions?.extra_options.access && (
<div className="py-2"> <div className="py-2">

View File

@ -1,7 +1,7 @@
import { useState } from "react"; import { useState } from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { Search, X } from "lucide-react"; import { Search, X } from "lucide-react";
import { IIssueFilterOptions, IIssueLabel, IState } from "@plane/types"; import { IIssueDisplayFilterOptions, IIssueFilterOptions, IIssueLabel, IState } from "@plane/types";
// hooks // hooks
import { import {
FilterAssignees, FilterAssignees,
@ -16,6 +16,7 @@ import {
FilterTargetDate, FilterTargetDate,
FilterCycle, FilterCycle,
FilterModule, FilterModule,
FilterIssueType,
} from "@/components/issues"; } from "@/components/issues";
import { ILayoutDisplayFiltersOptions } from "@/constants/issue"; import { ILayoutDisplayFiltersOptions } from "@/constants/issue";
import { useAppRouter } from "@/hooks/store"; import { useAppRouter } from "@/hooks/store";
@ -25,6 +26,8 @@ import { useAppRouter } from "@/hooks/store";
type Props = { type Props = {
filters: IIssueFilterOptions; filters: IIssueFilterOptions;
displayFilters?: IIssueDisplayFilterOptions | undefined;
handleDisplayFiltersUpdate?: (updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => void;
handleFiltersUpdate: (key: keyof IIssueFilterOptions, value: string | string[]) => void; handleFiltersUpdate: (key: keyof IIssueFilterOptions, value: string | string[]) => void;
layoutDisplayFiltersOptions: ILayoutDisplayFiltersOptions | undefined; layoutDisplayFiltersOptions: ILayoutDisplayFiltersOptions | undefined;
labels?: IIssueLabel[] | undefined; labels?: IIssueLabel[] | undefined;
@ -37,6 +40,8 @@ type Props = {
export const FilterSelection: React.FC<Props> = observer((props) => { export const FilterSelection: React.FC<Props> = observer((props) => {
const { const {
filters, filters,
displayFilters,
handleDisplayFiltersUpdate,
handleFiltersUpdate, handleFiltersUpdate,
layoutDisplayFiltersOptions, layoutDisplayFiltersOptions,
labels, labels,
@ -52,6 +57,9 @@ export const FilterSelection: React.FC<Props> = observer((props) => {
const isFilterEnabled = (filter: keyof IIssueFilterOptions) => layoutDisplayFiltersOptions?.filters.includes(filter); const isFilterEnabled = (filter: keyof IIssueFilterOptions) => layoutDisplayFiltersOptions?.filters.includes(filter);
const isDisplayFilterEnabled = (displayFilter: keyof IIssueDisplayFilterOptions) =>
Object.keys(layoutDisplayFiltersOptions?.display_filters ?? {}).includes(displayFilter);
return ( return (
<div className="flex h-full w-full flex-col overflow-hidden"> <div className="flex h-full w-full flex-col overflow-hidden">
<div className="bg-custom-background-100 p-2.5 pb-0"> <div className="bg-custom-background-100 p-2.5 pb-0">
@ -187,7 +195,19 @@ export const FilterSelection: React.FC<Props> = observer((props) => {
/> />
</div> </div>
)} )}
{/* issue type */}
{isDisplayFilterEnabled("type") && displayFilters && handleDisplayFiltersUpdate && (
<div className="py-2">
<FilterIssueType
selectedIssueType={displayFilters.type}
handleUpdate={(val) =>
handleDisplayFiltersUpdate({
type: val,
})
}
/>
</div>
)}
{/* start_date */} {/* start_date */}
{isFilterEnabled("start_date") && ( {isFilterEnabled("start_date") && (
<div className="py-2"> <div className="py-2">

View File

@ -132,6 +132,8 @@ export const IssuesMobileHeader = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -134,6 +134,8 @@ export const ModuleMobileHeader = observer(() => {
<FilterSelection <FilterSelection
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
layoutDisplayFiltersOptions={ layoutDisplayFiltersOptions={
activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined activeLayout ? ISSUE_DISPLAY_FILTERS_BY_LAYOUT.issues[activeLayout] : undefined
} }

View File

@ -113,6 +113,8 @@ export const ProfileIssuesFilter = observer(() => {
} }
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
states={states} states={states}
labels={workspaceLabels} labels={workspaceLabels}
memberIds={members} memberIds={members}

View File

@ -147,6 +147,8 @@ const ProfileIssuesMobileHeader = observer(() => {
} }
filters={issueFilters?.filters ?? {}} filters={issueFilters?.filters ?? {}}
handleFiltersUpdate={handleFiltersUpdate} handleFiltersUpdate={handleFiltersUpdate}
displayFilters={issueFilters?.displayFilters ?? {}}
handleDisplayFiltersUpdate={handleDisplayFilters}
states={states} states={states}
labels={workspaceLabels} labels={workspaceLabels}
memberIds={members} memberIds={members}