From 6400a041384816ad205521df8990b12cd566c3d0 Mon Sep 17 00:00:00 2001 From: sylenien Date: Mon, 26 Sep 2022 12:29:18 +0200 Subject: [PATCH] change(ui): formatted components --- .../components/Session_/Storage/DiffRow.tsx | 39 +++++++++---------- .../components/Session_/Storage/Storage.js | 16 +++++--- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/frontend/app/components/Session_/Storage/DiffRow.tsx b/frontend/app/components/Session_/Storage/DiffRow.tsx index b4aa80f49..72a9bed46 100644 --- a/frontend/app/components/Session_/Storage/DiffRow.tsx +++ b/frontend/app/components/Session_/Storage/DiffRow.tsx @@ -1,32 +1,29 @@ -import React from 'react' -import cn from 'classnames' +import React from 'react'; interface Props { - shades: Record - pathRoot: string - path: string - diff: Record + shades: Record; + pathRoot: string; + path: string; + diff: Record; } function DiffRow({ diff, path, pathRoot, shades }: Props) { - const [shorten, setShorten] = React.useState(true) + const [shorten, setShorten] = React.useState(true); const oldValue = diff.item ? JSON.stringify(diff.item.lhs) : JSON.stringify(diff.lhs); const newValue = diff.item ? JSON.stringify(diff.item.rhs) : JSON.stringify(diff.rhs); - const pathStr = path.length > 15 && shorten ? (path.slice(0, 5) + '...' + path.slice(10)) : path + const pathStr = path.length > 15 && shorten ? path.slice(0, 5) + '...' + path.slice(10) : path; return ( -
- 15 ? "cursor-pointer" : ''} onClick={() => setShorten(false)}> - {pathStr} - {': '} - - {oldValue || 'undefined'} - {' -> '} - - {newValue || 'undefined'} - -
- ) +
+ 15 ? 'cursor-pointer' : ''} onClick={() => setShorten(false)}> + {pathStr} + {': '} + + {oldValue || 'undefined'} + {' -> '} + {newValue || 'undefined'} +
+ ); } -export default DiffRow +export default DiffRow; diff --git a/frontend/app/components/Session_/Storage/Storage.js b/frontend/app/components/Session_/Storage/Storage.js index 1b36e727c..f4f2cd80b 100644 --- a/frontend/app/components/Session_/Storage/Storage.js +++ b/frontend/app/components/Session_/Storage/Storage.js @@ -14,8 +14,8 @@ import { diff } from 'deep-diff'; import { jump } from 'Player'; import Autoscroll from '../Autoscroll'; import BottomBlock from '../BottomBlock/index'; -import DiffRow from './DiffRow' -import cn from 'classnames' +import DiffRow from './DiffRow'; +import cn from 'classnames'; import stl from './storage.module.css'; // const STATE = 'STATE'; @@ -112,7 +112,7 @@ export default class Storage extends React.PureComponent { } renderDiffs(diff, i) { - const [path, pathRoot] = this.createPathAndBg(diff) + const [path, pathRoot] = this.createPathAndBg(diff); return ( @@ -183,9 +183,15 @@ export default class Storage extends React.PureComponent { } return ( -
+
{src === null ? ( -
{name}
+
+ {' '} + {name}{' '} +
) : ( <> {this.renderDiff(item, prevItem)}