forked from github/plane
[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:
parent
cace132a2a
commit
b3d3c0fb06
@ -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"
|
@ -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",
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from "./dashboard";
|
|
||||||
export * from "./enums";
|
|
10
packages/types/src/index.d.ts
vendored
10
packages/types/src/index.d.ts
vendored
@ -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)];
|
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -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[];
|
||||||
|
@ -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;
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -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";
|
||||||
|
|
||||||
@ -84,14 +79,14 @@ export const IssuesByStateGroupWidget: React.FC<WidgetProps> = observer((props)
|
|||||||
startedCount > 0
|
startedCount > 0
|
||||||
? "started"
|
? "started"
|
||||||
: unStartedCount > 0
|
: unStartedCount > 0
|
||||||
? "unstarted"
|
? "unstarted"
|
||||||
: backlogCount > 0
|
: backlogCount > 0
|
||||||
? "backlog"
|
? "backlog"
|
||||||
: completedCount > 0
|
: completedCount > 0
|
||||||
? "completed"
|
? "completed"
|
||||||
: canceledCount > 0
|
: canceledCount > 0
|
||||||
? "cancelled"
|
? "cancelled"
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
setActiveStateGroup(stateGroup);
|
setActiveStateGroup(stateGroup);
|
||||||
setDefaultStateGroup(stateGroup);
|
setDefaultStateGroup(stateGroup);
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user