mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
feat(editor): add view event tracking (#12602)
close: BS-3567 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved the process for adding new views by centralizing related logic, resulting in a more streamlined and consistent user experience. - **Chores** - Enhanced event tracking for database views to support better analytics. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -74,6 +74,14 @@ export class DataViewHeaderViews extends WidgetBase {
|
||||
}
|
||||
`;
|
||||
|
||||
private addView(type: string) {
|
||||
const id = this.viewManager.viewAdd(type);
|
||||
this.viewManager.setCurrentView(id);
|
||||
this.dataViewLogic.root.config.eventTrace('AddDatabaseView', {
|
||||
type: type,
|
||||
});
|
||||
}
|
||||
|
||||
_addViewMenu = (event: MouseEvent) => {
|
||||
popFilterableSimpleMenu(
|
||||
popupTargetFromElement(event.currentTarget as HTMLElement),
|
||||
@@ -82,8 +90,7 @@ export class DataViewHeaderViews extends WidgetBase {
|
||||
name: v.model.defaultName,
|
||||
prefix: html`<uni-lit .uni=${v.renderer.icon}></uni-lit>`,
|
||||
select: () => {
|
||||
const id = this.viewManager.viewAdd(v.type);
|
||||
this.viewManager.setCurrentView(id);
|
||||
this.addView(v.type);
|
||||
},
|
||||
});
|
||||
})
|
||||
@@ -135,8 +142,7 @@ export class DataViewHeaderViews extends WidgetBase {
|
||||
hide: () => this.readonly,
|
||||
prefix: PlusIcon(),
|
||||
select: () => {
|
||||
const id = this.viewManager.viewAdd(v.type);
|
||||
this.viewManager.setCurrentView(id);
|
||||
this.addView(v.type);
|
||||
},
|
||||
});
|
||||
}),
|
||||
|
||||
@@ -45,6 +45,9 @@ export type DatabaseGroupEvents = {
|
||||
|
||||
export type DatabaseEvents = {
|
||||
AddDatabase: {};
|
||||
AddDatabaseView: {
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
|
||||
export interface DatabaseAllSortEvents {
|
||||
|
||||
Reference in New Issue
Block a user