-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Profiler: Wrap logic inside a AdvancedMetrics component (#90765)
- Loading branch information
Showing
3 changed files
with
62 additions
and
41 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
client/site-profiler/components/advanced-metrics/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { useTranslate } from 'i18n-calypso'; | ||
import { MetricsInsightsList } from 'calypso/site-profiler/components/metrics-insights-list'; | ||
import { MetricsSection } from 'calypso/site-profiler/components/metrics-section'; | ||
|
||
interface AdvancedMetricsProps { | ||
performanceMetricsRef?: React.RefObject< HTMLObjectElement >; | ||
healthScoresRef?: React.RefObject< HTMLObjectElement >; | ||
} | ||
|
||
export const AdvancedMetrics: React.FC< AdvancedMetricsProps > = ( props ) => { | ||
const translate = useTranslate(); | ||
const { performanceMetricsRef, healthScoresRef } = props; | ||
|
||
return ( | ||
<> | ||
<MetricsSection | ||
name={ translate( 'Performance Metrics' ) } | ||
title={ translate( | ||
"Your site {{success}}performs well{{/success}}, but there's always room to be faster and smoother for your visitors.", | ||
{ | ||
components: { | ||
success: <span className="success" />, | ||
alert: <span className="alert" />, | ||
}, | ||
} | ||
) } | ||
subtitle={ translate( "Boost your site's performance" ) } | ||
ref={ performanceMetricsRef } | ||
> | ||
<MetricsInsightsList | ||
insights={ Array( 10 ).fill( { | ||
header: | ||
'Your site reveals first content slower than 76% of peers, affecting first impressions.', | ||
description: 'This is how you can improve it', | ||
} ) } | ||
/> | ||
</MetricsSection> | ||
<MetricsSection | ||
name={ translate( 'Health Scores' ) } | ||
title={ translate( | ||
"Your site's health scores {{alert}}suggest critical area{{/alert}} but need attention to prevent low performance.", | ||
{ | ||
components: { | ||
success: <span className="success" />, | ||
alert: <span className="alert" />, | ||
}, | ||
} | ||
) } | ||
subtitle={ translate( "Optimize your site's health" ) } | ||
ref={ healthScoresRef } | ||
> | ||
<MetricsInsightsList locked /> | ||
</MetricsSection> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters