Skip to content

Commit

Permalink
Merge pull request #323 from liam-hq/select-table-log-event
Browse files Browse the repository at this point in the history
📈 add types for select table logging
  • Loading branch information
junkisai authored Dec 19, 2024
2 parents adfe11a + 07b922e commit 768a12a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions frontend/.changeset/chatty-poems-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@liam-hq/erd-core": patch
---

:chart_with_upwards_trend: add types for select table logging
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { selectTableLogEvent } from '@/features/gtm/utils'
import { updateActiveTableName, useUserEditingActiveStore } from '@/stores'
import type { Relationships } from '@liam-hq/db-structure'
import {
Expand Down Expand Up @@ -75,8 +76,9 @@ export const ERDContentInner: FC<Props> = ({
)
useSyncHighlightsActiveTableChange()

const handleNodeClick = useCallback((nodeId: string) => {
updateActiveTableName(nodeId)
const handleNodeClick = useCallback((tableId: string) => {
updateActiveTableName(tableId)
selectTableLogEvent({ ref: 'mainArea', tableId })
}, [])

const handlePaneClick = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -8,6 +9,7 @@ import { VisibilityButton } from './VisibilityButton'

const handleClickMenuButton = (tableId: string) => () => {
updateActiveTableName(tableId)
selectTableLogEvent({ ref: 'leftPane', tableId })
}

type Props = {
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/erd-core/src/features/gtm/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './clickLogEvent'
export * from './selectTableLogEvent'
Original file line number Diff line number Diff line change
@@ -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,
})
}

0 comments on commit 768a12a

Please sign in to comment.