Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Profiler: Add MetricsSection component #90662

Merged
merged 1 commit into from May 14, 2024

Conversation

WBerredo
Copy link
Collaborator

Related to https://github.com/Automattic/dotcom-forge/issues/6910

Proposed Changes

Add the MetricsSection component, this component will display a title, a name, and a link and render the children block inside of it.

Why are these changes being made?

This component will be used as the base of every section on the Site Profiler new version

Testing Instructions

  • Go to /site-profiler/:url. Ex: /site-profiler/example.com
  • Scroll down and check if the sections are displayed as below.

CleanShot 2024-05-13 at 14 30 44@2x

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • https://wpcalypso.wordpress.com/devdocs/docs/testing/index.md for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

Comment on lines +177 to +183
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" />,
},
Copy link
Collaborator Author

@WBerredo WBerredo May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How we will display the success and alert pieces are still to be discussed, but this is a way to show how they will appear on the section title.

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • blaze-dashboard
  • command-palette-wp-admin
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/site-profiler-metrics-section on your sandbox.

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~816 bytes added 📈 [gzipped])

name           parsed_size           gzip_size
site-profiler      +2461 B  (+2.6%)     +816 B  (+3.2%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the components, and they look great. I have left a non-blocking comment that can be addressed in this or in a follow-up task

onCTAClick={ () => setIsGetReportFormOpen( true ) }
/>
<BasicMetrics ref={ basicMetricsRef } basicMetrics={ basicMetrics.basic } />
<MetricsSection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating a component to encapsulate all the display logic of advanced metrics? I was thinking in something like <AdvancedMetrics... that will accept an array of refs (or just all the refs as different props) and the response of calling the /site-profiler/advance endpoint.

That way, all the logic to iterate the response and decide what titles to show will be handled in a separate component that can grow independently of this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a separate issue here: #90704

@WBerredo WBerredo merged commit f9b1260 into trunk May 14, 2024
12 checks passed
@WBerredo WBerredo deleted the add/site-profiler-metrics-section branch May 14, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants