@samitouri / QOS-React-2 / commits / 58ae3c63a8

Added export-log icon. Removed unnecessary variable assignment.

Brian Vaughn committed Apr 8, 2019 at 11:41 UTC 58ae3c63a803bab23c13628df96f4b70e7efe4e6
3 files changed +16 -11
src/devtools/views/ButtonIcon.js
+8 -1
@@ -56,7 +56,7 @@ export default function ButtonIcon({ type }: Props) {
56 pathData = PATH_IMPORT;
57 break;
58 case 'log-data':
59 - pathData = PATH_EXPORT; // TODO: real icon
59 + pathData = PATH_LOG_DATA;
60 break;
61 case 'more':
62 pathData = PATH_MORE;
@@ -134,6 +134,13 @@ const PATH_FILTER = 'M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z';
134
135 const PATH_IMPORT = 'M8.18,18.13v-7H3l9-8.95,9,9H15.82v7ZM3,20.13H21v1.73H3Z';
136
137 +const PATH_LOG_DATA = `
138 + M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41
139 + 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04
140 + 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6
141 + 8h-4v-2h4v2zm0-4h-4v-2h4v2z
142 +`;
143 +
144 const PATH_MORE = `
145 M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9
146 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z
src/devtools/views/Components/SelectedElement.js
+6 -8
@@ -39,14 +39,13 @@ export default function SelectedElement(_: Props) {
39 const inspectedElement = useInspectedElement(selectedElementID);
40
41 const highlightElement = useCallback(() => {
42 - const id = selectedElementID;
43 - if (element !== null && id !== null) {
44 - const rendererID = store.getRendererIDForElement(id);
42 + if (element !== null && selectedElementID !== null) {
43 + const rendererID = store.getRendererIDForElement(selectedElementID);
44 if (rendererID !== null) {
45 bridge.send('highlightElementInDOM', {
46 displayName: element.displayName,
47 hideAfterTimeout: true,
49 - id,
48 + id: selectedElementID,
49 rendererID,
50 scrollIntoView: true,
51 });
@@ -55,12 +54,11 @@ export default function SelectedElement(_: Props) {
54 }, [bridge, element, selectedElementID, store]);
55
56 const logElement = useCallback(() => {
58 - const id = selectedElementID;
59 - if (id !== null) {
60 - const rendererID = store.getRendererIDForElement(id);
57 + if (selectedElementID !== null) {
58 + const rendererID = store.getRendererIDForElement(selectedElementID);
59 if (rendererID !== null) {
60 bridge.send('logElementToConsole', {
63 - id,
61 + id: selectedElementID,
62 rendererID,
63 });
64 }
src/devtools/views/Components/types.js
+2 -2
@@ -35,6 +35,8 @@ export type Owner = {|
35 export type InspectedElement = {|
36 id: number,
37
38 + displayName: string | null,
39 +
40 // Does the current renderer support editable hooks?
41 canEditHooks: boolean,
42
@@ -58,8 +60,6 @@ export type InspectedElement = {|
60
61 // Location of component in source coude.
62 source: Object | null,
61 -
62 - displayName: string | null,
63 |};
64
65 // TODO: Add profiling type