11// Libraries
22import React , { FC , useContext , useEffect } from 'react'
3- import { Link } from 'react-router-dom'
3+ import { Link , useLocation } from 'react-router-dom'
44import { useSelector } from 'react-redux'
55import { connect , ConnectedProps } from 'react-redux'
66import { withRouter , RouteComponentProps } from 'react-router-dom'
@@ -42,7 +42,7 @@ const TreeSidebar: FC<ReduxProps & RouteComponentProps> = () =>
4242 AppSettingContext
4343 )
4444 const org = useSelector ( getOrg )
45-
45+ const location = useLocation ( )
4646 useEffect ( ( ) => {
4747 if ( isFlagEnabled ( 'helpBar' ) ) {
4848 const helpBarMenu = document . querySelectorAll < HTMLElement > (
@@ -72,23 +72,10 @@ const TreeSidebar: FC<ReduxProps & RouteComponentProps> = () =>
7272 }
7373 }
7474
75- // Hiding Contact Support and Feedback code for Help Bar phase 1 release
76- // https://github.com/influxdata/ui/issues/3457
77- // https://github.com/influxdata/ui/issues/3454
78- // const handleSelect = (): void => {
79- // const accountType = quartzMe?.accountType ?? 'free'
80- // const isPayGCustomer = accountType !== 'free'
81-
82- // if (isPayGCustomer) {
83- // showOverlay('payg-support', null, dismissOverlay)
84- // } else {
85- // showOverlay('free-account-support', null, dismissOverlay)
86- // }
87- // }
88-
89- // const openFeedbackOverlay = (): void => {
90- // showOverlay('feedback-questions', null, dismissOverlay)
91- // }
75+ const handleEventing = ( link : string ) : void => {
76+ const currentPage = location . pathname
77+ event ( `helpBar.${ link } .opened` , { } , { from : currentPage } )
78+ }
9279
9380 return (
9481 < OrgSettings >
@@ -173,30 +160,33 @@ const TreeSidebar: FC<ReduxProps & RouteComponentProps> = () =>
173160 label = "Documentation"
174161 testID = "nav-subitem-documentation"
175162 linkElement = { ( ) => (
176- < SafeBlankLink href = "https://docs.influxdata.com/" />
163+ < SafeBlankLink
164+ href = "https://docs.influxdata.com/"
165+ onClick = { ( ) => handleEventing ( 'documentation' ) }
166+ />
177167 ) }
178168 />
179169 < TreeNav . SubItem
180170 id = "faqs"
181171 label = "FAQs"
182172 testID = "nav-subitem-faqs"
183173 linkElement = { ( ) => (
184- < SafeBlankLink href = "https://docs.influxdata.com/influxdb/cloud/reference/faq/" />
174+ < SafeBlankLink
175+ href = "https://docs.influxdata.com/influxdb/cloud/reference/faq/"
176+ onClick = { ( ) => handleEventing ( 'faq' ) }
177+ />
185178 ) }
186179 />
187- { /* <TreeNav.SubItem
188- id="contactSupport"
189- label="Contact Support"
190- testID="nav-subitem-contact-support"
191- onClick={handleSelect}
192- /> */ }
193180 < TreeNav . SubHeading label = "Community" />
194181 < TreeNav . SubItem
195182 id = "offcialForum"
196183 label = "Official Forum"
197184 testID = "nav-subitem-forum"
198185 linkElement = { ( ) => (
199- < SafeBlankLink href = "https://community.influxdata.com" />
186+ < SafeBlankLink
187+ href = "https://community.influxdata.com"
188+ onClick = { ( ) => handleEventing ( 'officialForum' ) }
189+ />
200190 ) }
201191 />
202192 < TreeNav . SubItem
@@ -207,13 +197,6 @@ const TreeSidebar: FC<ReduxProps & RouteComponentProps> = () =>
207197 < SafeBlankLink href = "https://influxcommunity.slack.com/join/shared_invite/zt-156zm7ult-LcIW2T4TwLYeS8rZbCP1mw#/shared-invite/email" />
208198 ) }
209199 />
210- { /* <TreeNav.SubHeading label="Feedback" />
211- <TreeNav.SubItem
212- id="feedback"
213- label="Feedback & Questions"
214- testID="nav-subitem-feedback-questions"
215- onClick={openFeedbackOverlay}
216- /> */ }
217200 </ TreeNav . SubMenu >
218201 </ TreeNav . Item >
219202 ) : null }
0 commit comments