* feat: event tracker helper * feat: track click events for `data-ph-element` * fix: handled click events * fix: handled name * chore: tracker element updates * chore: remove export * chore: tracker element type * chore: track element and event helper. * chore: minor improvements * chore: minor refactors * fix: workspace events * fix: added slug * fix: changes nomenclature * fix: nomenclature * chore: update event tracker helper types * fix: data id * refactor: cycle events (#7290) * chore: update event tracker helper types * refactor: cycle events * refactor: cycle events * refactor: cycle event tracker * chore: update tracker elements * chore: check for closest element with data-ph-element attribute --------- Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local> * Refactor module events (#7291) * chore: update event tracker helper types * refactor: cycle events * refactor: cycle events * refactor: cycle event tracker * refactor: module tracker event and element * chore: update tracker element * chore: revert unnecessary changes --------- Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local> * refactor: global views, product tour, notifications, onboarding, users and sidebar related events * chore: member tracker events (#7302) * chore: member-tracker-events * fix: constants * refactor: update event tracker constants * refactor: auth related event trackers (#7306) * Chore: state events (#7307) * chore: state events * fix: refactor * chore: project events (#7305) * chore: project-events * fix: refactor * fix: removed hardcoded values * fix: github redirection event * chore: project page tracker events (#7304) * added events for most page events * refactor: simplify lock button event handling in PageLockControl --------- Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com> Co-authored-by: M. Palanikannan <73993394+Palanikannan1437@users.noreply.github.com> * chore: minor cleanup and import fixes * refactor: added tracker elements for buttons (#7308) Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> * fix: event type * refactor: posthog group event * chore: removed instances of event tracker (#7309) * refactor: remove event tracker stores and hooks * refactor: remove event tracker store * fix: build errors * clean up event tracker payloads * fix: coderabbit suggestions --------- Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com> Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com> Co-authored-by: M. Palanikannan <73993394+Palanikannan1437@users.noreply.github.com> Co-authored-by: Vamsi Krishna <46787868+vamsikrishnamathala@users.noreply.github.com>
118 lines
3.9 KiB
TypeScript
118 lines
3.9 KiB
TypeScript
// types
|
|
import {
|
|
CYCLE_TRACKER_ELEMENTS,
|
|
MODULE_TRACKER_ELEMENTS,
|
|
PROJECT_PAGE_TRACKER_ELEMENTS,
|
|
PROJECT_TRACKER_ELEMENTS,
|
|
WORK_ITEM_TRACKER_ELEMENTS,
|
|
} from "@plane/constants";
|
|
import { 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),
|
|
},
|
|
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[] => [];
|