[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 { 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"

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 "./instance";
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 { 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";

View File

@ -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";

View File

@ -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[];

View File

@ -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;

View File

@ -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";

View File

@ -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<WidgetProps> = 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);

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 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<TStateGroups, string> = {
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;

View File

@ -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