From ac554667d109caa5f7043315e9c7fe50aa0b4678 Mon Sep 17 00:00:00 2001 From: "ryota.sasazawa" Date: Thu, 19 Dec 2024 18:23:05 +0900 Subject: [PATCH] feat: Send openRelatedTablesLogEvent when opening related tables on main area --- .../TableNode/TableDetail/RelatedTables/RelatedTables.tsx | 6 +++++- .../src/features/gtm/utils/openRelatedTablesLogEvent.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx index 1ba1a0f3..b4da6d9e 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx @@ -1,4 +1,5 @@ import { convertDBStructureToNodes } from '@/components/ERDRenderer/convertDBStructureToNodes' +import { OpenRelatedTablesLogEvent } from '@/features/gtm/utils' import { updateActiveTableName, useDBStructureStore } from '@/stores' import type { Table } from '@liam-hq/db-structure' import { GotoIcon, IconButton } from '@liam-hq/ui' @@ -29,7 +30,10 @@ export const RelatedTables: FC = ({ table }) => { })) }) updateActiveTableName(undefined) - }, [nodes, setNodes]) + OpenRelatedTablesLogEvent({ + tableId: table.name, + }) + }, [nodes, setNodes, table.name]) return (
diff --git a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts index 7fbed724..3c21e19c 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts @@ -4,7 +4,9 @@ type OpenRelatedTablesLogEvent = { tableId: string } -export const OpenRelatedTablesLogEvent = ({ tableId }: OpenRelatedTablesLogEvent) => { +export const OpenRelatedTablesLogEvent = ({ + tableId, +}: OpenRelatedTablesLogEvent) => { pushToDataLayer({ event: 'open_related_tables', tableId,