Skip to content

Commit

Permalink
reverse nav drawer posthog events (#2003)
Browse files Browse the repository at this point in the history
* reverse nav drawer posthog events

* also fire drawer toggle event in onClose
  • Loading branch information
gumaerc authored Jan 29, 2025
1 parent 82ce719 commit 94aefe4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontends/main/src/page-components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ const Header: FunctionComponent = () => {
const desktopTrigger = React.useRef<HTMLButtonElement>(null)
const mobileTrigger = React.useRef<HTMLButtonElement>(null)
const drawerToggleEvent = drawerOpen
? "opened_nav_drawer"
: "closed_nav_drawer"
? "closed_nav_drawer"
: "opened_nav_drawer"
const posthogCapture = (event: string) => {
if (process.env.NEXT_PUBLIC_POSTHOG_API_KEY) {
posthog.capture(event)
Expand Down Expand Up @@ -317,7 +317,10 @@ const Header: FunctionComponent = () => {
]}
navData={navData}
open={drawerOpen}
onClose={toggleDrawer.off}
onClose={() => {
posthogCapture(drawerToggleEvent)
toggleDrawer.off()
}}
posthogCapture={posthogCapture}
/>
</div>
Expand Down

0 comments on commit 94aefe4

Please sign in to comment.