[WEB-654] fix: enums export in the types package (#3887)

* fix: enums export in the types package

* chore: remove NestedKeyOf type
This commit is contained in:
Aaryan Khandelwal 2024-03-06 18:46:36 +05:30 committed by GitHub
parent cace132a2a
commit b3d3c0fb06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 52 additions and 58 deletions

View File

@ -1,8 +1,16 @@
import { IIssueActivity, TIssuePriorities } from "../issues"; import { IIssueActivity, TIssuePriorities } from "./issues";
import { TIssue } from "../issues/issue"; import { TIssue } from "./issues/issue";
import { TIssueRelationTypes } from "../issues/issue_relation"; import { TIssueRelationTypes } from "./issues/issue_relation";
import { TStateGroups } from "../state"; import { TStateGroups } from "./state";
import { EDurationFilters } from "./enums";
enum EDurationFilters {
NONE = "none",
TODAY = "today",
THIS_WEEK = "this_week",
THIS_MONTH = "this_month",
THIS_YEAR = "this_year",
CUSTOM = "custom",
}
export type TWidgetKeys = export type TWidgetKeys =
| "overview_stats" | "overview_stats"

View File

@ -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",
}

View File

@ -1,2 +0,0 @@
export * from "./dashboard";
export * from "./enums";

View File

@ -29,13 +29,3 @@ export * from "./auth";
export * from "./api_token"; export * from "./api_token";
export * from "./instance"; export * from "./instance";
export * from "./app"; export * from "./app";
export * from "./enums";
export type NestedKeyOf<ObjectType extends object> = {
[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
? ObjectType[Key] extends { pop: any; push: any }
? `${Key}`
: `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`
: `${Key}`;
}[keyof ObjectType & (string | number)];

View File

@ -3,6 +3,8 @@ import { observer } from "mobx-react-lite";
import Link from "next/link"; import Link from "next/link";
import { Tab } from "@headlessui/react"; import { Tab } from "@headlessui/react";
// hooks // hooks
import { useDashboard } from "hooks/store";
// components
import { import {
DurationFilterDropdown, DurationFilterDropdown,
TabsList, TabsList,
@ -10,14 +12,12 @@ import {
WidgetLoader, WidgetLoader,
WidgetProps, WidgetProps,
} from "components/dashboard/widgets"; } 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 // helpers
import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper";
// types // types
import { EDurationFilters, TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types"; import { TAssignedIssuesWidgetFilters, TAssignedIssuesWidgetResponse } from "@plane/types";
// constants // constants
import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
const WIDGET_KEY = "assigned_issues"; const WIDGET_KEY = "assigned_issues";

View File

@ -3,6 +3,8 @@ import { observer } from "mobx-react-lite";
import Link from "next/link"; import Link from "next/link";
import { Tab } from "@headlessui/react"; import { Tab } from "@headlessui/react";
// hooks // hooks
import { useDashboard } from "hooks/store";
// components
import { import {
DurationFilterDropdown, DurationFilterDropdown,
TabsList, TabsList,
@ -10,14 +12,12 @@ import {
WidgetLoader, WidgetLoader,
WidgetProps, WidgetProps,
} from "components/dashboard/widgets"; } 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 // helpers
import { getCustomDates, getRedirectionFilters, getTabKey } from "helpers/dashboard.helper";
// types // types
import { EDurationFilters, TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types"; import { TCreatedIssuesWidgetFilters, TCreatedIssuesWidgetResponse } from "@plane/types";
// constants // constants
import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
const WIDGET_KEY = "created_issues"; const WIDGET_KEY = "created_issues";

View File

@ -6,9 +6,8 @@ import { DateFilterModal } from "components/core";
// ui // ui
// helpers // helpers
import { getDurationFilterDropdownLabel } from "helpers/dashboard.helper"; import { getDurationFilterDropdownLabel } from "helpers/dashboard.helper";
// types
import { EDurationFilters } from "@plane/types";
// constants // constants
import { DURATION_FILTER_OPTIONS, EDurationFilters } from "constants/dashboard";
type Props = { type Props = {
customDates?: string[]; customDates?: string[];

View File

@ -1,11 +1,11 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { Tab } from "@headlessui/react"; import { Tab } from "@headlessui/react";
// helpers // helpers
import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
import { cn } from "helpers/common.helper"; import { cn } from "helpers/common.helper";
// types // types
import { EDurationFilters, TIssuesListTypes } from "@plane/types"; import { TIssuesListTypes } from "@plane/types";
// constants // constants
import { EDurationFilters, FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard";
type Props = { type Props = {
durationFilter: EDurationFilters; durationFilter: EDurationFilters;

View File

@ -3,6 +3,7 @@ import { observer } from "mobx-react-lite";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
// hooks // hooks
import { useDashboard } from "hooks/store";
// components // components
import { import {
DurationFilterDropdown, DurationFilterDropdown,
@ -11,10 +12,12 @@ import {
WidgetProps, WidgetProps,
} from "components/dashboard/widgets"; } from "components/dashboard/widgets";
// helpers // helpers
import { getCustomDates } from "helpers/dashboard.helper";
// types // types
import { TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types";
// constants // constants
import { IssuesByPriorityGraph } from "components/graphs"; import { IssuesByPriorityGraph } from "components/graphs";
import { EDurationFilters, TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types"; import { EDurationFilters } from "constants/dashboard";
const WIDGET_KEY = "issues_by_priority"; const WIDGET_KEY = "issues_by_priority";

View File

@ -10,20 +10,15 @@ import {
WidgetProps, WidgetProps,
} from "components/dashboard/widgets"; } from "components/dashboard/widgets";
import { PieGraph } from "components/ui"; import { PieGraph } from "components/ui";
import { STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard";
import { STATE_GROUPS } from "constants/state"; import { STATE_GROUPS } from "constants/state";
import { getCustomDates } from "helpers/dashboard.helper"; import { getCustomDates } from "helpers/dashboard.helper";
import { useDashboard } from "hooks/store"; import { useDashboard } from "hooks/store";
// components // components
// helpers // helpers
// types // types
import { import { TIssuesByStateGroupsWidgetFilters, TIssuesByStateGroupsWidgetResponse, TStateGroups } from "@plane/types";
EDurationFilters,
TIssuesByStateGroupsWidgetFilters,
TIssuesByStateGroupsWidgetResponse,
TStateGroups,
} from "@plane/types";
// constants // constants
import { EDurationFilters, STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard";
const WIDGET_KEY = "issues_by_state_groups"; const WIDGET_KEY = "issues_by_state_groups";

View File

@ -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 OverdueIssuesLight from "public/empty-state/dashboard/light/overdue-issues.svg";
import UpcomingIssuesLight from "public/empty-state/dashboard/light/upcoming-issues.svg"; import UpcomingIssuesLight from "public/empty-state/dashboard/light/upcoming-issues.svg";
// types // types
import { EDurationFilters, TIssuesListTypes, TStateGroups } from "@plane/types"; import { TIssuesListTypes, TStateGroups } from "@plane/types";
import { Props } from "components/icons/types"; import { Props } from "components/icons/types";
// constants // constants
import { EUserWorkspaceRoles } from "./workspace"; import { EUserWorkspaceRoles } from "./workspace";
@ -117,6 +117,15 @@ export const STATE_GROUP_GRAPH_COLORS: Record<TStateGroups, string> = {
cancelled: "#E5484D", 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 // filter duration options
export const DURATION_FILTER_OPTIONS: { export const DURATION_FILTER_OPTIONS: {
key: EDurationFilters; key: EDurationFilters;

View File

@ -2,9 +2,9 @@ import { endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYea
// helpers // helpers
import { renderFormattedDate, renderFormattedPayloadDate } from "./date-time.helper"; import { renderFormattedDate, renderFormattedPayloadDate } from "./date-time.helper";
// types // types
import { EDurationFilters, TIssuesListTypes } from "@plane/types"; import { TIssuesListTypes } from "@plane/types";
// constants // 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 * @description returns date range based on the duration filter