Skip to content

Conversation

annacmc
Copy link
Contributor

@annacmc annacmc commented Oct 3, 2025

Proposed changes:

  • Remove label and note props from PieSemiCircleChart component
  • Update component to use children composition pattern like PieChart
  • Remove unused label and note CSS styles from component stylesheet
  • Update all tests to use children composition with visx Group and Text components
  • Update component stories to demonstrate children composition pattern
  • Update chart-context provider stories to use new API

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Does this pull request change what data or activity we track or use?

No, it does not.

Testing instructions:

  • Go to Storybook -> Charts -> Types -> Pie Semi Circle Chart
  • Verify all stories render correctly with the new children composition API
  • Check the "Default" story shows text rendered using Group and Text components
  • Verify the "With Composition Legend" story works as expected
  • Test the "Composition API" story to see various composition patterns
  • Ensure tooltips, legends, and all chart interactions continue to work
  • Verify no TypeScript errors in any story files
  • Confirm visual appearance matches previous implementation
  • Test that custom children content can be easily added using visx components

@annacmc annacmc self-assigned this Oct 3, 2025
@annacmc annacmc added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Oct 3, 2025
Copy link
Contributor

github-actions bot commented Oct 3, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the charts-65-iterate-over-pie-and-piesemicircle-composition branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack charts-65-iterate-over-pie-and-piesemicircle-composition

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@annacmc annacmc requested a review from Copilot October 3, 2025 12:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the label/note props from PieSemiCircleChart and standardizes content rendering via a children composition API, aligning it with PieChart. It updates tests and stories accordingly and removes unused styles.

  • Remove label and note props and switch to children-based composition
  • Update tests and stories to render text via visx Group/Text and compound components (SVG/HTML/Legend)
  • Remove unused SCSS for label/note

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/js-packages/charts/src/providers/chart-context/stories/index.stories.tsx Storybook provider stories updated to render chart headings via children using Group/Text.
projects/js-packages/charts/src/components/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx Tests migrated from label/note props to children composition; added compound component coverage.
projects/js-packages/charts/src/components/pie-semi-circle-chart/stories/index.stories.tsx Component stories updated to demonstrate children composition and compound components.
projects/js-packages/charts/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx Removed label/note props and their rendering; documented composition API usage on children prop.
projects/js-packages/charts/src/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss Removed unused .label and .note styles.
projects/js-packages/charts/changelog/charts-65-iterate-over-pie-and-piesemicircle-composition Changelog entry added for composition improvements.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1 to +4
Significance: minor
Type: changed

Charts: improve pie semi circle chart composition
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

Removing the label and note props is a breaking API change. Please mark this as a breaking change in the changelog (e.g., Significance: major and/or Type: breaking-change) and include a brief migration note showing how to render labels via children (Group/Text or PieSemiCircleChart.SVG).

Suggested change
Significance: minor
Type: changed
Charts: improve pie semi circle chart composition
Significance: major
Type: breaking-change
Charts: improve pie semi circle chart composition
Breaking change: The `label` and `note` props have been removed from PieSemiCircleChart. To render labels, use children components such as `<Group><Text /></Group>` or render SVG elements directly via `PieSemiCircleChart.SVG`.
Migration note:
Before:
<PieSemiCircleChart label="My Label" note="Some note" ... />
After:
<PieSemiCircleChart ...>
<Group>
<Text>My Label</Text>
<Text>Some note</Text>
</Group>
</PieSemiCircleChart>
// Or use PieSemiCircleChart.SVG for custom SVG rendering.

Copilot uses AI. Check for mistakes.

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 don't think the semi-circle chart label and note props are currently being used by any consumers, so I don't think it needs to be a significant/major change in the changelog. I'm open to having my mind changed on this, but at this time I don't think this feedback is necessary.


/**
* Use the children prop to render additional elements on the chart.
* Supports composition API with PieSemiCircleChart.SVG and PieSemiCircleChart.HTML components.
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Since label/note props were removed, consider adding a short usage example in this docblock showing how to render a title/note via children (Group/Text) and via the SVG compound component to guide consumers migrating to the new API.

Suggested change
* Supports composition API with PieSemiCircleChart.SVG and PieSemiCircleChart.HTML components.
* Supports composition API with PieSemiCircleChart.SVG and PieSemiCircleChart.HTML components.
*
* Usage examples:
* 1. Render a title/note via children (Group/Text):
* <PieSemiCircleChart ...>
* <Group>
* <Text x={width / 2} y={height / 2} textAnchor="middle">
* Chart Title
* </Text>
* </Group>
* </PieSemiCircleChart>
*
* 2. Render a title/note via the SVG compound component:
* <PieSemiCircleChart ...>
* <PieSemiCircleChart.SVG>
* <Group>
* <Text x={width / 2} y={height / 2} textAnchor="middle">
* Chart Title
* </Text>
* </Group>
* </PieSemiCircleChart.SVG>
* </PieSemiCircleChart>

Copilot uses AI. Check for mistakes.

Comment on lines +210 to +223
it( 'renders PieSemiCircleChart.SVG compound component', () => {
render(
<GlobalChartsProvider>
<PieSemiCircleChart data={ mockData }>
<PieSemiCircleChart.SVG>
<Group>
<Text textAnchor="middle" y={ -50 }>
SVG Component Title
</Text>
</Group>
</PieSemiCircleChart.SVG>
</PieSemiCircleChart>
</GlobalChartsProvider>
);
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

[nitpick] For consistency and to reduce duplication, consider using the existing renderPieChart helper in this test (and the similar cases below) instead of directly calling render with GlobalChartsProvider.

Copilot uses AI. Check for mistakes.

Copy link

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[JS Package] Charts RNA [Status] In Progress [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant