From 7aa0d2fefefc00460d390e23880818b768304ce4 Mon Sep 17 00:00:00 2001 From: hoshinotsuyoshi Date: Thu, 19 Dec 2024 17:36:12 +0900 Subject: [PATCH 1/4] :chart_with_upwards_trend: add types for select table logging --- .../erd-core/src/features/gtm/utils/index.ts | 1 + .../src/features/gtm/utils/selectTableLogEvent.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 frontend/packages/erd-core/src/features/gtm/utils/selectTableLogEvent.ts diff --git a/frontend/packages/erd-core/src/features/gtm/utils/index.ts b/frontend/packages/erd-core/src/features/gtm/utils/index.ts index fff2e7bd..c5b24504 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/index.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/index.ts @@ -1 +1,2 @@ export * from './clickLogEvent' +export * from './selectTableLogEvent' diff --git a/frontend/packages/erd-core/src/features/gtm/utils/selectTableLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/selectTableLogEvent.ts new file mode 100644 index 00000000..de0968d2 --- /dev/null +++ b/frontend/packages/erd-core/src/features/gtm/utils/selectTableLogEvent.ts @@ -0,0 +1,14 @@ +import { pushToDataLayer } from './pushToDataLayer' + +type selectTable = { + ref: 'leftPane' | 'mainArea' + tableId: string +} + +export const selectTableLogEvent = ({ ref, tableId }: selectTable) => { + pushToDataLayer({ + event: 'selectTable', + ref, + tableId, + }) +} From dc8818f9f994c8547a0a007cad40c29b62fe0106 Mon Sep 17 00:00:00 2001 From: hoshinotsuyoshi Date: Thu, 19 Dec 2024 17:50:10 +0900 Subject: [PATCH 2/4] :chart_with_upwards_trend: add select table logging for TableNameMenuButton --- .../LeftPane/TableNameMenuButton/TableNameMenuButton.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableNameMenuButton/TableNameMenuButton.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableNameMenuButton/TableNameMenuButton.tsx index ff65b749..6b6dcb17 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableNameMenuButton/TableNameMenuButton.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableNameMenuButton/TableNameMenuButton.tsx @@ -1,3 +1,4 @@ +import { selectTableLogEvent } from '@/features/gtm/utils' import { updateActiveTableName, useUserEditingStore } from '@/stores' import { SidebarMenuButton, SidebarMenuItem, Table2 } from '@liam-hq/ui' import clsx from 'clsx' @@ -8,6 +9,7 @@ import { VisibilityButton } from './VisibilityButton' const handleClickMenuButton = (tableId: string) => () => { updateActiveTableName(tableId) + selectTableLogEvent({ ref: 'leftPane', tableId }) } type Props = { From 10af39504ec7055ba3a62cd1cd5f3bd4bf5e256d Mon Sep 17 00:00:00 2001 From: hoshinotsuyoshi Date: Thu, 19 Dec 2024 18:05:22 +0900 Subject: [PATCH 3/4] :chart_with_upwards_trend: add select table logging for TableNode --- .../src/components/ERDRenderer/ERDContent/ERDContent.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/ERDContent.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/ERDContent.tsx index 199c961f..10d863c5 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/ERDContent.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/ERDContent.tsx @@ -1,3 +1,4 @@ +import { selectTableLogEvent } from '@/features/gtm/utils' import { updateActiveTableName, useUserEditingActiveStore } from '@/stores' import type { Relationships } from '@liam-hq/db-structure' import { @@ -75,8 +76,9 @@ export const ERDContentInner: FC = ({ ) useSyncHighlightsActiveTableChange() - const handleNodeClick = useCallback((nodeId: string) => { - updateActiveTableName(nodeId) + const handleNodeClick = useCallback((tableId: string) => { + updateActiveTableName(tableId) + selectTableLogEvent({ ref: 'mainArea', tableId }) }, []) const handlePaneClick = useCallback(() => { From 07b922e1ba25938e05b67104e50d69d74c79897d Mon Sep 17 00:00:00 2001 From: hoshinotsuyoshi Date: Thu, 19 Dec 2024 18:23:08 +0900 Subject: [PATCH 4/4] Add a changeset .md --- frontend/.changeset/chatty-poems-talk.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 frontend/.changeset/chatty-poems-talk.md diff --git a/frontend/.changeset/chatty-poems-talk.md b/frontend/.changeset/chatty-poems-talk.md new file mode 100644 index 00000000..7af8a371 --- /dev/null +++ b/frontend/.changeset/chatty-poems-talk.md @@ -0,0 +1,5 @@ +--- +"@liam-hq/erd-core": patch +--- + +:chart_with_upwards_trend: add types for select table logging