Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Add tracking to legacy Tabs component
Browse files Browse the repository at this point in the history
Summary:
Per title

As requested in https://fb.workplace.com/groups/flippersupport/permalink/1080030509144273/

Reviewed By: fabiomassimo

Differential Revision: D26691262

fbshipit-source-id: d7863749700c4a0f3af736f251c9c3f03d4f71b9
  • Loading branch information
mweststrate authored and facebook-github-bot committed Feb 26, 2021
1 parent 357d299 commit 4b91e83
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions desktop/app/src/ui/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Tab, {Props as TabProps} from './Tab';
import {Property} from 'csstype';
import React, {useContext} from 'react';
import {TabsContext} from './TabsContainer';
import {_wrapInteractionHandler} from 'flipper-plugin';

const TabList = styled(FlexRow)({
justifyContent: 'center',
Expand Down Expand Up @@ -168,6 +169,7 @@ export default function Tabs(props: {
classic?: boolean;
}) {
let tabsContainer = useContext(TabsContext);
const scope = useContext((global as any).FlipperTrackingScopeContext);
if (props.classic === true) {
tabsContainer = false;
}
Expand Down Expand Up @@ -245,11 +247,17 @@ export default function Tabs(props: {
container={tabsContainer}
onMouseDown={
!isActive && onActive
? (event: React.MouseEvent<HTMLDivElement>) => {
if (event.target !== closeButton) {
onActive(key);
}
}
? _wrapInteractionHandler(
(event: React.MouseEvent<HTMLDivElement>) => {
if (event.target !== closeButton) {
onActive(key);
}
},
'Tabs',
'onTabClick',
scope as any,
'tab:' + key + ':' + comp.props.label,
)
: undefined
}>
{comp.props.label}
Expand Down

0 comments on commit 4b91e83

Please sign in to comment.