mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
26 lines
632 B
TypeScript
26 lines
632 B
TypeScript
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
||
|
import { useEffect } from 'react'
|
||
|
import { sendMBOnce } from '@/infrastructure/event-tracking'
|
||
|
|
||
|
export function useLayoutEventTracking() {
|
||
|
const { view, leftMenuShown, chatIsOpen } = useLayoutContext()
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (view !== 'editor' && view !== 'pdf') {
|
||
|
sendMBOnce(`ide-open-view-${view}-once`)
|
||
|
}
|
||
|
}, [view])
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (leftMenuShown) {
|
||
|
sendMBOnce(`ide-open-left-menu-once`)
|
||
|
}
|
||
|
}, [leftMenuShown])
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (chatIsOpen) {
|
||
|
sendMBOnce(`ide-open-chat-once`)
|
||
|
}
|
||
|
}, [chatIsOpen])
|
||
|
}
|