From eae2d5b752c31195bb9399225149759e06149e59 Mon Sep 17 00:00:00 2001 From: Iliya Brook Date: Wed, 6 Mar 2024 23:31:03 +0200 Subject: [PATCH] prettier write --- .../src/ActionPreview.tsx | 22 ++++++++++++------- .../src/utils/copyToClipboard.ts | 2 +- .../src/utils/getValueByPath.ts | 5 +++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/redux-devtools-inspector-monitor/src/ActionPreview.tsx b/packages/redux-devtools-inspector-monitor/src/ActionPreview.tsx index a3837b02..cab7b740 100644 --- a/packages/redux-devtools-inspector-monitor/src/ActionPreview.tsx +++ b/packages/redux-devtools-inspector-monitor/src/ActionPreview.tsx @@ -208,8 +208,8 @@ class ActionPreview> extends Component< ]) } > - {'(pin)'} - + {'(pin)'} + ({ fontSize: '0.7em', @@ -220,13 +220,19 @@ class ActionPreview> extends Component< }, color: theme.PIN_COLOR, })} - onClick={event => { + onClick={(event) => { event.stopPropagation(); let objectForCopying; if (this.props.tabName === 'Action') { - objectForCopying = getValueByPath(this.props.action, reversedPath); + objectForCopying = getValueByPath( + this.props.action, + reversedPath, + ); } else if (this.props.tabName === 'State') { - objectForCopying = getValueByPath(this.props.nextState, reversedPath); + objectForCopying = getValueByPath( + this.props.nextState, + reversedPath, + ); } if (objectForCopying !== undefined) { copyToClipboard(objectForCopying); @@ -235,10 +241,10 @@ class ActionPreview> extends Component< } }} > - {'(copy)'} - + {'(copy)'} + {!expanded && ': '} - + ); }; } diff --git a/packages/redux-devtools-inspector-monitor/src/utils/copyToClipboard.ts b/packages/redux-devtools-inspector-monitor/src/utils/copyToClipboard.ts index 39f4021c..a43b01a5 100644 --- a/packages/redux-devtools-inspector-monitor/src/utils/copyToClipboard.ts +++ b/packages/redux-devtools-inspector-monitor/src/utils/copyToClipboard.ts @@ -1,6 +1,6 @@ import cloneDeep from 'lodash.clonedeep'; -export function copyToClipboard(object: any){ +export function copyToClipboard(object: any) { try { const deepCopiedObject = cloneDeep(object); const jsonString = JSON.stringify(deepCopiedObject, null, 2); diff --git a/packages/redux-devtools-inspector-monitor/src/utils/getValueByPath.ts b/packages/redux-devtools-inspector-monitor/src/utils/getValueByPath.ts index f98ce1c2..e7610fcc 100644 --- a/packages/redux-devtools-inspector-monitor/src/utils/getValueByPath.ts +++ b/packages/redux-devtools-inspector-monitor/src/utils/getValueByPath.ts @@ -1,8 +1,9 @@ -export function getValueByPath(obj: any, path: (string | number)[]){ +export function getValueByPath(obj: any, path: (string | number)[]) { let current: any = obj; for (let i = 0; i < path.length; i++) { const key = path[i]; - const adjustedKey = typeof key === 'string' && !isNaN(Number(key)) ? parseInt(key, 10) : key; + const adjustedKey = + typeof key === 'string' && !isNaN(Number(key)) ? parseInt(key, 10) : key; if (current[adjustedKey] === undefined) { return undefined; }