Copy diagnostics

Summary: Track copy events, both names and inline attributes.

Reviewed By: LukeDefeo

Differential Revision: D44297218

fbshipit-source-id: 5d2b1f2f4fa59d4a86e9e2ae1aa883712ceccb8c
This commit is contained in:
Lorenzo Blasa
2023-03-22 11:53:54 -07:00
committed by Facebook GitHub Bot
parent 583eabdd79
commit c2e41cd095
2 changed files with 15 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ import {head, isEqual, last} from 'lodash';
import {reverse} from 'lodash/fp';
import {Badge, Dropdown, Menu, Typography} from 'antd';
import {UIDebuggerMenuItem} from './util/UIDebuggerMenuItem';
import {tracker} from '../tracker';
const {Text} = Typography;
@@ -425,6 +426,7 @@ const ContextMenu: React.FC<{
key={'Copy Element name'}
text={'Copy Element name'}
onClick={() => {
tracker.track('context-menu-name-copied', {name: hoveredNode.name});
getFlipperLib().writeTextToClipboard(hoveredNode.name);
}}
/>,
@@ -436,6 +438,11 @@ const ContextMenu: React.FC<{
key={key}
text={`Copy ${key}`}
onClick={() => {
tracker.track('context-menu-copied', {
name: hoveredNode.name,
key,
value,
});
getFlipperLib().writeTextToClipboard(value);
}}
/>

View File

@@ -32,6 +32,14 @@ type TrackerEvents = {
};
'node-selected': NodeEventPayload;
'node-focused': NodeEventPayload;
'context-menu-name-copied': {
name: string;
};
'context-menu-copied': {
name: string;
key: string;
value: string;
};
};
export interface Tracker {