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

Stats: add Geochart regions/cities #98055

Merged
merged 4 commits into from
Jan 8, 2025
Merged

Conversation

myhro
Copy link
Contributor

@myhro myhro commented Jan 8, 2025

Closes Automattic/jetpack-roadmap#2093.

Proposed Changes

  • Render Regions/Cities as circle markers, instead of coloring their entire country.

Why are these changes being made?

  • (p1HpG7-rpL-p2)

Testing Instructions

  • Go to the Calypso Live preview environment.
  • Access the Stats page of a website that has meaningful data, like /stats/day/jetpack.com?flags=stats/locations
    • It's important to keep the feature flag to enable the visualization.
  • Scroll down to the map and click on the Regions and Cities tabs close to it.

Regions

Before After
image image

Cities

Before After
image image

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests 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 UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • 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)?

myhro added 3 commits January 7, 2025 20:52
It will be less confusing when used together with statType and it's also
consistent with the useLocationViewsQuery arguments.
Regions/cities should be marked as circles, instead of coloring the
entire country.
@matticbot
Copy link
Contributor

matticbot commented Jan 8, 2025

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

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

  • blaze-dashboard
  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug add/stats-geochart-subdivisions on your sandbox.

@myhro myhro added [Feature] Stats Everything related to our analytics product at /stats/ [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 8, 2025
@myhro myhro requested review from Initsogar and a team January 8, 2025 01:00
@matticbot
Copy link
Contributor

matticbot commented Jan 8, 2025

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

Sections (~75 bytes added 📈 [gzipped])

name   parsed_size           gzip_size
stats       +230 B  (+0.0%)      +75 B  (+0.0%)

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.

@@ -30,9 +30,9 @@ const OPTION_KEYS = {
CITIES: 'cities',
};

type StatQueryType = 'country' | 'region' | 'city';
type GeoMode = 'country' | 'region' | 'city';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name to avoid confusion between statType and statQueryType. Geomode makes a bit more sense and it's the name of the argument of useLocationViewsQuery().

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense :)

Preserves the current behavior when not specified.
@myhro myhro changed the title Add/stats geochart subdivisions Stats: add Geochart regions/cities Jan 8, 2025
Copy link
Contributor

@Initsogar Initsogar left a comment

Choose a reason for hiding this comment

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

Works well and looks good to me. I validated without the feature flag and the existing country module is not affected by this change 👍🏽

image

@myhro myhro merged commit 9a45c25 into trunk Jan 8, 2025
13 checks passed
@myhro myhro deleted the add/stats-geochart-subdivisions branch January 8, 2025 14:18
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Stats Everything related to our analytics product at /stats/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants