From addbf18c0003323625fd8abfaf7876003a5fda4f Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Wed, 6 Mar 2024 15:08:25 +0530 Subject: [PATCH 1/3] fix: enums export in the types package --- .../{dashboard/dashboard.d.ts => dashboard.ts} | 18 +++++++++++++----- packages/types/src/dashboard/enums.ts | 8 -------- packages/types/src/dashboard/index.ts | 2 -- packages/types/src/index.d.ts | 16 +++++++--------- .../dashboard/widgets/assigned-issues.tsx | 4 ++-- .../dashboard/widgets/created-issues.tsx | 4 ++-- .../widgets/dropdowns/duration-filter.tsx | 4 +--- .../widgets/issue-panels/tabs-list.tsx | 4 ++-- .../dashboard/widgets/issues-by-priority.tsx | 3 ++- .../widgets/issues-by-state-group.tsx | 9 ++------- web/constants/dashboard.ts | 11 ++++++++++- web/helpers/dashboard.helper.ts | 4 ++-- 12 files changed, 43 insertions(+), 44 deletions(-) rename packages/types/src/{dashboard/dashboard.d.ts => dashboard.ts} (91%) delete mode 100644 packages/types/src/dashboard/enums.ts delete mode 100644 packages/types/src/dashboard/index.ts 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 d565f668867..be7d7b3be70 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 2c9efd5c35d..00000000000 --- 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 dec14aea6a9..00000000000 --- 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 b1eb38a567f..8a0aee6a6d1 100644 --- a/packages/types/src/index.d.ts +++ b/packages/types/src/index.d.ts @@ -30,12 +30,10 @@ 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)]; +// 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 407ac9ddf24..6f7a17e02f9 100644 --- a/web/components/dashboard/widgets/assigned-issues.tsx +++ b/web/components/dashboard/widgets/assigned-issues.tsx @@ -15,9 +15,9 @@ import { // 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 { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; +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 23e7bee2771..5726d783708 100644 --- a/web/components/dashboard/widgets/created-issues.tsx +++ b/web/components/dashboard/widgets/created-issues.tsx @@ -15,9 +15,9 @@ import { // 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 { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; +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 fbdac4f00e0..a2b276c700a 100644 --- a/web/components/dashboard/widgets/dropdowns/duration-filter.tsx +++ b/web/components/dashboard/widgets/dropdowns/duration-filter.tsx @@ -6,10 +6,8 @@ import { DateFilterModal } from "components/core"; import { CustomMenu } from "@plane/ui"; // helpers import { getDurationFilterDropdownLabel } from "helpers/dashboard.helper"; -// types -import { EDurationFilters } from "@plane/types"; // constants -import { DURATION_FILTER_OPTIONS } from "constants/dashboard"; +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 d18f08f2755..257f73851ae 100644 --- a/web/components/dashboard/widgets/issue-panels/tabs-list.tsx +++ b/web/components/dashboard/widgets/issue-panels/tabs-list.tsx @@ -3,9 +3,9 @@ import { Tab } from "@headlessui/react"; // helpers import { cn } from "helpers/common.helper"; // types -import { EDurationFilters, TIssuesListTypes } from "@plane/types"; +import { TIssuesListTypes } from "@plane/types"; // constants -import { FILTERED_ISSUES_TABS_LIST, UNFILTERED_ISSUES_TABS_LIST } from "constants/dashboard"; +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 3e9823fe4e9..a8145df735f 100644 --- a/web/components/dashboard/widgets/issues-by-priority.tsx +++ b/web/components/dashboard/widgets/issues-by-priority.tsx @@ -14,9 +14,10 @@ import { // helpers import { getCustomDates } from "helpers/dashboard.helper"; // types -import { EDurationFilters, TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types"; +import { TIssuesByPriorityWidgetFilters, TIssuesByPriorityWidgetResponse } from "@plane/types"; // constants import { IssuesByPriorityGraph } from "components/graphs"; +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 b301d30f3fe..b3e5b9c4934 100644 --- a/web/components/dashboard/widgets/issues-by-state-group.tsx +++ b/web/components/dashboard/widgets/issues-by-state-group.tsx @@ -15,14 +15,9 @@ import { // helpers import { getCustomDates } from "helpers/dashboard.helper"; // types -import { - EDurationFilters, - TIssuesByStateGroupsWidgetFilters, - TIssuesByStateGroupsWidgetResponse, - TStateGroups, -} from "@plane/types"; +import { TIssuesByStateGroupsWidgetFilters, TIssuesByStateGroupsWidgetResponse, TStateGroups } from "@plane/types"; // constants -import { STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard"; +import { EDurationFilters, STATE_GROUP_GRAPH_COLORS, STATE_GROUP_GRAPH_GRADIENTS } from "constants/dashboard"; import { STATE_GROUPS } from "constants/state"; const WIDGET_KEY = "issues_by_state_groups"; diff --git a/web/constants/dashboard.ts b/web/constants/dashboard.ts index 6ac4e78174c..4668754f239 100644 --- a/web/constants/dashboard.ts +++ b/web/constants/dashboard.ts @@ -7,7 +7,7 @@ import OverdueIssuesLight from "public/empty-state/dashboard/light/overdue-issue import CompletedIssuesDark from "public/empty-state/dashboard/dark/completed-issues.svg"; import CompletedIssuesLight from "public/empty-state/dashboard/light/completed-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"; @@ -116,6 +116,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 a61ec7f782a..c8c2e7746e7 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 From 0b7614579249d4989a9637d3d83196d824a1ba7b Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Wed, 6 Mar 2024 15:14:16 +0530 Subject: [PATCH 2/3] chore: remove NestedKeyOf type --- packages/types/src/index.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/types/src/index.d.ts b/packages/types/src/index.d.ts index 8a0aee6a6d1..bfebd92d044 100644 --- a/packages/types/src/index.d.ts +++ b/packages/types/src/index.d.ts @@ -29,11 +29,3 @@ export * from "./auth"; export * from "./api_token"; export * from "./instance"; export * from "./app"; - -// 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)]; From f113464b4eb69a70af61bac21fb55000cb97b706 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 6 Mar 2024 17:04:12 +0530 Subject: [PATCH 3/3] chore: peek overview keyboard accessibility improvement --- web/components/issues/peek-overview/view.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/components/issues/peek-overview/view.tsx b/web/components/issues/peek-overview/view.tsx index f94901c454f..97caf65c500 100644 --- a/web/components/issues/peek-overview/view.tsx +++ b/web/components/issues/peek-overview/view.tsx @@ -60,7 +60,9 @@ export const IssueView: FC = observer((props) => { } }); const handleKeyDown = () => { - if (!isAnyModalOpen) { + const slashCommandDropdownElement = document.querySelector("#slash-command"); + const dropdownElement = document.activeElement?.tagName === "INPUT"; + if (!isAnyModalOpen && !slashCommandDropdownElement && !dropdownElement) { removeRoutePeekId(); const issueElement = document.getElementById(`issue-${issueId}`); if (issueElement) issueElement?.focus();