Skip to content

Commit 1f6796d

Browse files
committed
merge caner
2 parents 9ef6f8b + d3a766e commit 1f6796d

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

src/app/components/StateRoute.tsx

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const StateRoute = (props: StateRouteProps) => {
115115
return <div className="noState">{NO_STATE_MSG}</div>;
116116
};
117117
const renderWebMetrics = () => {
118-
let LCPColor, FIDColor, CLSColor, FCPColor, TTFBColor;
118+
let LCPColor, FIDColor, FCPColor, TTFBColor;
119119

120120
if (webMetrics.LCP <= 2000) LCPColor = "#0bce6b";
121121
if (webMetrics.LCP > 2000 && webMetrics.LCP < 4000) LCPColor = "#E56543";
@@ -131,30 +131,14 @@ const StateRoute = (props: StateRouteProps) => {
131131

132132
return (
133133
<div className="web-metrics-container">
134-
<WebMetrics
135-
color={LCPColor}
136-
series={(webMetrics.LCP / 2500) * 100}
137-
formatted={(val) => ((val / 100) * 2500).toFixed(2) + ' ms'}
138-
label="LCP"
139-
/>
140-
<WebMetrics
141-
color={FIDColor}
142-
series={webMetrics.FID * 25}
143-
formatted={(val) => (val / 25).toFixed(2) + " ms"}
144-
label="FID"
145-
/>
146-
<WebMetrics
147-
color={FCPColor}
148-
series={(webMetrics.FCP / 1000) * 100}
149-
formatted={(val) => ((val / 100) * 1000).toFixed(2) + " ms"}
150-
label="FCP"
151-
/>
152-
<WebMetrics
153-
color={TTFBColor}
154-
series={(webMetrics.TTFB / 10) * 100}
155-
formatted={(val) => ((val / 100) * 10).toFixed(2) + " ms"}
156-
label="TTFB"
157-
/>
134+
<WebMetrics color={LCPColor} series={(webMetrics.LCP / 2500) * 100}
135+
formatted={(val) => { return (Number.isNaN(val)) ? '- ms' : (((val / 100) * 2500).toFixed(2) + ' ms')}}
136+
label="LCP" />
137+
<WebMetrics color={FIDColor} series={(webMetrics.FID) * 25}
138+
formatted={(val) => { return (Number.isNaN(val)) ? '- ms' : ((val / 25).toFixed(2) + ' ms')}}
139+
label="FID" />
140+
<WebMetrics color={FCPColor} series={(webMetrics.FCP / 1000) * 100} formatted={(val) => ((val / 100) * 1000).toFixed(2) + ' ms'} label="FCP"/>
141+
<WebMetrics color={TTFBColor} series={(webMetrics.TTFB / 10) * 100} formatted={(val) => ((val / 100) * 10).toFixed(2) + ' ms'} label="TTFB"/>
158142
</div>
159143
);
160144
};

0 commit comments

Comments
 (0)