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 697f2c6 commit 6603a3b
Show file tree
Hide file tree
Showing 2 changed files with 7 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.doc.journal.$.journalVisited();
return page.id;
},
[getJournalByDate, workbench]
Expand Down
6 changes: 5 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 @@ -264,6 +265,9 @@ const PageEvents = {
atMenu: ['linkDoc'],
formatToolbar: ['bold'],
},
journal: {
$: ['journalVisited'],
},
inlineDocInfo: {
$: ['toggle'],
},
Expand Down

0 comments on commit 6603a3b

Please sign in to comment.