diff --git a/packages/constants/src/state.ts b/packages/constants/src/state.ts index 790f7828647..9f5db17c7f2 100644 --- a/packages/constants/src/state.ts +++ b/packages/constants/src/state.ts @@ -5,6 +5,11 @@ export type TStateGroups = | "completed" | "cancelled"; +export type TDraggableData = { + groupKey: TStateGroups; + id: string; +}; + export const STATE_GROUPS: { [key in TStateGroups]: { key: TStateGroups; @@ -43,6 +48,13 @@ export const ARCHIVABLE_STATE_GROUPS = [ STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key, ]; +export const COMPLETED_STATE_GROUPS = [STATE_GROUPS.completed.key]; +export const PENDING_STATE_GROUPS = [ + STATE_GROUPS.backlog.key, + STATE_GROUPS.unstarted.key, + STATE_GROUPS.started.key, + STATE_GROUPS.cancelled.key, +]; export const PROGRESS_STATE_GROUPS_DETAILS = [ { @@ -66,3 +78,5 @@ export const PROGRESS_STATE_GROUPS_DETAILS = [ color: "#A3A3A3", }, ]; + +export const DISPLAY_WORKFLOW_PRO_CTA = false; diff --git a/web/ce/components/workflow/state-item-child.tsx b/web/ce/components/workflow/state-item-child.tsx index 2c07fd9ff00..af686bbe57b 100644 --- a/web/ce/components/workflow/state-item-child.tsx +++ b/web/ce/components/workflow/state-item-child.tsx @@ -1,11 +1,11 @@ import { SetStateAction } from "react"; import { observer } from "mobx-react"; // Plane +import { DISPLAY_WORKFLOW_PRO_CTA } from "@plane/constants"; import { IState } from "@plane/types"; // components import { StateItemTitle } from "@/components/project-states/state-item-title"; // constants -import { DISPLAY_WORKFLOW_PRO_CTA } from "@/constants/state"; // import { AddStateTransition } from "./add-state-transition"; diff --git a/web/core/components/analytics/scope-and-demand/demand.tsx b/web/core/components/analytics/scope-and-demand/demand.tsx index 39a04cf9bde..7b1077af0cf 100644 --- a/web/core/components/analytics/scope-and-demand/demand.tsx +++ b/web/core/components/analytics/scope-and-demand/demand.tsx @@ -1,8 +1,9 @@ +// plane imports +import { STATE_GROUPS } from "@plane/constants"; // types import { IDefaultAnalyticsResponse, TStateGroups } from "@plane/types"; // constants import { Card } from "@plane/ui"; -import { STATE_GROUPS } from "@/constants/state"; type Props = { defaultAnalytics: IDefaultAnalyticsResponse; diff --git a/web/core/components/dashboard/widgets/issues-by-state-group.tsx b/web/core/components/dashboard/widgets/issues-by-state-group.tsx index 53437ca1185..fa57114866c 100644 --- a/web/core/components/dashboard/widgets/issues-by-state-group.tsx +++ b/web/core/components/dashboard/widgets/issues-by-state-group.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; // types +import { STATE_GROUPS } from "@plane/constants"; import { TIssuesByStateGroupsWidgetFilters, TIssuesByStateGroupsWidgetResponse, TStateGroups } from "@plane/types"; // components import { Card } from "@plane/ui"; @@ -14,7 +15,6 @@ import { import { PieGraph } from "@/components/ui"; // constants import { EDurationFilters, STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "@/constants/dashboard"; -import { STATE_GROUPS } from "@/constants/state"; // helpers import { getCustomDates } from "@/helpers/dashboard.helper"; // hooks diff --git a/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx b/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx index 31858bff15f..48ef1b4f3d1 100644 --- a/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx +++ b/web/core/components/issues/issue-detail/issue-detail-quick-actions.tsx @@ -4,13 +4,12 @@ import React, { FC, useState } from "react"; import { observer } from "mobx-react"; import { usePathname } from "next/navigation"; import { ArchiveIcon, ArchiveRestoreIcon, LinkIcon, Trash2 } from "lucide-react"; -import { EIssuesStoreType } from "@plane/constants"; +import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; // components import { ArchiveIssueModal, DeleteIssueModal, IssueSubscription } from "@/components/issues"; // constants import { ISSUE_ARCHIVED, ISSUE_DELETED } from "@/constants/event-tracker"; -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyTextToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/issues/issue-layouts/filters/header/filters/state-group.tsx b/web/core/components/issues/issue-layouts/filters/header/filters/state-group.tsx index 1ca11eec629..cdad192b621 100644 --- a/web/core/components/issues/issue-layouts/filters/header/filters/state-group.tsx +++ b/web/core/components/issues/issue-layouts/filters/header/filters/state-group.tsx @@ -2,12 +2,11 @@ import React, { useState } from "react"; import { observer } from "mobx-react"; -// components +// plane imports +import { STATE_GROUPS } from "@plane/constants"; import { StateGroupIcon } from "@plane/ui"; +// components import { FilterHeader, FilterOption } from "@/components/issues"; -// icons -import { STATE_GROUPS } from "@/constants/state"; -// constants type Props = { appliedFilters: string[] | null; diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx index f7bce8e7219..104270c0a16 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx @@ -6,14 +6,12 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Copy, ExternalLink, Link, Pencil, Trash2 } from "lucide-react"; // types -import { EIssuesStoreType } from "@plane/constants"; +import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TIssue } from "@plane/types"; // ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; -// constants -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyUrlToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx index dff81f55f2e..d45245f6873 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx @@ -6,14 +6,12 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Copy, ExternalLink, Link, Pencil, Trash2, XCircle } from "lucide-react"; // types -import { EIssuesStoreType } from "@plane/constants"; +import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TIssue } from "@plane/types"; // ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; -// constants -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyUrlToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx index c6c8e691eca..c1f49267cf1 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx @@ -6,14 +6,12 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Copy, ExternalLink, Link, Pencil, Trash2, XCircle } from "lucide-react"; // types -import { EIssuesStoreType } from "@plane/constants"; +import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TIssue } from "@plane/types"; // ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; -// constants -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyUrlToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx b/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx index f9f5c88d7a5..f80b205643b 100644 --- a/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx +++ b/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx @@ -6,14 +6,12 @@ import { observer } from "mobx-react"; import { useParams, usePathname } from "next/navigation"; import { Copy, ExternalLink, Link, Pencil, Trash2 } from "lucide-react"; // types -import { EIssuesStoreType } from "@plane/constants"; +import { ARCHIVABLE_STATE_GROUPS, EIssuesStoreType } from "@plane/constants"; import { TIssue } from "@plane/types"; // ui import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, setToast } from "@plane/ui"; // components import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues"; -// constants -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyUrlToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/issues/issue-layouts/utils.tsx b/web/core/components/issues/issue-layouts/utils.tsx index 59b3dc9b257..03699d0c3a3 100644 --- a/web/core/components/issues/issue-layouts/utils.tsx +++ b/web/core/components/issues/issue-layouts/utils.tsx @@ -11,7 +11,7 @@ import uniq from "lodash/uniq"; import scrollIntoView from "smooth-scroll-into-view-if-needed"; import { ContrastIcon } from "lucide-react"; // plane types -import { EIssuesStoreType, ISSUE_PRIORITIES } from "@plane/constants"; +import { EIssuesStoreType, ISSUE_PRIORITIES, STATE_GROUPS } from "@plane/constants"; import { GroupByColumnTypes, IGroupByColumn, @@ -30,7 +30,6 @@ import { import { Avatar, CycleGroupIcon, DiceIcon, PriorityIcon, StateGroupIcon } from "@plane/ui"; // components import { Logo } from "@/components/common"; -import { STATE_GROUPS } from "@/constants/state"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; import { getFileURL } from "@/helpers/file.helper"; diff --git a/web/core/components/issues/peek-overview/header.tsx b/web/core/components/issues/peek-overview/header.tsx index 8484d9bc3da..d80643b514e 100644 --- a/web/core/components/issues/peek-overview/header.tsx +++ b/web/core/components/issues/peek-overview/header.tsx @@ -4,6 +4,8 @@ import { FC } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { ArchiveRestoreIcon, Link2, MoveDiagonal, MoveRight, Trash2 } from "lucide-react"; +// plane imports +import { ARCHIVABLE_STATE_GROUPS } from "@plane/constants"; // types import { TNameDescriptionLoader } from "@plane/types"; // ui @@ -19,7 +21,6 @@ import { } from "@plane/ui"; // components import { IssueSubscription, NameDescriptionUpdateStatus } from "@/components/issues"; -import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state"; // helpers import { cn } from "@/helpers/common.helper"; import { copyUrlToClipboard } from "@/helpers/string.helper"; diff --git a/web/core/components/profile/overview/state-distribution.tsx b/web/core/components/profile/overview/state-distribution.tsx index ca73fa46592..06e2ac7caaa 100644 --- a/web/core/components/profile/overview/state-distribution.tsx +++ b/web/core/components/profile/overview/state-distribution.tsx @@ -1,14 +1,12 @@ -// ui +// plane imports +import { STATE_GROUPS } from "@plane/constants"; import { useTranslation } from "@plane/i18n"; import { IUserProfileData, IUserStateDistribution } from "@plane/types"; +// ui import { Card } from "@plane/ui"; import { ProfileEmptyState, PieGraph } from "@/components/ui"; - // image -import { STATE_GROUPS } from "@/constants/state"; import stateGraph from "@/public/empty-state/state_graph.svg"; -// types -// constants type Props = { stateDistribution: IUserStateDistribution[]; diff --git a/web/core/components/profile/overview/workload.tsx b/web/core/components/profile/overview/workload.tsx index 9f1283cdf90..1581362690b 100644 --- a/web/core/components/profile/overview/workload.tsx +++ b/web/core/components/profile/overview/workload.tsx @@ -1,8 +1,9 @@ +// plane imports +import { STATE_GROUPS } from "@plane/constants"; // types import { useTranslation } from "@plane/i18n"; import { IUserStateDistribution } from "@plane/types"; import { Card, ECardDirection, ECardSpacing } from "@plane/ui"; -import { STATE_GROUPS } from "@/constants/state"; // constants type Props = { diff --git a/web/core/components/project-states/create-update/create.tsx b/web/core/components/project-states/create-update/create.tsx index b581eacecc5..9d4d4ee84f6 100644 --- a/web/core/components/project-states/create-update/create.tsx +++ b/web/core/components/project-states/create-update/create.tsx @@ -2,13 +2,14 @@ import { FC, useState } from "react"; import { observer } from "mobx-react"; +// plane imports +import { STATE_GROUPS } from "@plane/constants"; import { IState, TStateGroups } from "@plane/types"; import { TOAST_TYPE, setToast } from "@plane/ui"; // components import { StateForm } from "@/components/project-states"; // constants import { STATE_CREATED } from "@/constants/event-tracker"; -import { STATE_GROUPS } from "@/constants/state"; // hooks import { useEventTracker, useProjectState } from "@/hooks/store"; diff --git a/web/core/components/project-states/state-item.tsx b/web/core/components/project-states/state-item.tsx index 3ab594a81e8..e1fafd6ecb0 100644 --- a/web/core/components/project-states/state-item.tsx +++ b/web/core/components/project-states/state-item.tsx @@ -6,12 +6,12 @@ import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-d import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge"; import { observer } from "mobx-react"; // Plane +import { TDraggableData } from "@plane/constants"; import { IState, TStateGroups } from "@plane/types"; import { DropIndicator } from "@plane/ui"; // components import { StateUpdate } from "@/components/project-states"; // helpers -import { TDraggableData } from "@/constants/state"; import { cn } from "@/helpers/common.helper"; import { getCurrentStateSequence } from "@/helpers/state.helper"; // hooks diff --git a/web/core/constants/state.ts b/web/core/constants/state.ts deleted file mode 100644 index 24d10cf5669..00000000000 --- a/web/core/constants/state.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { TStateGroups } from "@plane/types"; - -export type TDraggableData = { - groupKey: TStateGroups; - id: string; -}; - -export const STATE_GROUPS: { - [key in TStateGroups]: { - key: TStateGroups; - label: string; - color: string; - }; -} = { - backlog: { - key: "backlog", - label: "Backlog", - color: "#d9d9d9", - }, - unstarted: { - key: "unstarted", - label: "Unstarted", - color: "#3f76ff", - }, - started: { - key: "started", - label: "Started", - color: "#f59e0b", - }, - completed: { - key: "completed", - label: "Completed", - color: "#16a34a", - }, - cancelled: { - key: "cancelled", - label: "Canceled", - color: "#dc2626", - }, -}; - -export const ARCHIVABLE_STATE_GROUPS = [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key]; -export const COMPLETED_STATE_GROUPS = [STATE_GROUPS.completed.key]; -export const PENDING_STATE_GROUPS = [ - STATE_GROUPS.backlog.key, - STATE_GROUPS.unstarted.key, - STATE_GROUPS.started.key, - STATE_GROUPS.cancelled.key, -]; - -export const DISPLAY_WORKFLOW_PRO_CTA = false; diff --git a/web/helpers/analytics.helper.ts b/web/helpers/analytics.helper.ts index c8c2b91b42a..cee4b40f352 100644 --- a/web/helpers/analytics.helper.ts +++ b/web/helpers/analytics.helper.ts @@ -1,11 +1,10 @@ // nivo import { BarDatum } from "@nivo/bar"; // plane imports -import { ANALYTICS_DATE_KEYS } from "@plane/constants"; +import { ANALYTICS_DATE_KEYS, STATE_GROUPS } from "@plane/constants"; import { IAnalyticsData, IAnalyticsParams, IAnalyticsResponse, TStateGroups } from "@plane/types"; // constants import { MONTHS_LIST } from "@/constants/calendar"; -import { STATE_GROUPS } from "@/constants/state"; // helpers import { addSpaceIfCamelCase, capitalizeFirstLetter, generateRandomColor } from "@/helpers/string.helper"; diff --git a/web/helpers/distribution-update.helper.ts b/web/helpers/distribution-update.helper.ts index c55543fee71..b640bf33cf5 100644 --- a/web/helpers/distribution-update.helper.ts +++ b/web/helpers/distribution-update.helper.ts @@ -1,10 +1,10 @@ import { format } from "date-fns"; import get from "lodash/get"; import set from "lodash/set"; +// plane imports +import { STATE_GROUPS, COMPLETED_STATE_GROUPS } from "@plane/constants"; // types import { ICycle, IEstimatePoint, IModule, IState, TIssue } from "@plane/types"; -// constants -import { STATE_GROUPS, COMPLETED_STATE_GROUPS } from "@/constants/state"; // helper import { getDate } from "./date-time.helper"; diff --git a/web/helpers/issue.helper.ts b/web/helpers/issue.helper.ts index f528fea8a24..dc7aa5a5b95 100644 --- a/web/helpers/issue.helper.ts +++ b/web/helpers/issue.helper.ts @@ -3,7 +3,7 @@ import isEmpty from "lodash/isEmpty"; import set from "lodash/set"; import { v4 as uuidv4 } from "uuid"; // plane constants -import { EIssueLayoutTypes, ISSUE_DISPLAY_FILTERS_BY_PAGE } from "@plane/constants"; +import { EIssueLayoutTypes, ISSUE_DISPLAY_FILTERS_BY_PAGE, STATE_GROUPS } from "@plane/constants"; // types import { IIssueDisplayFilterOptions, @@ -18,7 +18,6 @@ import { TUnGroupedIssues, } from "@plane/types"; import { IGanttBlock } from "@/components/gantt-chart"; -import { STATE_GROUPS } from "@/constants/state"; // helpers import { orderArrayBy } from "@/helpers/array.helper"; import { getDate } from "@/helpers/date-time.helper"; diff --git a/web/helpers/state.helper.ts b/web/helpers/state.helper.ts index 4e6c633ba8f..7d0b9de38cc 100644 --- a/web/helpers/state.helper.ts +++ b/web/helpers/state.helper.ts @@ -1,6 +1,7 @@ +// plane imports +import { STATE_GROUPS, TDraggableData } from "@plane/constants"; // types import { IState, IStateResponse } from "@plane/types"; -import { STATE_GROUPS, TDraggableData } from "@/constants/state"; export const orderStateGroups = (unorderedStateGroups: IStateResponse | undefined): IStateResponse | undefined => { if (!unorderedStateGroups) return undefined;