From 7c0da02df414ea0ab708aff56923a651be61abf5 Mon Sep 17 00:00:00 2001 From: Yu Yi <58987452+yuyi-sl@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:24:16 +0200 Subject: [PATCH] Redesign main table (#139) * use new variable for 8px size * wip - grid * tooltip timechart * layout on selected request * styling clean up * remove scroll to selected request * collapse all besides General * update test snapshots * remove unused deps * adjust layout * option to hide waterfall * remove react-window dep * decrease padding and font-size * adjust styling for request details * clean up * virtualize network table body --- src/Components/Common/Dropdown.styles.scss | 2 +- src/Components/Common/Tooltip/Tooltip.jsx | 5 +- .../Common/Tooltip/Tooltip.styles.scss | 1 + src/Components/Import/ImportHAR.jsx | 23 +- .../NetworkTable/NetworkCellValue.jsx | 28 +- .../NetworkTable/NetworkTable.styles.scss | 104 +++ .../NetworkTable/NetworkTableBody.jsx | 77 +++ .../NetworkTable/NetworkTableFooter.jsx | 9 +- .../NetworkTableFooter.styles.scss | 24 - .../NetworkTable/NetworkTableHeader.jsx | 54 +- .../NetworkTableHeader.styles.scss | 87 --- .../NetworkTable/NetworkTableRow.jsx | 83 ++- src/Components/NetworkTable/TimeChart.jsx | 5 +- .../NetworkTable/TimeChart.styles.scss | 2 +- .../NetworkTable/TimeChartTooltip.jsx | 5 +- src/Components/ReqDetail/Headers.jsx | 9 +- src/Components/ReqDetail/Headers.styles.scss | 15 +- .../ReqDetail/headers/HeaderInfo.jsx | 11 +- src/Containers/MainContainer.jsx | 14 +- src/Containers/MainContainer.styles.scss | 6 +- src/Containers/NetworkTableContainer.jsx | 72 +- .../NetworkTableContainer.styles.scss | 43 +- src/Containers/ReqDetailContainer.styles.scss | 14 +- src/NetworkViewer.jsx | 3 +- src/constants.js | 49 +- src/hooks/useResizeObserver.js | 35 + src/state/network/Context.jsx | 1 + src/state/network/NetworkProvider.jsx | 6 +- src/state/network/actions.js | 5 + src/state/network/reducer.js | 6 + src/state/network/types.js | 1 + src/styles/variables.scss | 8 +- src/utils.js | 33 +- .../__snapshots__/Search.spec.jsx.snap | 2 + .../__snapshots__/ImportHar.spec.jsx.snap | 3 +- .../NetworkTable/NetworkTableHeader.spec.jsx | 5 +- .../NetworkTable/NetworkTableRow.spec.jsx | 12 +- .../NetworkTableFooter.spec.jsx.snap | 2 +- .../NetworkTableHeader.spec.jsx.snap | 168 +++-- .../NetworkTableRow.spec.jsx.snap | 639 ++++++++++-------- .../__snapshots__/Headers.spec.jsx.snap | 61 +- .../__snapshots__/HeaderInfo.spec.jsx.snap | 3 +- .../FilterContainer.spec.jsx.snap | 3 +- .../__snapshots__/MainContainer.spec.jsx.snap | 12 +- .../NetworkTableContainer.spec.jsx.snap | 7 +- .../ReqDetailContainer.spec.jsx.snap | 2 + .../TimelineContainer.spec.jsx.snap | 2 + .../__snapshots__/NetworkViewer.spec.jsx.snap | 6 +- .../NetworkProvider.spec.jsx.snap | 4 + 49 files changed, 1025 insertions(+), 746 deletions(-) create mode 100644 src/Components/NetworkTable/NetworkTable.styles.scss create mode 100644 src/Components/NetworkTable/NetworkTableBody.jsx delete mode 100644 src/Components/NetworkTable/NetworkTableFooter.styles.scss delete mode 100644 src/Components/NetworkTable/NetworkTableHeader.styles.scss create mode 100644 src/hooks/useResizeObserver.js diff --git a/src/Components/Common/Dropdown.styles.scss b/src/Components/Common/Dropdown.styles.scss index 086c8b4..6576b83 100644 --- a/src/Components/Common/Dropdown.styles.scss +++ b/src/Components/Common/Dropdown.styles.scss @@ -6,7 +6,7 @@ .dropdown-toggle { display: flex; justify-content: space-between; - width: 7.5rem; + width: 8.5rem; font-weight: 500; font-size: $font-size-h5; diff --git a/src/Components/Common/Tooltip/Tooltip.jsx b/src/Components/Common/Tooltip/Tooltip.jsx index 3afaebf..d1d5f39 100644 --- a/src/Components/Common/Tooltip/Tooltip.jsx +++ b/src/Components/Common/Tooltip/Tooltip.jsx @@ -22,10 +22,7 @@ const Tooltip = forwardRef(({ const targetRef = useObjectRef(forwardedRef); const tooltipRef = useRef(null); - const state = useTooltipTriggerState({ - // isOpen: true, - delay, - }); + const state = useTooltipTriggerState({ delay }); const { overlayProps, diff --git a/src/Components/Common/Tooltip/Tooltip.styles.scss b/src/Components/Common/Tooltip/Tooltip.styles.scss index 78f2975..31da101 100644 --- a/src/Components/Common/Tooltip/Tooltip.styles.scss +++ b/src/Components/Common/Tooltip/Tooltip.styles.scss @@ -11,6 +11,7 @@ display: inline-block; background-color: $brand-primary-dark-gray; color: $white-100; + font-size: $font-size-small; padding: $size-xs $size-xs-s; border: $border; border-radius: $border-radius-base; diff --git a/src/Components/Import/ImportHAR.jsx b/src/Components/Import/ImportHAR.jsx index 43efee7..71502ac 100644 --- a/src/Components/Import/ImportHAR.jsx +++ b/src/Components/Import/ImportHAR.jsx @@ -4,8 +4,6 @@ import { useDropzone } from 'react-dropzone'; import { useNetwork } from './../../state/network/Context'; import Styles from './ImportHAR.styles.scss'; -import Button from './../Common/Button'; -import IconUpload from '../../icons/IconImport'; import ImportHarButton from '../Actions/ImportHarButton'; const DROP_FILE_CONFIG = { @@ -13,10 +11,7 @@ const DROP_FILE_CONFIG = { multiple: false, }; -const ImportHar = ({ - showButton, - className, -}) => { +const ImportHar = ({ showButton }) => { const { actions } = useNetwork(); const { updateErrorMessage } = actions; @@ -48,25 +43,21 @@ const ImportHar = ({ return (
- Drag and drop HAR file here, or click to select - file -
- )} + {showButton ?+ Drag and drop HAR file here, or click to select + file +
+ )}- - Connection: - - - keep-alive - -
-- - Connection: - - - keep-alive - -
-- { - "hello": "foo" -} --