Skip to content

Commit acab165

Browse files
committed
no data state
1 parent 0aa23d7 commit acab165

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

src/Components/NetworkTable/NetworkTable.styles.scss

+24
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@
55
border-top: $border;
66
}
77

8+
.no-data {
9+
display: flex;
10+
flex-direction: column;
11+
align-items: center;
12+
padding-top: $size-xxxl;
13+
14+
.network-icon {
15+
fill: $brand-primary-light-gray;
16+
height: $size-xl;
17+
width: $size-xl;
18+
}
19+
20+
.header {
21+
padding: $size-xl 0 $size-s 0;
22+
font-weight: 600;
23+
color: $brand-primary-dark-gray;
24+
}
25+
26+
.subtext {
27+
color: $brand-primary-gray;
28+
}
29+
}
30+
31+
832
.network-table-header {
933
display: flex;
1034
width: 100%;

src/Components/NetworkTable/NetworkTableBody.jsx

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { TABLE_ENTRY_HEIGHT } from '../../constants';
88
import { useResizeObserver } from '../../hooks/useResizeObserver';
99
import Styles from './NetworkTable.styles.scss';
1010
import { useTheme } from '../../state/theme/Context';
11+
import IconNetworkRequest from '../../icons/IconNetworkRequest';
1112

1213
/* eslint no-underscore-dangle: 0 */
1314

@@ -45,6 +46,7 @@ const NetworkTableBody = ({ height }) => {
4546
const { enableAutoScroll } = useTheme();
4647
const numberOfNewEntries = state.get('numberOfNewEntries');
4748
const data = state.get('data');
49+
const actualData = state.get('actualData');
4850
const totalNetworkTime = state.get('totalNetworkTime');
4951
const selectedReqIndex = state.get('selectedReqIndex');
5052

@@ -75,6 +77,19 @@ const NetworkTableBody = ({ height }) => {
7577
callbacks.onRequestSelect(payload);
7678
};
7779

80+
if (actualData.size === 0) {
81+
return (
82+
<div
83+
ref={ref}
84+
className={Styles['no-data']}
85+
>
86+
<IconNetworkRequest className={Styles['network-icon']} />
87+
<span className={Styles.header}>Recording network activity</span>
88+
<span className={Styles.subtext}>Perform a request to see the network activity</span>
89+
</div>
90+
);
91+
}
92+
7893
return (
7994
<>
8095
<FixedSizeList

src/icons/IconNetworkRequest.jsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
const IconNetworkRequest = ({ className }) => (
5+
<svg
6+
className={className}
7+
height="24"
8+
viewBox="0 0 24 24"
9+
width="24"
10+
xmlns="http://www.w3.org/2000/svg"
11+
>
12+
<path d="M5.5 14.4999C5.5 14.7761 5.72386 14.9999 6 14.9999H8C8.27614 14.9999 8.5 14.7761 8.5 14.4999V6.99994H12.5697C12.7399 6.99994 12.8323 6.80096 12.7225 6.67093L7.1531 0.0736706C7.0732 -0.0209768 6.92735 -0.0209758 6.84745 0.0736716L1.27803 6.67093C1.16826 6.80096 1.26069 6.99994 1.43085 6.99994H5.5V14.4999Z" />
13+
<path d="M15.5 9.49994C15.5 9.2238 15.7239 8.99994 16 8.99994H18C18.2761 8.99994 18.5 9.2238 18.5 9.49994V16.9999H22.5697C22.7399 16.9999 22.8323 17.1989 22.7225 17.329L17.1531 23.9262C17.0732 24.0209 16.9274 24.0209 16.8474 23.9262L11.278 17.329C11.1683 17.1989 11.2607 16.9999 11.4309 16.9999H15.5V9.49994Z" />
14+
</svg>
15+
16+
);
17+
18+
IconNetworkRequest.propTypes = {
19+
className: PropTypes.string,
20+
};
21+
22+
IconNetworkRequest.defaultProps = {
23+
className: '',
24+
};
25+
26+
export default IconNetworkRequest;

src/styles/variables.scss

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $brand-success: #70be44;
44
$brand-warning: #f68d38;
55
$brand-primary-dark-gray: #1E2127;
66
$brand-primary-gray: #6D7584;
7+
$brand-primary-light-gray: #979EAB;
78
$dark-gray: #5c7288;
89
$bg-blue-50: #e6f1fd;
910
$bg-gray-90: #F7F8FA;

0 commit comments

Comments
 (0)