chore: project date filter updated (#4273)

This commit is contained in:
Anmol Singh Bhatia 2024-04-24 15:18:13 +05:30 committed by GitHub
parent 87737dbfbe
commit deaa63488b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 14 deletions

View file

@ -4,7 +4,7 @@ import { observer } from "mobx-react-lite";
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_BEFORE_FILTER_OPTIONS } from "@/constants/filters";
import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@/constants/filters";
// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";
@ -16,13 +16,12 @@ type Props = {
export const FilterCreatedDate: React.FC<Props> = observer((props) => {
const { appliedFilters, handleUpdate, searchQuery } = props;
// state
const [previewEnabled, setPreviewEnabled] = useState(true);
const [isDateFilterModalOpen, setIsDateFilterModalOpen] = useState(false);
// derived values
const appliedFiltersCount = appliedFilters?.length ?? 0;
const filteredOptions = DATE_BEFORE_FILTER_OPTIONS.filter((d) =>
const filteredOptions = PROJECT_CREATED_AT_FILTER_OPTIONS.filter((d) =>
d.name.toLowerCase().includes(searchQuery.toLowerCase())
);
@ -62,10 +61,15 @@ export const FilterCreatedDate: React.FC<Props> = observer((props) => {
isChecked={appliedFilters?.includes(option.value) ? true : false}
onClick={() => handleUpdate(option.value)}
title={option.name}
multiple
multiple={false}
/>
))}
<FilterOption isChecked={isCustomDateSelected()} onClick={handleCustomDate} title="Custom" multiple />
<FilterOption
isChecked={isCustomDateSelected()}
onClick={handleCustomDate}
title="Custom"
multiple={false}
/>
</>
) : (
<p className="text-xs italic text-custom-text-400">No matches found</p>