Skip to content

Commit 6542929

Browse files
authored
fix: add eventing around controversal dropdown (#4077)
1 parent 236fad2 commit 6542929

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/shared/components/TimeZoneDropdown.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,31 @@ import {AppSettingContext} from 'src/shared/contexts/app'
77

88
// Constants
99
import {TIME_ZONES} from 'src/shared/constants/timeZones'
10+
import {TimeZone} from 'src/types'
11+
import {event} from 'src/cloud/utils/reporting'
1012

1113
const TimeZoneDropdown: FC = () => {
1214
const {timeZone, setTimeZone} = useContext(AppSettingContext)
1315

16+
const onSelect = (zone: TimeZone) => {
17+
let loc = 'other'
18+
if (window.location.pathname.includes('notebook')) {
19+
loc = 'notebooks'
20+
} else if (window.location.pathname.includes('data-explorer')) {
21+
loc = 'data explorer'
22+
} else if (window.location.pathname.includes('dashboard')) {
23+
loc = 'dashboard'
24+
}
25+
26+
event('user selected new timezone', {location: loc})
27+
setTimeZone(zone)
28+
}
29+
1430
return (
1531
<SelectDropdown
1632
options={TIME_ZONES.map(tz => tz.timeZone)}
1733
selectedOption={timeZone}
18-
onSelect={setTimeZone}
34+
onSelect={onSelect}
1935
buttonIcon={IconFont.Annotate_New}
2036
style={{width: '115px'}}
2137
/>

0 commit comments

Comments
 (0)