feat: init
This commit is contained in:
122
apps/web/ce/helpers/command-palette.ts
Normal file
122
apps/web/ce/helpers/command-palette.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
// types
|
||||
import {
|
||||
CYCLE_TRACKER_ELEMENTS,
|
||||
MODULE_TRACKER_ELEMENTS,
|
||||
PROJECT_PAGE_TRACKER_ELEMENTS,
|
||||
PROJECT_TRACKER_ELEMENTS,
|
||||
PROJECT_VIEW_TRACKER_ELEMENTS,
|
||||
WORK_ITEM_TRACKER_ELEMENTS,
|
||||
} from "@plane/constants";
|
||||
import type { TCommandPaletteActionList, TCommandPaletteShortcut, TCommandPaletteShortcutList } from "@plane/types";
|
||||
// store
|
||||
import { captureClick } from "@/helpers/event-tracker.helper";
|
||||
import { store } from "@/lib/store-context";
|
||||
|
||||
export const getGlobalShortcutsList: () => TCommandPaletteActionList = () => {
|
||||
const { toggleCreateIssueModal } = store.commandPalette;
|
||||
|
||||
return {
|
||||
c: {
|
||||
title: "Create a new work item",
|
||||
description: "Create a new work item in the current project",
|
||||
action: () => {
|
||||
toggleCreateIssueModal(true);
|
||||
captureClick({ elementName: WORK_ITEM_TRACKER_ELEMENTS.COMMAND_PALETTE_ADD_BUTTON });
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const getWorkspaceShortcutsList: () => TCommandPaletteActionList = () => {
|
||||
const { toggleCreateProjectModal } = store.commandPalette;
|
||||
|
||||
return {
|
||||
p: {
|
||||
title: "Create a new project",
|
||||
description: "Create a new project in the current workspace",
|
||||
action: () => {
|
||||
toggleCreateProjectModal(true);
|
||||
captureClick({ elementName: PROJECT_TRACKER_ELEMENTS.COMMAND_PALETTE_SHORTCUT_CREATE_BUTTON });
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const getProjectShortcutsList: () => TCommandPaletteActionList = () => {
|
||||
const {
|
||||
toggleCreatePageModal,
|
||||
toggleCreateModuleModal,
|
||||
toggleCreateCycleModal,
|
||||
toggleCreateViewModal,
|
||||
toggleBulkDeleteIssueModal,
|
||||
} = store.commandPalette;
|
||||
|
||||
return {
|
||||
d: {
|
||||
title: "Create a new page",
|
||||
description: "Create a new page in the current project",
|
||||
action: () => {
|
||||
toggleCreatePageModal({ isOpen: true });
|
||||
captureClick({ elementName: PROJECT_PAGE_TRACKER_ELEMENTS.COMMAND_PALETTE_SHORTCUT_CREATE_BUTTON });
|
||||
},
|
||||
},
|
||||
m: {
|
||||
title: "Create a new module",
|
||||
description: "Create a new module in the current project",
|
||||
action: () => {
|
||||
toggleCreateModuleModal(true);
|
||||
captureClick({ elementName: MODULE_TRACKER_ELEMENTS.COMMAND_PALETTE_ADD_ITEM });
|
||||
},
|
||||
},
|
||||
q: {
|
||||
title: "Create a new cycle",
|
||||
description: "Create a new cycle in the current project",
|
||||
action: () => {
|
||||
toggleCreateCycleModal(true);
|
||||
captureClick({ elementName: CYCLE_TRACKER_ELEMENTS.COMMAND_PALETTE_ADD_ITEM });
|
||||
},
|
||||
},
|
||||
v: {
|
||||
title: "Create a new view",
|
||||
description: "Create a new view in the current project",
|
||||
action: () => {
|
||||
toggleCreateViewModal(true);
|
||||
captureClick({ elementName: PROJECT_VIEW_TRACKER_ELEMENTS.COMMAND_PALETTE_ADD_ITEM });
|
||||
},
|
||||
},
|
||||
backspace: {
|
||||
title: "Bulk delete work items",
|
||||
description: "Bulk delete work items in the current project",
|
||||
action: () => toggleBulkDeleteIssueModal(true),
|
||||
},
|
||||
delete: {
|
||||
title: "Bulk delete work items",
|
||||
description: "Bulk delete work items in the current project",
|
||||
action: () => toggleBulkDeleteIssueModal(true),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const handleAdditionalKeyDownEvents = (e: KeyboardEvent) => null;
|
||||
|
||||
export const getNavigationShortcutsList = (): TCommandPaletteShortcut[] => [
|
||||
{ keys: "Ctrl,K", description: "Open command menu" },
|
||||
];
|
||||
|
||||
export const getCommonShortcutsList = (platform: string): TCommandPaletteShortcut[] => [
|
||||
{ keys: "P", description: "Create project" },
|
||||
{ keys: "C", description: "Create work item" },
|
||||
{ keys: "Q", description: "Create cycle" },
|
||||
{ keys: "M", description: "Create module" },
|
||||
{ keys: "V", description: "Create view" },
|
||||
{ keys: "D", description: "Create page" },
|
||||
{ keys: "Delete", description: "Bulk delete work items" },
|
||||
{ keys: "Shift,/", description: "Open shortcuts guide" },
|
||||
{
|
||||
keys: platform === "MacOS" ? "Ctrl,control,C" : "Ctrl,Alt,C",
|
||||
description: "Copy work item URL from the work item details page",
|
||||
},
|
||||
];
|
||||
|
||||
export const getAdditionalShortcutsList = (): TCommandPaletteShortcutList[] => [];
|
||||
15
apps/web/ce/helpers/epic-analytics.ts
Normal file
15
apps/web/ce/helpers/epic-analytics.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { TEpicAnalyticsGroup } from "@plane/types";
|
||||
|
||||
export const updateEpicAnalytics = () => {
|
||||
const updateAnalytics = (
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
epicId: string,
|
||||
data: {
|
||||
incrementStateGroupCount?: TEpicAnalyticsGroup;
|
||||
decrementStateGroupCount?: TEpicAnalyticsGroup;
|
||||
}
|
||||
) => {};
|
||||
|
||||
return { updateAnalytics };
|
||||
};
|
||||
7
apps/web/ce/helpers/instance.helper.ts
Normal file
7
apps/web/ce/helpers/instance.helper.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { store } from "@/lib/store-context";
|
||||
|
||||
export const getIsWorkspaceCreationDisabled = () => {
|
||||
const instanceConfig = store.instance.config;
|
||||
|
||||
return instanceConfig?.is_workspace_creation_disabled;
|
||||
};
|
||||
22
apps/web/ce/helpers/issue-action-helper.ts
Normal file
22
apps/web/ce/helpers/issue-action-helper.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { IssueActions } from "@/hooks/use-issues-actions";
|
||||
|
||||
export const useTeamIssueActions: () => IssueActions = () => ({
|
||||
fetchIssues: () => Promise.resolve(undefined),
|
||||
fetchNextIssues: () => Promise.resolve(undefined),
|
||||
removeIssue: () => Promise.resolve(undefined),
|
||||
updateFilters: () => Promise.resolve(undefined),
|
||||
});
|
||||
|
||||
export const useTeamViewIssueActions: () => IssueActions = () => ({
|
||||
fetchIssues: () => Promise.resolve(undefined),
|
||||
fetchNextIssues: () => Promise.resolve(undefined),
|
||||
removeIssue: () => Promise.resolve(undefined),
|
||||
updateFilters: () => Promise.resolve(undefined),
|
||||
});
|
||||
|
||||
export const useTeamProjectWorkItemsActions: () => IssueActions = () => ({
|
||||
fetchIssues: () => Promise.resolve(undefined),
|
||||
fetchNextIssues: () => Promise.resolve(undefined),
|
||||
removeIssue: () => Promise.resolve(undefined),
|
||||
updateFilters: () => Promise.resolve(undefined),
|
||||
});
|
||||
30
apps/web/ce/helpers/issue-filter.helper.ts
Normal file
30
apps/web/ce/helpers/issue-filter.helper.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
// types
|
||||
import type { IIssueDisplayProperties } from "@plane/types";
|
||||
// lib
|
||||
import { store } from "@/lib/store-context";
|
||||
|
||||
export type TShouldRenderDisplayProperty = {
|
||||
workspaceSlug: string;
|
||||
projectId: string | undefined;
|
||||
key: keyof IIssueDisplayProperties;
|
||||
};
|
||||
|
||||
export const shouldRenderDisplayProperty = (props: TShouldRenderDisplayProperty) => {
|
||||
const { key } = props;
|
||||
switch (key) {
|
||||
case "issue_type":
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
export const shouldRenderColumn = (key: keyof IIssueDisplayProperties): boolean => {
|
||||
const isEstimateEnabled: boolean = store.projectRoot.project.currentProjectDetails?.estimate !== null;
|
||||
switch (key) {
|
||||
case "estimate":
|
||||
return isEstimateEnabled;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
3
apps/web/ce/helpers/pi-chat.helper.ts
Normal file
3
apps/web/ce/helpers/pi-chat.helper.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const hideFloatingBot = () => {};
|
||||
|
||||
export const showFloatingBot = () => {};
|
||||
7
apps/web/ce/helpers/project-settings.ts
Normal file
7
apps/web/ce/helpers/project-settings.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @description Get the i18n key for the project settings page label
|
||||
* @param _settingsKey - The key of the project settings page
|
||||
* @param defaultLabelKey - The default i18n key for the project settings page label
|
||||
* @returns The i18n key for the project settings page label
|
||||
*/
|
||||
export const getProjectSettingsPageLabelI18nKey = (_settingsKey: string, defaultLabelKey: string) => defaultLabelKey;
|
||||
20
apps/web/ce/helpers/work-item-filters/project-level.ts
Normal file
20
apps/web/ce/helpers/work-item-filters/project-level.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// plane imports
|
||||
import type { EIssuesStoreType } from "@plane/types";
|
||||
// plane web imports
|
||||
import type { TWorkItemFiltersEntityProps } from "@/plane-web/hooks/work-item-filters/use-work-item-filters-config";
|
||||
|
||||
export type TGetAdditionalPropsForProjectLevelFiltersHOCParams = {
|
||||
entityType: EIssuesStoreType;
|
||||
workspaceSlug: string;
|
||||
projectId: string;
|
||||
};
|
||||
|
||||
export type TGetAdditionalPropsForProjectLevelFiltersHOC = (
|
||||
params: TGetAdditionalPropsForProjectLevelFiltersHOCParams
|
||||
) => TWorkItemFiltersEntityProps;
|
||||
|
||||
export const getAdditionalProjectLevelFiltersHOCProps: TGetAdditionalPropsForProjectLevelFiltersHOC = ({
|
||||
workspaceSlug,
|
||||
}) => ({
|
||||
workspaceSlug,
|
||||
});
|
||||
2
apps/web/ce/helpers/workspace.helper.ts
Normal file
2
apps/web/ce/helpers/workspace.helper.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export type TRenderSettingsLink = (workspaceSlug: string, settingKey: string) => boolean;
|
||||
export const shouldRenderSettingLink: TRenderSettingsLink = (workspaceSlug, settingKey) => true;
|
||||
Reference in New Issue
Block a user