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

Calypso UI Components: DateRange: Refactor "header" and "footer" areas of component #94567

Merged

Conversation

annacmc
Copy link
Contributor

@annacmc annacmc commented Sep 16, 2024

Related to https://github.com/Automattic/red-team/issues/178

  • In order to move the buttons (the sole occupant of the header component) to the footer area, I refactored to add a new footer component for the buttons, and move the existing title/header info into the header component.
  • This also involved adding a new renderFooter function + adding this to the docs

Why are these changes being made?

  • To extend the Calypso DateRange picker component for use with the Stats Date Control update.

Testing Instructions

  • open Calypso live branch
  • navigate to /devdocs/design/date-range
  • check the default demo at the top. Check that everything still displays correctly, including when selecting custom dates check that the please select the first day text changes to please select the last day to reset as you select date ranges
  • check that the cancel + apply buttons display below the calendars now
  • now check the With custom title demo it at the top
  • check the above things with the styling, location, buttons, etc.
default header behaviour with custom title passed through
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 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)?

@matticbot
Copy link
Contributor

matticbot commented Sep 16, 2024

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

Sections (~241 bytes added 📈 [gzipped])

name                           parsed_size           gzip_size
stats                               +164 B  (+0.0%)      +87 B  (+0.0%)
plugins                             +164 B  (+0.0%)      +75 B  (+0.0%)
media                               +164 B  (+0.0%)      +75 B  (+0.0%)
jetpack-cloud-agency-sites-v2       +164 B  (+0.0%)      +79 B  (+0.0%)
backup                              +164 B  (+0.0%)      +79 B  (+0.0%)
activity                            +164 B  (+0.0%)      +79 B  (+0.0%)
a8c-for-agencies-sites              +164 B  (+0.0%)      +79 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.

Async-loaded Components (~162 bytes added 📈 [gzipped])

name                                               parsed_size           gzip_size
async-load-store-app-store-stats-listview               +164 B  (+0.0%)      +87 B  (+0.1%)
async-load-store-app-store-stats                        +164 B  (+0.0%)      +87 B  (+0.0%)
async-load-design-playground                            +164 B  (+0.0%)      +75 B  (+0.0%)
async-load-design-blocks                                +164 B  (+0.0%)      +75 B  (+0.0%)
async-load-design                                       +164 B  (+0.0%)      +75 B  (+0.0%)
async-load-calypso-post-editor-media-modal              +164 B  (+0.0%)      +75 B  (+0.0%)
async-load-calypso-post-editor-editor-media-modal       +164 B  (+0.0%)      +75 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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.

@annacmc annacmc force-pushed the update/calypso-ui-component-daterange-layout branch from 75db8a2 to a3adccd Compare September 16, 2024 06:22
@annacmc annacmc force-pushed the update/calupso-ui-component-daterange-refactor-header-footer branch from 0e534f3 to ed62e9e Compare September 16, 2024 06:24
@annacmc annacmc self-assigned this Sep 16, 2024
@annacmc annacmc added [Feature] Stats Everything related to our analytics product at /stats/ Components labels Sep 16, 2024
@matticbot
Copy link
Contributor

matticbot commented Sep 16, 2024

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

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

  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/calupso-ui-component-daterange-refactor-header-footer on your sandbox.

Base automatically changed from update/calypso-ui-component-daterange-layout to trunk September 16, 2024 07:49
@annacmc annacmc force-pushed the update/calupso-ui-component-daterange-refactor-header-footer branch from ed62e9e to 92ecd23 Compare September 16, 2024 08:38
@annacmc annacmc force-pushed the update/calupso-ui-component-daterange-refactor-header-footer branch from 92ecd23 to a661941 Compare September 16, 2024 21:42
@annacmc annacmc requested a review from a team September 16, 2024 23:23
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 16, 2024
@annacmc annacmc marked this pull request as ready for review September 16, 2024 23:26
.DayPicker-Day--start.DayPicker-Day--range-start,
.DayPicker-Day--end.DayPicker-Day--range-end {
& .date-picker__day {
.DayPicker-Day--range,
Copy link
Contributor

Choose a reason for hiding this comment

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

are these changes intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm maybe my rebase got a bit out of control here. Those look like your changes from yesterday with the range styling, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a rebase issue here yes. If you take a look at the highlight colors, is it still working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing that up to bring all your work back in now. Sorry about that 🙈

@kangzj
Copy link
Contributor

kangzj commented Sep 17, 2024

TS type error in teamcity:

[01:28:14 ](https://teamcity.a8c.com/buildConfiguration/calypso_calypso_WebApp_Run_All_Unit_Tests/13343472?buildTab=log&linesState=7981&logView=flowAware&focusLine=7981)
    client/components/date-range/header.tsx(48,7): error TS2322: Type '{ children: ExistingReactNode; className: string; borderless: true; compact: true; onClick: () => void; "aria-label": string; }' is not assignable to type 'IntrinsicAttributes & ((ButtonProps & DeprecatedButtonProps) & RefAttributes<any>)'.

[01:28:14 ](https://teamcity.a8c.com/buildConfiguration/calypso_calypso_WebApp_Run_All_Unit_Tests/13343472?buildTab=log&linesState=7982&logView=flowAware&focusLine=7982)
      Property 'borderless' does not exist on type 'IntrinsicAttributes & ((ButtonProps & DeprecatedButtonProps) & RefAttributes<any>)'.

Copy link
Contributor

@kangzj kangzj left a comment

Choose a reason for hiding this comment

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

Nice refactoring! LGTM 🚀

{ applyText }
</Button>
<div className="date-range__controls">
{ customTitle ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

This is definitely isn't a blocker, but I'm still thinking maybe we shouldn't hide the help functions when there is a custom title, i.e. it'll be better if the custom title and the helpers could co-exist.

Just something for you to consider. Not a priority right now.

Great work!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I agree there may be some way for them to work together in a future iteration. We will figure something out!

@annacmc annacmc merged commit 45ecb8b into trunk Sep 17, 2024
11 checks passed
@annacmc annacmc deleted the update/calupso-ui-component-daterange-refactor-header-footer branch September 17, 2024 02:26
@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 Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Components [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