feat(core): add journal navigation tracking (#8046)

fix AF-1314
This commit is contained in:
pengx17
2024-09-05 02:31:57 +00:00
parent 06552a1120
commit 1cac2f6ccd
3 changed files with 15 additions and 1 deletions
@@ -1,5 +1,6 @@
import { useDocMetaHelper } from '@affine/core/hooks/use-block-suite-page-meta';
import { useJournalHelper } from '@affine/core/hooks/use-journal';
import { track } from '@affine/core/mixpanel';
import {
PeekViewService,
useInsidePeekView,
@@ -123,9 +124,16 @@ export function AffinePageReference({
const peekView = useService(PeekViewService).peekView;
const isInPeekView = useInsidePeekView();
const isJournal = journalHelper.isPageJournal(pageId);
const onClick = useCallback(
(e: React.MouseEvent) => {
if (isJournal) {
track.doc.editor.pageRef.navigate({
to: 'journal',
});
}
if (e.shiftKey && ref.current) {
e.preventDefault();
e.stopPropagation();
@@ -141,7 +149,7 @@ export function AffinePageReference({
return;
},
[isInPeekView, peekView]
[isInPeekView, isJournal, peekView]
);
const query = useMemo(() => {