From 0970d7181e48d03a6664e1a83352264e28818910 Mon Sep 17 00:00:00 2001 From: LAKHAN BAHETI Date: Fri, 15 Mar 2024 12:04:34 +0530 Subject: [PATCH] chore: All event elements defined in constants. --- .../actions/project-actions.tsx | 10 ++- .../command-palette/command-modal.tsx | 6 +- .../command-palette/command-palette.tsx | 4 +- .../upcoming-cycles-list-item.tsx | 6 +- .../cycles/board/cycles-board-card.tsx | 6 +- .../cycles/list/cycles-list-item.tsx | 6 +- web/components/cycles/quick-actions.tsx | 5 +- web/components/cycles/sidebar.tsx | 8 +- .../dashboard/project-empty-state.tsx | 3 +- .../widgets/issue-panels/issues-list.tsx | 4 +- .../dashboard/widgets/recent-projects.tsx | 3 +- web/components/headers/cycle-issues.tsx | 3 +- web/components/headers/cycles.tsx | 4 +- web/components/headers/module-issues.tsx | 3 +- web/components/headers/modules-list.tsx | 3 +- web/components/headers/pages.tsx | 5 +- web/components/headers/project-issues.tsx | 3 +- .../headers/project-view-issues.tsx | 3 +- web/components/headers/project-views.tsx | 3 +- web/components/headers/projects.tsx | 3 +- web/components/inbox/inbox-issue-actions.tsx | 6 +- .../inbox/modals/create-issue-modal.tsx | 8 +- .../integration/jira/give-details.tsx | 4 +- web/components/issues/attachment/root.tsx | 10 ++- .../issues/issue-detail/inbox/root.tsx | 9 ++- web/components/issues/issue-detail/root.tsx | 30 ++++---- .../calendar/quick-add-issue-form.tsx | 6 +- .../issue-layouts/empty-states/cycle.tsx | 3 +- .../empty-states/global-view.tsx | 6 +- .../issue-layouts/empty-states/module.tsx | 3 +- .../empty-states/project-issues.tsx | 3 +- .../empty-states/project-view.tsx | 4 +- .../roots/global-view-root.tsx | 4 +- .../gantt/quick-add-issue-form.tsx | 6 +- .../kanban/headers/group-by-card.tsx | 9 ++- .../kanban/quick-add-issue-form.tsx | 6 +- .../list/headers/group-by-card.tsx | 8 +- .../list/quick-add-issue-form.tsx | 6 +- .../quick-action-dropdowns/all-issue.tsx | 7 +- .../roots/all-issue-layout-root.tsx | 5 +- .../spreadsheet/columns/cycle-column.tsx | 3 +- .../spreadsheet/columns/module-column.tsx | 3 +- .../spreadsheet/issue-column.tsx | 6 +- .../spreadsheet/quick-add-issue-form.tsx | 6 +- web/components/issues/peek-overview/root.tsx | 33 ++++---- web/components/issues/sub-issues/root.tsx | 22 +++--- web/components/labels/create-label-modal.tsx | 4 +- .../labels/create-update-label-inline.tsx | 6 +- web/components/labels/delete-label-modal.tsx | 6 +- web/components/modules/module-card-item.tsx | 14 ++-- web/components/modules/module-list-item.tsx | 10 +-- web/components/modules/modules-list-view.tsx | 3 +- web/components/modules/sidebar.tsx | 13 +++- .../notifications/notification-card.tsx | 4 +- web/components/onboarding/invitations.tsx | 6 +- web/components/onboarding/invite-members.tsx | 6 +- web/components/onboarding/tour/root.tsx | 4 +- web/components/onboarding/user-details.tsx | 6 +- web/components/onboarding/workspace.tsx | 6 +- .../page-views/workspace-dashboard.tsx | 4 +- web/components/pages/pages-list/list-item.tsx | 16 ++-- web/components/project/card-list.tsx | 3 +- .../project/delete-project-modal.tsx | 6 +- web/components/project/form.tsx | 6 +- .../project/leave-project-modal.tsx | 6 +- web/components/project/member-list-item.tsx | 8 +- web/components/project/member-list.tsx | 4 +- .../project/send-project-invitation-modal.tsx | 6 +- .../project/settings/features-list.tsx | 3 +- web/components/project/sidebar-list-item.tsx | 4 +- web/components/project/sidebar-list.tsx | 9 ++- .../states/create-update-state-inline.tsx | 12 +-- .../project-setting-state-list-item.tsx | 4 +- .../states/project-setting-state-list.tsx | 2 +- web/components/views/delete-view-modal.tsx | 6 +- web/components/views/modal.tsx | 6 +- web/components/views/view-list-item.tsx | 6 +- web/components/views/views-list.tsx | 3 +- .../workspace/create-workspace-form.tsx | 6 +- .../workspace/delete-workspace-modal.tsx | 6 +- .../workspace/settings/members-list-item.tsx | 8 +- .../workspace/settings/workspace-details.tsx | 6 +- .../workspace/sidebar-quick-action.tsx | 4 +- .../workspace/views/view-list-item.tsx | 4 +- web/constants/event-tracker.ts | 76 ++++++++++++++++++- web/layouts/auth-layout/project-wrapper.tsx | 4 +- web/pages/[workspaceSlug]/analytics.tsx | 3 +- .../projects/[projectId]/cycles/index.tsx | 3 +- .../projects/[projectId]/pages/[pageId].tsx | 17 +++-- .../projects/[projectId]/pages/index.tsx | 3 +- .../[workspaceSlug]/settings/members.tsx | 6 +- web/pages/invitations/index.tsx | 6 +- 92 files changed, 403 insertions(+), 258 deletions(-) diff --git a/web/components/command-palette/actions/project-actions.tsx b/web/components/command-palette/actions/project-actions.tsx index d1589cb92..ccba1136f 100644 --- a/web/components/command-palette/actions/project-actions.tsx +++ b/web/components/command-palette/actions/project-actions.tsx @@ -3,6 +3,8 @@ import { ContrastIcon, FileText } from "lucide-react"; // hooks import { DiceIcon, PhotoFilterIcon } from "@plane/ui"; import { useApplication, useEventTracker } from "hooks/store"; +// constants +import { E_COMMAND_PALETTE } from "constants/event-tracker"; // ui type Props = { @@ -23,7 +25,7 @@ export const CommandPaletteProjectActions: React.FC = (props) => { { closePalette(); - setTrackElement("Command palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreateCycleModal(true); }} className="focus:outline-none" @@ -39,7 +41,7 @@ export const CommandPaletteProjectActions: React.FC = (props) => { { closePalette(); - setTrackElement("Command palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreateModuleModal(true); }} className="focus:outline-none" @@ -55,7 +57,7 @@ export const CommandPaletteProjectActions: React.FC = (props) => { { closePalette(); - setTrackElement("Command palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreateViewModal(true); }} className="focus:outline-none" @@ -71,7 +73,7 @@ export const CommandPaletteProjectActions: React.FC = (props) => { { closePalette(); - setTrackElement("Command palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreatePageModal(true); }} className="focus:outline-none" diff --git a/web/components/command-palette/command-modal.tsx b/web/components/command-palette/command-modal.tsx index cffd3ff11..faab27f84 100644 --- a/web/components/command-palette/command-modal.tsx +++ b/web/components/command-palette/command-modal.tsx @@ -27,6 +27,8 @@ import { IssueService } from "services/issue"; import { WorkspaceService } from "services/workspace.service"; // types import { IWorkspaceSearchResults } from "@plane/types"; +// constants +import { E_COMMAND_PALETTE } from "constants/event-tracker"; // fetch-keys // services @@ -279,7 +281,7 @@ export const CommandModal: React.FC = observer(() => { { closePalette(); - setTrackElement("Command Palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreateIssueModal(true); }} className="focus:bg-custom-background-80" @@ -297,7 +299,7 @@ export const CommandModal: React.FC = observer(() => { { closePalette(); - setTrackElement("Command palette"); + setTrackElement(E_COMMAND_PALETTE); toggleCreateProjectModal(true); }} className="focus:outline-none" diff --git a/web/components/command-palette/command-palette.tsx b/web/components/command-palette/command-palette.tsx index ab2743afd..226ba5802 100644 --- a/web/components/command-palette/command-palette.tsx +++ b/web/components/command-palette/command-palette.tsx @@ -23,6 +23,8 @@ import { EIssuesStoreType } from "constants/issue"; import { copyTextToClipboard } from "helpers/string.helper"; import { useApplication, useEventTracker, useIssues, useUser } from "hooks/store"; import { IssueService } from "services/issue"; +// constants +import { E_SHORTCUT_KEY } from "constants/event-tracker"; // services const issueService = new IssueService(); @@ -118,7 +120,7 @@ export const CommandPalette: FC = observer(() => { toggleSidebar(); } } else if (!isAnyModalOpen) { - setTrackElement("Shortcut key"); + setTrackElement(E_SHORTCUT_KEY); if (keyPressed === "c") { toggleCreateIssueModal(true); } else if (keyPressed === "p") { diff --git a/web/components/cycles/active-cycle/upcoming-cycles-list-item.tsx b/web/components/cycles/active-cycle/upcoming-cycles-list-item.tsx index af2b02726..c24c80823 100644 --- a/web/components/cycles/active-cycle/upcoming-cycles-list-item.tsx +++ b/web/components/cycles/active-cycle/upcoming-cycles-list-item.tsx @@ -11,7 +11,7 @@ import { Avatar, AvatarGroup, setPromiseToast } from "@plane/ui"; // helpers import { renderFormattedDate } from "helpers/date-time.helper"; // constants -import { CYCLE_FAVORITED, CYCLE_UNFAVORITED } from "constants/event-tracker"; +import { CYCLE_FAVORITED, CYCLE_UNFAVORITED, E_LIST_LAYOUT } from "constants/event-tracker"; type Props = { cycleId: string; @@ -37,7 +37,7 @@ export const UpcomingCycleListItem: React.FC = observer((props) => { () => { captureEvent(CYCLE_FAVORITED, { cycle_id: cycleId, - element: "List layout", + element: E_LIST_LAYOUT, state: "SUCCESS", }); } @@ -67,7 +67,7 @@ export const UpcomingCycleListItem: React.FC = observer((props) => { ).then(() => { captureEvent(CYCLE_UNFAVORITED, { cycle_id: cycleId, - element: "List layout", + element: E_LIST_LAYOUT, state: "SUCCESS", }); }); diff --git a/web/components/cycles/board/cycles-board-card.tsx b/web/components/cycles/board/cycles-board-card.tsx index c8ac630e7..d5c0b757d 100644 --- a/web/components/cycles/board/cycles-board-card.tsx +++ b/web/components/cycles/board/cycles-board-card.tsx @@ -12,7 +12,7 @@ import { CycleQuickActions } from "components/cycles"; // icons // helpers import { CYCLE_STATUS } from "constants/cycle"; -import { CYCLE_FAVORITED, CYCLE_UNFAVORITED } from "constants/event-tracker"; +import { CYCLE_FAVORITED, CYCLE_UNFAVORITED, E_GRID_LAYOUT } from "constants/event-tracker"; import { EUserWorkspaceRoles } from "constants/workspace"; import { findHowManyDaysLeft, renderFormattedDate } from "helpers/date-time.helper"; // constants @@ -78,7 +78,7 @@ export const CyclesBoardCard: FC = observer((props) => { () => { captureEvent(CYCLE_FAVORITED, { cycle_id: cycleId, - element: "Grid layout", + element: E_GRID_LAYOUT, state: "SUCCESS", }); } @@ -108,7 +108,7 @@ export const CyclesBoardCard: FC = observer((props) => { ).then(() => { captureEvent(CYCLE_UNFAVORITED, { cycle_id: cycleId, - element: "Grid layout", + element: E_GRID_LAYOUT, state: "SUCCESS", }); }); diff --git a/web/components/cycles/list/cycles-list-item.tsx b/web/components/cycles/list/cycles-list-item.tsx index 52eb3f732..94d476d90 100644 --- a/web/components/cycles/list/cycles-list-item.tsx +++ b/web/components/cycles/list/cycles-list-item.tsx @@ -8,7 +8,7 @@ import { Check, Info, Star, User2 } from "lucide-react"; import { Tooltip, CircularProgressIndicator, CycleGroupIcon, AvatarGroup, Avatar, setPromiseToast } from "@plane/ui"; import { CycleQuickActions } from "components/cycles"; import { CYCLE_STATUS } from "constants/cycle"; -import { CYCLE_FAVORITED, CYCLE_UNFAVORITED } from "constants/event-tracker"; +import { CYCLE_FAVORITED, CYCLE_UNFAVORITED, E_LIST_LAYOUT } from "constants/event-tracker"; import { findHowManyDaysLeft, renderFormattedDate } from "helpers/date-time.helper"; import { useEventTracker, useCycle, useUser, useMember } from "hooks/store"; // components @@ -52,7 +52,7 @@ export const CyclesListItem: FC = observer((props) => { () => { captureEvent(CYCLE_FAVORITED, { cycle_id: cycleId, - element: "List layout", + element: E_LIST_LAYOUT, state: "SUCCESS", }); } @@ -82,7 +82,7 @@ export const CyclesListItem: FC = observer((props) => { ).then(() => { captureEvent(CYCLE_UNFAVORITED, { cycle_id: cycleId, - element: "List layout", + element: E_LIST_LAYOUT, state: "SUCCESS", }); }); diff --git a/web/components/cycles/quick-actions.tsx b/web/components/cycles/quick-actions.tsx index f1c930ccb..27237a02b 100644 --- a/web/components/cycles/quick-actions.tsx +++ b/web/components/cycles/quick-actions.tsx @@ -11,6 +11,7 @@ import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui"; import { copyUrlToClipboard } from "helpers/string.helper"; // constants import { EUserProjectRoles } from "constants/project"; +import { E_CYCLES_LIST_LAYOUT } from "constants/event-tracker"; type Props = { cycleId: string; @@ -52,14 +53,14 @@ export const CycleQuickActions: React.FC = observer((props) => { const handleEditCycle = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); - setTrackElement("Cycles page list layout"); + setTrackElement(E_CYCLES_LIST_LAYOUT); setUpdateModal(true); }; const handleDeleteCycle = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); - setTrackElement("Cycles page list layout"); + setTrackElement(E_CYCLES_LIST_LAYOUT); setDeleteModal(true); }; diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx index bdbe206fc..9c45feed0 100644 --- a/web/components/cycles/sidebar.tsx +++ b/web/components/cycles/sidebar.tsx @@ -15,7 +15,7 @@ import { CycleDeleteModal } from "components/cycles/delete-modal"; import { DateRangeDropdown } from "components/dropdowns"; // constants import { CYCLE_STATUS } from "constants/cycle"; -import { CYCLE_UPDATED } from "constants/event-tracker"; +import { CYCLE_UPDATED, E_CYCLE_SIDEBAR, E_SIDEBAR } from "constants/event-tracker"; import { EUserWorkspaceRoles } from "constants/workspace"; // helpers import { findHowManyDaysLeft, renderFormattedPayloadDate } from "helpers/date-time.helper"; @@ -73,7 +73,7 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { payload: { ...res, changed_properties: [changedProperty], - element: "Right side-peek", + element: E_SIDEBAR, state: "SUCCESS", }, }); @@ -84,7 +84,7 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { eventName: CYCLE_UPDATED, payload: { ...data, - element: "Right side-peek", + element: E_SIDEBAR, state: "FAILED", }, }); @@ -253,7 +253,7 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { { - setTrackElement("CYCLE_PAGE_SIDEBAR"); + setTrackElement(E_CYCLE_SIDEBAR); setCycleDeleteModal(true); }} > diff --git a/web/components/dashboard/project-empty-state.tsx b/web/components/dashboard/project-empty-state.tsx index 32236e233..43c516757 100644 --- a/web/components/dashboard/project-empty-state.tsx +++ b/web/components/dashboard/project-empty-state.tsx @@ -8,6 +8,7 @@ import { useApplication, useEventTracker, useUser } from "hooks/store"; // assets import ProjectEmptyStateImage from "public/empty-state/dashboard/project.svg"; // constants +import { E_PROJECT_EMPTY_STATE } from "constants/event-tracker"; export const DashboardProjectEmptyState = observer(() => { // store hooks @@ -35,7 +36,7 @@ export const DashboardProjectEmptyState = observer(() => {