Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions packages/constants/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,56 @@ export enum E_SORT_ORDER {
ASC = "asc",
DESC = "desc",
}
export const DATE_AFTER_FILTER_OPTIONS = [
{
name: "1 week from now",
value: "1_weeks;after;fromnow",
},
{
name: "2 weeks from now",
value: "2_weeks;after;fromnow",
},
{
name: "1 month from now",
value: "1_months;after;fromnow",
},
{
name: "2 months from now",
value: "2_months;after;fromnow",
},
];

export const DATE_BEFORE_FILTER_OPTIONS = [
{
name: "1 week ago",
value: "1_weeks;before;fromnow",
},
{
name: "2 weeks ago",
value: "2_weeks;before;fromnow",
},
{
name: "1 month ago",
i18n_name: "date_filters.1_month_ago",
value: "1_months;before;fromnow",
},
];

export const PROJECT_CREATED_AT_FILTER_OPTIONS = [
{
name: "Today",
value: "today;custom;custom",
},
{
name: "Yesterday",
value: "yesterday;custom;custom",
},
{
name: "Last 7 days",
value: "last_7_days;custom;custom",
},
{
name: "Last 30 days",
value: "last_30_days;custom;custom",
},
];
4 changes: 2 additions & 2 deletions web/core/components/common/applied-filters/date.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { observer } from "mobx-react";
// icons
import { X } from "lucide-react";
// constants
import { DATE_BEFORE_FILTER_OPTIONS } from "@/constants/filters";
// plane constants
import { DATE_BEFORE_FILTER_OPTIONS } from "@plane/constants";
// helpers
import { renderFormattedDate } from "@/helpers/date-time.helper";
import { capitalizeFirstLetter } from "@/helpers/string.helper";
Expand Down
5 changes: 2 additions & 3 deletions web/core/components/common/filters/created-at.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState } from "react";
import { observer } from "mobx-react";
// components
// plane constants
import { DATE_BEFORE_FILTER_OPTIONS } from "@plane/constants";
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_BEFORE_FILTER_OPTIONS } from "@/constants/filters";
// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand Down
2 changes: 1 addition & 1 deletion web/core/components/cycles/applied-filters/date.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { observer } from "mobx-react";
import { X } from "lucide-react";
// helpers
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
import { renderFormattedDate } from "@/helpers/date-time.helper";
import { capitalizeFirstLetter } from "@/helpers/string.helper";
// constants
Expand Down
6 changes: 3 additions & 3 deletions web/core/components/cycles/dropdowns/filters/end-date.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";

// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand Down
7 changes: 3 additions & 4 deletions web/core/components/cycles/dropdowns/filters/start-date.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";

// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand All @@ -17,7 +17,6 @@ type Props = {

export const FilterStartDate: React.FC<Props> = observer((props) => {
const { appliedFilters, handleUpdate, searchQuery } = props;

const [previewEnabled, setPreviewEnabled] = useState(true);
const [isDateFilterModalOpen, setIsDateFilterModalOpen] = useState(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { observer } from "mobx-react";
// icons
import { X } from "lucide-react";
// helpers
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
import { renderFormattedDate } from "@/helpers/date-time.helper";
import { capitalizeFirstLetter } from "@/helpers/string.helper";
// constants
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";

type Props = {
appliedFilters: string[] | null;
Expand All @@ -15,7 +14,6 @@ type Props = {

export const FilterStartDate: React.FC<Props> = observer((props) => {
const { appliedFilters, handleUpdate, searchQuery } = props;

const [previewEnabled, setPreviewEnabled] = useState(true);
const [isDateFilterModalOpen, setIsDateFilterModalOpen] = useState(false);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";

type Props = {
appliedFilters: string[] | null;
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/modules/applied-filters/date.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { observer } from "mobx-react";
// icons
import { X } from "lucide-react";
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// helpers
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";
import { renderFormattedDate } from "@/helpers/date-time.helper";
import { capitalizeFirstLetter } from "@/helpers/string.helper";
// constants
Expand Down
6 changes: 3 additions & 3 deletions web/core/components/modules/dropdowns/filters/start-date.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";

// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand Down
5 changes: 2 additions & 3 deletions web/core/components/modules/dropdowns/filters/target-date.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useState } from "react";
import { observer } from "mobx-react";

// plane constants
import { DATE_AFTER_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { DATE_AFTER_FILTER_OPTIONS } from "@/constants/filters";
// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand Down
4 changes: 3 additions & 1 deletion web/core/components/pages/header/root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback } from "react";
import { observer } from "mobx-react";
import { ListFilter } from "lucide-react";
import { useTranslation } from "@plane/i18n";
import { TPageFilterProps, TPageNavigationTabs } from "@plane/types";
// components
import { Header, EHeaderVariant } from "@plane/ui";
Expand All @@ -25,6 +26,7 @@ type Props = {

export const PagesListHeaderRoot: React.FC<Props> = observer((props) => {
const { pageType, projectId, workspaceSlug } = props;
const { t } = useTranslation();
// store hooks
const { filters, updateFilters, clearAllFilters } = useProjectPages();
const {
Expand Down Expand Up @@ -69,7 +71,7 @@ export const PagesListHeaderRoot: React.FC<Props> = observer((props) => {
/>
<FiltersDropdown
icon={<ListFilter className="h-3 w-3" />}
title="Filters"
title={t("common.filters")}
placement="bottom-end"
isFiltersApplied={isFiltersApplied}
>
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/project/applied-filters/date.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { observer } from "mobx-react";
import { X } from "lucide-react";
// helpers
import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@/constants/filters";
import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@plane/constants";
import { renderFormattedDate } from "@/helpers/date-time.helper";
import { capitalizeFirstLetter } from "@/helpers/string.helper";
// constants
Expand Down
5 changes: 3 additions & 2 deletions web/core/components/project/dropdowns/filters/created-at.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from "react";
import { observer } from "mobx-react";
// plane constants
import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@plane/constants";
// components
import { DateFilterModal } from "@/components/core";
import { FilterHeader, FilterOption } from "@/components/issues";
// constants
import { PROJECT_CREATED_AT_FILTER_OPTIONS } from "@/constants/filters";

// helpers
import { isInDateFormat } from "@/helpers/date-time.helper";

Expand Down
52 changes: 0 additions & 52 deletions web/core/constants/filters.ts

This file was deleted.

Loading