Skip to content

Commit

Permalink
chore(core): add journal open event
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Sep 2, 2024
1 parent d9cedf8 commit 418a55d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/frontend/core/src/hooks/use-journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { initEmptyPage, useService } from '@toeverything/infra';
import dayjs from 'dayjs';
import { useCallback, useMemo } from 'react';

import { track } from '../mixpanel';
import { WorkbenchService } from '../modules/workbench';
import type { DocCollection } from '../shared';
import { useCurrentWorkspacePropertiesAdapter } from './use-affine-adapter';
Expand Down Expand Up @@ -162,6 +163,7 @@ export const useJournalRouteHelper = (docCollection: DocCollection) => {
workbench.openDoc(page.id, {
at: newTab ? 'new-tab' : 'active',
});
track.$.navigationPanel.journal.journalVisited();
return page.id;
},
[getJournalByDate, workbench]
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/core/src/mixpanel/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ type DocEvents =
| 'restoreDoc'
| 'switchPageMode'
| 'openDocOptionsMenu'
| 'openDocInfo';
| 'openDocInfo'
| 'journalVisited';
type EditorEvents = 'bold' | 'italic' | 'underline' | 'strikeThrough';
// END SECTION

Expand Down Expand Up @@ -221,6 +222,7 @@ const PageEvents = {
'openSettings',
],
profileAndBadge: ['openSettings'],
journal: ['journalVisited'],
},
aiOnboarding: {
dialog: ['viewPlans'],
Expand Down

0 comments on commit 418a55d

Please sign in to comment.