mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 02:35:58 +08:00
feat(core): all docs tracks (#12556)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -106,6 +106,7 @@ export const useNavigationPanelCollectionNodeOperations = (
|
||||
|
||||
const handleShowEdit = useCallback(() => {
|
||||
onOpenEdit();
|
||||
track.$.navigationPanel.collections.editCollection();
|
||||
}, [onOpenEdit]);
|
||||
|
||||
return useMemo(
|
||||
|
||||
@@ -251,6 +251,9 @@ export const NavigationPanelDocNode = ({
|
||||
setCollapsed={setCollapsed}
|
||||
canDrop={handleCanDrop}
|
||||
to={`/${docId}`}
|
||||
onClick={() => {
|
||||
track.$.navigationPanel.docs.openDoc();
|
||||
}}
|
||||
active={active}
|
||||
postfix={
|
||||
referencesLoading &&
|
||||
|
||||
@@ -105,6 +105,7 @@ export const useNavigationPanelDocNodeOperations = (
|
||||
workbenchService.workbench.openDoc(docId, {
|
||||
at: 'new-tab',
|
||||
});
|
||||
track.$.navigationPanel.docs.openDoc();
|
||||
track.$.navigationPanel.organize.openInNewTab({
|
||||
type: 'doc',
|
||||
});
|
||||
@@ -114,6 +115,7 @@ export const useNavigationPanelDocNodeOperations = (
|
||||
workbenchService.workbench.openDoc(docId, {
|
||||
at: 'beside',
|
||||
});
|
||||
track.$.navigationPanel.docs.openDoc();
|
||||
track.$.navigationPanel.organize.openInSplitView({
|
||||
type: 'doc',
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import type { FilterParams } from '@affine/core/modules/collection-rules';
|
||||
import { WorkspaceDialogService } from '@affine/core/modules/dialogs';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import {
|
||||
CloseIcon,
|
||||
CollectionsIcon,
|
||||
@@ -102,10 +103,15 @@ export const PinnedCollections = ({
|
||||
<div
|
||||
className={styles.item}
|
||||
data-active={activeCollectionId === null ? 'true' : undefined}
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
// only fire onActiveAll if the collection is not already active
|
||||
activeCollectionId !== null ? onActiveAll() : undefined
|
||||
}
|
||||
if (activeCollectionId !== null) {
|
||||
track.allDocs.header.navigation.navigatePinedCollectionRouter({
|
||||
control: 'all',
|
||||
});
|
||||
onActiveAll();
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
>
|
||||
{t['com.affine.all-docs.pinned-collection.all']()}
|
||||
@@ -115,12 +121,15 @@ export const PinnedCollections = ({
|
||||
key={record.collectionId}
|
||||
record={record}
|
||||
isActive={activeCollectionId === record.collectionId}
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
// only fire onActiveCollection if the collection is not already active
|
||||
activeCollectionId !== record.collectionId
|
||||
? onActiveCollection(record.collectionId)
|
||||
: undefined
|
||||
}
|
||||
if (activeCollectionId !== record.collectionId) {
|
||||
track.allDocs.header.navigation.navigatePinedCollectionRouter({
|
||||
control: 'user-custom-collection',
|
||||
});
|
||||
onActiveCollection(record.collectionId);
|
||||
}
|
||||
}}
|
||||
onClickRemove={() => {
|
||||
const nextCollectionId = pinnedCollections[index - 1]?.collectionId;
|
||||
if (nextCollectionId) {
|
||||
@@ -144,11 +153,12 @@ export const PinnedCollections = ({
|
||||
<IconButton
|
||||
size="16"
|
||||
className={styles.editIconButton}
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
track.allDocs.header.collection.editCollection();
|
||||
workspaceDialogService.open('collection-editor', {
|
||||
collectionId: activeCollectionId,
|
||||
})
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
<EditIcon />
|
||||
</IconButton>
|
||||
@@ -228,6 +238,7 @@ export const AddPinnedCollectionMenuContent = ({
|
||||
prefixIcon={<CollectionsIcon />}
|
||||
suffixIcon={<PlusIcon />}
|
||||
onClick={() => {
|
||||
track.allDocs.header.collection.addPinnedCollection();
|
||||
onPinCollection(meta.id);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { DocRecord } from '@affine/core/modules/doc';
|
||||
import { WorkbenchLink } from '@affine/core/modules/workbench';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import type { DocMode } from '@blocksuite/affine/model';
|
||||
import { ViewLayersIcon } from '@blocksuite/icons/rc';
|
||||
import { useLiveData, useServices } from '@toeverything/infra';
|
||||
@@ -31,6 +32,7 @@ export const CollectionListHeader = ({
|
||||
});
|
||||
|
||||
const handleEdit = useCallback(() => {
|
||||
track.collection.collection.$.editCollection();
|
||||
workspaceDialogService.open('collection-editor', {
|
||||
collectionId: collection.id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user