Skip to content

Commit a1dc57b

Browse files
Christopher StamperChristopher Stamper
authored andcommitted
Added warning to graphs and removed benchmarks from popup
1 parent 4390e44 commit a1dc57b

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/app/components/StateRoute/StateRoute.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ const StateRoute = (props: StateRouteProps) => {
128128
typeof webMetrics.LCP !== 'number' ? '- ms' : `${webMetrics.LCP.toFixed(2)} ms`
129129
}
130130
score={['2500 ms', '4000 ms']}
131+
overLimit={webMetrics.LCP > 7000}
131132
label='Largest Contentful Paint'
132133
name='Largest Contentful Paint'
133-
description='Measures loading performance. The benchmark is less than 2500 ms.'
134+
description='Measures loading performance.'
134135
/>
135136
<WebMetrics
136137
color={FIDColor}
@@ -139,9 +140,10 @@ const StateRoute = (props: StateRouteProps) => {
139140
typeof webMetrics.FID !== 'number' ? '- ms' : `${webMetrics.FID.toFixed(2)} ms`
140141
}
141142
score={['100 ms', '300 ms']}
143+
overLimit={webMetrics.FID > 500}
142144
label='First Input Delay'
143145
name='First Input Delay'
144-
description='Measures interactivity. The benchmark is less than 100 ms.'
146+
description='Measures interactivity.'
145147
/>
146148
<WebMetrics
147149
color={FCPColor}
@@ -150,9 +152,10 @@ const StateRoute = (props: StateRouteProps) => {
150152
typeof webMetrics.FCP !== 'number' ? '- ms' : `${webMetrics.FCP.toFixed(2)} ms`
151153
}
152154
score={['1800 ms', '3000 ms']}
155+
overLimit={webMetrics.FCP > 5000}
153156
label='First Contentful Paint'
154157
name='First Contentful Paint'
155-
description='Measures the time it takes the browser to render the first piece of DOM content. No benchmark.'
158+
description='Measures the time it takes the browser to render the first piece of DOM content.'
156159
/>
157160
<WebMetrics
158161
color={TTFBColor}
@@ -161,9 +164,10 @@ const StateRoute = (props: StateRouteProps) => {
161164
typeof webMetrics.TTFB !== 'number' ? '- ms' : `${webMetrics.TTFB.toFixed(2)} ms`
162165
}
163166
score={['800 ms', '1800 ms']}
167+
overLimit={webMetrics.TTFB > 3000}
164168
label='Time To First Byte'
165169
name='Time to First Byte'
166-
description='Measures the time it takes for a browser to receive the first byte of page content. The benchmark is 600 ms.'
170+
description='Measures the time it takes for a browser to receive the first byte of page content.'
167171
/>
168172
<WebMetrics
169173
color={CLSColor}
@@ -176,6 +180,7 @@ const StateRoute = (props: StateRouteProps) => {
176180
}`
177181
}
178182
score={['0.1', '0.25']}
183+
overLimit={webMetrics.CLS > 0.5}
179184
label='Cumulative Layout Shift'
180185
name='Cumulative Layout Shift'
181186
description={`Quantifies the visual stability of a web page by measuring layout shifts during the application's loading and interaction.`}
@@ -187,6 +192,7 @@ const StateRoute = (props: StateRouteProps) => {
187192
typeof webMetrics.INP !== 'number' ? '- ms' : `${webMetrics.INP.toFixed(2)} ms`
188193
}
189194
score={['200 ms', '500 ms']}
195+
overLimit={webMetrics.LCP > 700}
190196
label='Interaction to Next Paint'
191197
name='Interaction to Next Paint'
192198
description={`Assesses a page's overall responsiveness to user interactions by observing the latency of all click, tap, and keyboard interactions that occur throughout the lifespan of a user's visit to a page`}

src/app/components/WebMetrics.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ const radialGraph = (props) => {
2929
hollow: {
3030
margin: 0,
3131
size: '75%',
32-
background: '#242529',
33-
image: undefined,
32+
background: 'transparent',
33+
// background: '#242529',
34+
image: props.overLimit
35+
? 'https://static.vecteezy.com/system/resources/thumbnails/012/042/301/small/warning-sign-icon-transparent-background-free-png.png'
36+
: undefined,
37+
imageWidth: 32,
38+
imageHeight: 32,
3439
imageOffsetX: 0,
35-
imageOffsetY: 0,
40+
imageOffsetY: -64,
41+
imageClipped: false,
3642
position: 'front',
3743
dropShadow: {
3844
enabled: false,

0 commit comments

Comments
 (0)