Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📈 add types for select table logging #323

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,
})
}
Loading