diff --git a/packages/types/src/dashboard/dashboard.d.ts b/packages/types/src/dashboard.ts similarity index 91% rename from packages/types/src/dashboard/dashboard.d.ts rename to packages/types/src/dashboard.ts index d565f6688..be7d7b3be 100644 --- a/packages/types/src/dashboard/dashboard.d.ts +++ b/packages/types/src/dashboard.ts @@ -1,8 +1,16 @@ -import { IIssueActivity, TIssuePriorities } from "../issues"; -import { TIssue } from "../issues/issue"; -import { TIssueRelationTypes } from "../issues/issue_relation"; -import { TStateGroups } from "../state"; -import { EDurationFilters } from "./enums"; +import { IIssueActivity, TIssuePriorities } from "./issues"; +import { TIssue } from "./issues/issue"; +import { TIssueRelationTypes } from "./issues/issue_relation"; +import { TStateGroups } from "./state"; + +enum EDurationFilters { + NONE = "none", + TODAY = "today", + THIS_WEEK = "this_week", + THIS_MONTH = "this_month", + THIS_YEAR = "this_year", + CUSTOM = "custom", +} export type TWidgetKeys = | "overview_stats" diff --git a/packages/types/src/dashboard/enums.ts b/packages/types/src/dashboard/enums.ts deleted file mode 100644 index 2c9efd5c3..000000000 --- a/packages/types/src/dashboard/enums.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum EDurationFilters { - NONE = "none", - TODAY = "today", - THIS_WEEK = "this_week", - THIS_MONTH = "this_month", - THIS_YEAR = "this_year", - CUSTOM = "custom", -} diff --git a/packages/types/src/dashboard/index.ts b/packages/types/src/dashboard/index.ts deleted file mode 100644 index dec14aea6..000000000 --- a/packages/types/src/dashboard/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./dashboard"; -export * from "./enums"; diff --git a/packages/types/src/index.d.ts b/packages/types/src/index.d.ts index b1eb38a56..bfebd92d0 100644 --- a/packages/types/src/index.d.ts +++ b/packages/types/src/index.d.ts @@ -29,13 +29,3 @@ export * from "./auth"; export * from "./api_token"; export * from "./instance"; export * from "./app"; - -export * from "./enums"; - -export type NestedKeyOf = { - [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object - ? ObjectType[Key] extends { pop: any; push: any } - ? `${Key}` - : `${Key}` | `${Key}.${NestedKeyOf}` - : `${Key}`; -}[keyof ObjectType & (string | number)]; diff --git a/web/components/dashboard/widgets/assigned-issues.tsx b/web/components/dashboard/widgets/assigned-issues.tsx index 3833d319c..1e031cacd 100644 --- a/web/components/dashboard/widgets/assigned-issues.tsx +++ b/web/components/dashboard/widgets/assigned-issues.tsx @@ -3,6 +3,8 @@ import { observer } from "mobx-react-lite"; import Link from "next/link"; import { Tab } from "@headlessui/react"; // hooks +import { useDashboard } from "hooks/store"; +// components import { DurationFilterDropdown, TabsList, @@ -10,14 +12,12 @@ import { WidgetLoader, WidgetProps, } from "components/dashboard/widgets"; -import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; -import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper"; -import { useDashboard } from "hooks/store"; -// components // helpers +import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper"; // types -import { EDurationFilters, TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types"; +import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types"; // constants +import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; const WIDGET_KEY = "assigned_issues"; diff --git a/web/components/dashboard/widgets/created-issues.tsx b/web/components/dashboard/widgets/created-issues.tsx index 61a1181e9..d36260f21 100644 --- a/web/components/dashboard/widgets/created-issues.tsx +++ b/web/components/dashboard/widgets/created-issues.tsx @@ -3,6 +3,8 @@ import { observer } from "mobx-react-lite"; import Link from "next/link"; import { Tab } from "@headlessui/react"; // hooks +import { useDashboard } from "hooks/store"; +// components import { DurationFilterDropdown, TabsList, @@ -10,14 +12,12 @@ import { WidgetLoader, WidgetProps, } from "components/dashboard/widgets"; -import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; -import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper"; -import { useDashboard } from "hooks/store"; -// components // helpers +import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper"; // types -import { EDurationFilters, TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types"; +import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types"; // constants +import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; const WIDGET_KEY = "created_issues"; diff --git a/web/components/dashboard/widgets/dropdowns/duration-filter.tsx b/web/components/dashboard/widgets/dropdowns/duration-filter.tsx index 3cf22c350..feef7ceca 100644 --- a/web/components/dashboard/widgets/dropdowns/duration-filter.tsx +++ b/web/components/dashboard/widgets/dropdowns/duration-filter.tsx @@ -6,9 +6,8 @@ import { DateFilterModal } from "components/core"; // ui // helpers import { getDurationFilterDropdownLabel } from "helpers/dashboard.helper"; -// types -import { EDurationFilters } from "@plane/types"; // constants +import { DURATION_FILTER_OPTIONS, EDurationFilters } from "constants/dashboard"; type Props = { customDates?: string[]; diff --git a/web/components/dashboard/widgets/issue-panels/tabs-list.tsx b/web/components/dashboard/widgets/issue-panels/tabs-list.tsx index d5fcea697..257f73851 100644 --- a/web/components/dashboard/widgets/issue-panels/tabs-list.tsx +++ b/web/components/dashboard/widgets/issue-panels/tabs-list.tsx @@ -1,11 +1,11 @@ import { observer } from "mobx-react"; import { Tab } from "@headlessui/react"; // helpers -import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; import { cn } from "helpers/common.helper"; // types -import { EDurationFilters, TIssuesListTypes } from "@plane/types"; +import { TIssuesListTypes } from "@plane/types"; // constants +import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; type Props = { durationFilter: EDurationFilters; diff --git a/web/components/dashboard/widgets/issues-by-priority.tsx b/web/components/dashboard/widgets/issues-by-priority.tsx index a8a8f64e8..becf32285 100644 --- a/web/components/dashboard/widgets/issues-by-priority.tsx +++ b/web/components/dashboard/widgets/issues-by-priority.tsx @@ -3,6 +3,7 @@ import { observer } from "mobx-react-lite"; import Link from "next/link"; import { useRouter } from "next/router"; // hooks +import { useDashboard } from "hooks/store"; // components import { DurationFilterDropdown, @@ -11,10 +12,12 @@ import { WidgetProps, } from "components/dashboard/widgets"; // helpers +import { getCustomDates } from "helpers/dashboard.helper"; // types +import { TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types"; // constants import { IssuesByPriorityGraph } from "components/graphs"; -import { EDurationFilters, TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types"; +import { EDurationFilters } from "constants/dashboard"; const WIDGET_KEY = "issues_by_priority"; diff --git a/web/components/dashboard/widgets/issues-by-state-group.tsx b/web/components/dashboard/widgets/issues-by-state-group.tsx index 6ffeda0c4..6857f7ef3 100644 --- a/web/components/dashboard/widgets/issues-by-state-group.tsx +++ b/web/components/dashboard/widgets/issues-by-state-group.tsx @@ -10,20 +10,15 @@ import { WidgetProps, } from "components/dashboard/widgets"; import { PieGraph } from "components/ui"; -import { STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard"; import { STATE_GROUPS } from "constants/state"; import { getCustomDates } from "helpers/dashboard.helper"; import { useDashboard } from "hooks/store"; // components // helpers // types -import { - EDurationFilters, - TIssuesByStateGroupsWidgetFilters, - TIssuesByStateGroupsWidgetResponse, - TStateGroups, -} from "@plane/types"; +import { TIssuesByStateGroupsWidgetFilters, TIssuesByStateGroupsWidgetResponse, TStateGroups } from "@plane/types"; // constants +import { EDurationFilters, STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard"; const WIDGET_KEY = "issues_by_state_groups"; @@ -84,14 +79,14 @@ export const IssuesByStateGroupWidget: React.FC = observer((props) startedCount > 0 ? "started" : unStartedCount > 0 - ? "unstarted" - : backlogCount > 0 - ? "backlog" - : completedCount > 0 - ? "completed" - : canceledCount > 0 - ? "cancelled" - : null; + ? "unstarted" + : backlogCount > 0 + ? "backlog" + : completedCount > 0 + ? "completed" + : canceledCount > 0 + ? "cancelled" + : null; setActiveStateGroup(stateGroup); setDefaultStateGroup(stateGroup); diff --git a/web/constants/dashboard.ts b/web/constants/dashboard.ts index a3f5f7e00..35599d661 100644 --- a/web/constants/dashboard.ts +++ b/web/constants/dashboard.ts @@ -10,7 +10,7 @@ import CompletedIssuesLight from "public/empty-state/dashboard/light/completed-i import OverdueIssuesLight from "public/empty-state/dashboard/light/overdue-issues.svg"; import UpcomingIssuesLight from "public/empty-state/dashboard/light/upcoming-issues.svg"; // types -import { EDurationFilters, TIssuesListTypes, TStateGroups } from "@plane/types"; +import { TIssuesListTypes, TStateGroups } from "@plane/types"; import { Props } from "components/icons/types"; // constants import { EUserWorkspaceRoles } from "./workspace"; @@ -117,6 +117,15 @@ export const STATE_GROUP_GRAPH_COLORS: Record = { cancelled: "#E5484D", }; +export enum EDurationFilters { + NONE = "none", + TODAY = "today", + THIS_WEEK = "this_week", + THIS_MONTH = "this_month", + THIS_YEAR = "this_year", + CUSTOM = "custom", +} + // filter duration options export const DURATION_FILTER_OPTIONS: { key: EDurationFilters; diff --git a/web/helpers/dashboard.helper.ts b/web/helpers/dashboard.helper.ts index a61ec7f78..c8c2e7746 100644 --- a/web/helpers/dashboard.helper.ts +++ b/web/helpers/dashboard.helper.ts @@ -2,9 +2,9 @@ import { endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYea // helpers import { renderFormattedDate, renderFormattedPayloadDate } from "./date-time.helper"; // types -import { EDurationFilters, TIssuesListTypes } from "@plane/types"; +import { TIssuesListTypes } from "@plane/types"; // constants -import { DURATION_FILTER_OPTIONS } from "constants/dashboard"; +import { DURATION_FILTER_OPTIONS, EDurationFilters } from "constants/dashboard"; /** * @description returns date range based on the duration filter