From 5033142a777a3829da7c40b505ee0df11bd8b8af Mon Sep 17 00:00:00 2001 From: EYHN Date: Tue, 27 May 2025 08:17:14 +0000 Subject: [PATCH] feat(core): all docs tracks (#12556) ## Summary by CodeRabbit - **New Features** - Added enhanced tracking for user interactions across document lists, navigation, display menus, quick actions, and collection operations. - User actions such as opening documents, editing collections, toggling favorites, changing view modes, and navigating collections are now logged for analytics. - **Chores** - Expanded internal event tracking capabilities to support more detailed analytics on user interactions throughout the interface. --- .../explorer/display-menu/group.tsx | 5 +++ .../explorer/display-menu/order.tsx | 5 +++ .../explorer/display-menu/properties.tsx | 9 ++++- .../explorer/display-menu/quick-actions.tsx | 5 +++ .../explorer/display-menu/view-toggle.tsx | 4 ++ .../explorer/docs-view/doc-list-item.tsx | 2 + .../explorer/docs-view/more-menu.tsx | 6 ++- .../explorer/docs-view/quick-actions.tsx | 4 ++ .../components/explorer/header/navigation.tsx | 6 +++ .../page-list/view/collection-operations.tsx | 2 + .../nodes/collection/operations.tsx | 1 + .../navigation-panel/nodes/doc/index.tsx | 3 ++ .../navigation-panel/nodes/doc/operations.tsx | 2 + .../workspace/all-page/pinned-collections.tsx | 33 +++++++++++------ .../workspace/collection/list-header.tsx | 2 + packages/frontend/track/src/events.ts | 37 +++++++++++++++++-- 16 files changed, 110 insertions(+), 16 deletions(-) diff --git a/packages/frontend/core/src/components/explorer/display-menu/group.tsx b/packages/frontend/core/src/components/explorer/display-menu/group.tsx index f97bf0daef..0d03d0add0 100644 --- a/packages/frontend/core/src/components/explorer/display-menu/group.tsx +++ b/packages/frontend/core/src/components/explorer/display-menu/group.tsx @@ -2,6 +2,7 @@ import { Divider, MenuItem } from '@affine/component'; import type { GroupByParams } from '@affine/core/modules/collection-rules/types'; import { WorkspacePropertyService } from '@affine/core/modules/workspace-property'; import { useI18n } from '@affine/i18n'; +import track from '@affine/track'; import { DoneIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; import { cssVarV2 } from '@toeverything/theme/v2'; @@ -128,6 +129,10 @@ const GroupByListItem = ({ { e.preventDefault(); + track.allDocs.header.displayMenu.editDisplayMenu({ + control: 'groupBy', + type: property.systemProperty?.type ?? 'custom-property', + }); if (value) { onChange?.(value); } diff --git a/packages/frontend/core/src/components/explorer/display-menu/order.tsx b/packages/frontend/core/src/components/explorer/display-menu/order.tsx index 292679a647..cff1601f79 100644 --- a/packages/frontend/core/src/components/explorer/display-menu/order.tsx +++ b/packages/frontend/core/src/components/explorer/display-menu/order.tsx @@ -2,6 +2,7 @@ import { MenuItem } from '@affine/component'; import type { OrderByParams } from '@affine/core/modules/collection-rules/types'; import { WorkspacePropertyService } from '@affine/core/modules/workspace-property'; import { useI18n } from '@affine/i18n'; +import track from '@affine/track'; import { SortDownIcon, SortUpIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; import { cssVarV2 } from '@toeverything/theme/v2'; @@ -125,6 +126,10 @@ const OrderByListItem = ({ { e.preventDefault(); + track.allDocs.header.displayMenu.editDisplayMenu({ + control: 'orderBy', + type: property.systemProperty?.type ?? 'custom-property', + }); if (value) { onChange?.(value); } diff --git a/packages/frontend/core/src/components/explorer/display-menu/properties.tsx b/packages/frontend/core/src/components/explorer/display-menu/properties.tsx index f4b307518f..7545c008dc 100644 --- a/packages/frontend/core/src/components/explorer/display-menu/properties.tsx +++ b/packages/frontend/core/src/components/explorer/display-menu/properties.tsx @@ -1,6 +1,7 @@ import { Button, Divider } from '@affine/component'; import { WorkspacePropertyService } from '@affine/core/modules/workspace-property'; import { useI18n } from '@affine/i18n'; +import track from '@affine/track'; import { useLiveData, useService } from '@toeverything/infra'; import { useCallback, useMemo } from 'react'; @@ -160,7 +161,13 @@ const PropertyRenderer = ({