mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-12 12:11:57 +08:00
feat(core): track for calendar integration (#12378)
This commit is contained in:
+6
@@ -1,6 +1,7 @@
|
|||||||
import { Button, Input, Modal, notify } from '@affine/component';
|
import { Button, Input, Modal, notify } from '@affine/component';
|
||||||
import { IntegrationService } from '@affine/core/modules/integration';
|
import { IntegrationService } from '@affine/core/modules/integration';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
import track from '@affine/track';
|
||||||
import { PlusIcon, TodayIcon } from '@blocksuite/icons/rc';
|
import { PlusIcon, TodayIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
@@ -72,6 +73,11 @@ const AddSubscription = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setUrl('');
|
setUrl('');
|
||||||
|
track.$.settingsPanel.integrationList.connectIntegration({
|
||||||
|
type: 'calendar',
|
||||||
|
control: 'Calendar Setting',
|
||||||
|
result: 'success',
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
notify.error({
|
notify.error({
|
||||||
|
|||||||
+5
@@ -4,6 +4,7 @@ import {
|
|||||||
IntegrationService,
|
IntegrationService,
|
||||||
} from '@affine/core/modules/integration';
|
} from '@affine/core/modules/integration';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
import track from '@affine/track';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
@@ -114,6 +115,10 @@ const UnsubscribeButton = ({ url, name }: { url: string; name: string }) => {
|
|||||||
}),
|
}),
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
calendar.deleteSubscription(url);
|
calendar.deleteSubscription(url);
|
||||||
|
track.$.settingsPanel.integrationList.disconnectIntegration({
|
||||||
|
type: 'calendar',
|
||||||
|
control: 'Calendar Setting',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
confirmText: t['com.affine.integration.calendar.unsubscribe'](),
|
confirmText: t['com.affine.integration.calendar.unsubscribe'](),
|
||||||
confirmButtonOptions: {
|
confirmButtonOptions: {
|
||||||
|
|||||||
+2
@@ -10,6 +10,7 @@ import { JournalService } from '@affine/core/modules/journal';
|
|||||||
import { GuardService } from '@affine/core/modules/permissions';
|
import { GuardService } from '@affine/core/modules/permissions';
|
||||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
import track from '@affine/track';
|
||||||
import { FullDayIcon, PeriodIcon, PlusIcon } from '@blocksuite/icons/rc';
|
import { FullDayIcon, PeriodIcon, PlusIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { cssVarV2 } from '@toeverything/theme/v2';
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
@@ -94,6 +95,7 @@ const CalendarEventRenderer = ({ event }: { event: CalendarEvent }) => {
|
|||||||
await docsService.changeDocTitle(newDoc.id, title);
|
await docsService.changeDocTitle(newDoc.id, title);
|
||||||
await docsService.addLinkedDoc(doc.id, newDoc.id);
|
await docsService.addLinkedDoc(doc.id, newDoc.id);
|
||||||
}
|
}
|
||||||
|
track.doc.sidepanel.journal.createCalendarDocEvent();
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,8 @@ type IntegrationEvents =
|
|||||||
| 'selectIntegrationImport'
|
| 'selectIntegrationImport'
|
||||||
| 'confirmIntegrationImport'
|
| 'confirmIntegrationImport'
|
||||||
| 'abortIntegrationImport'
|
| 'abortIntegrationImport'
|
||||||
| 'completeIntegrationImport';
|
| 'completeIntegrationImport'
|
||||||
|
| 'createCalendarDocEvent';
|
||||||
// END SECTION
|
// END SECTION
|
||||||
|
|
||||||
// SECTION: journal
|
// SECTION: journal
|
||||||
@@ -455,6 +456,7 @@ interface PageEvents extends PageDivision {
|
|||||||
};
|
};
|
||||||
sidepanel: {
|
sidepanel: {
|
||||||
property: ['addProperty', 'editPropertyMeta'];
|
property: ['addProperty', 'editPropertyMeta'];
|
||||||
|
journal: ['createCalendarDocEvent'];
|
||||||
};
|
};
|
||||||
biDirectionalLinksPanel: {
|
biDirectionalLinksPanel: {
|
||||||
$: ['toggle'];
|
$: ['toggle'];
|
||||||
@@ -576,7 +578,11 @@ type ImportArgs = {
|
|||||||
};
|
};
|
||||||
type IntegrationArgs<T extends Record<string, any>> = {
|
type IntegrationArgs<T extends Record<string, any>> = {
|
||||||
type: string;
|
type: string;
|
||||||
control: 'Readwise Card' | 'Readwise settings' | 'Readwise import list';
|
control:
|
||||||
|
| 'Readwise Card'
|
||||||
|
| 'Readwise settings'
|
||||||
|
| 'Readwise import list'
|
||||||
|
| 'Calendar Setting';
|
||||||
} & T;
|
} & T;
|
||||||
|
|
||||||
type RecordingEventArgs = {
|
type RecordingEventArgs = {
|
||||||
|
|||||||
Reference in New Issue
Block a user