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

Assembler: Add the shuffle button to the action bar #80078

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

arthur791004
Copy link
Contributor

@arthur791004 arthur791004 commented Aug 1, 2023

Related to #79656

Proposed Changes

  • Added the shuffle button to the action bar so users can quickly preview other patterns with the same category
  • Added the new event called calypso_signup_pattern_assembler_pattern_shuffle_click to track how many users click the shuffle button.

Demo

assembler-shuffle-patterns.mov

Event

image

Testing Instructions

  • Go to /setup/with-theme-assembler?siteSlug=<your_site>
  • Select any header, sections, footer
  • Hover on the patterns in the large preview
  • Click the shuffle button on the action bar
  • Ensure you're able to shuffle to another pattern with the same category

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-ajp-p2)?

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

@arthur791004 arthur791004 self-assigned this Aug 1, 2023
@matticbot
Copy link
Contributor

matticbot commented Aug 1, 2023

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

Sections (~1122 bytes added 📈 [gzipped])

name                    parsed_size           gzip_size
pattern-assembler-step      +1852 B  (+0.1%)     +641 B  (+0.1%)
import-flow                 +1852 B  (+0.1%)     +677 B  (+0.1%)

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.

@arthur791004 arthur791004 force-pushed the feat/assembler-shuffle-patterns branch from b6b57b7 to e48eeb2 Compare August 1, 2023 07:21
@arthur791004 arthur791004 requested a review from a team August 1, 2023 07:21
@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 Aug 1, 2023

export const getShuffledPattern = ( candidates: Pattern[], current: Pattern ) => {
const filteredCandidates = candidates.filter( ( { ID } ) => ID !== current.ID );
const shuffledIndex = Math.floor( Math.random() * filteredCandidates.length );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question: Do we want to pick randomly or just the next one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's go with random, as per core's implementation draft.

Copy link
Contributor

@taipeicoder taipeicoder left a comment

Choose a reason for hiding this comment

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

LGTM 👍


export const getShuffledPattern = ( candidates: Pattern[], current: Pattern ) => {
const filteredCandidates = candidates.filter( ( { ID } ) => ID !== current.ID );
const shuffledIndex = Math.floor( Math.random() * filteredCandidates.length );
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's go with random, as per core's implementation draft.

@arthur791004 arthur791004 merged commit d42ba25 into trunk Aug 1, 2023
7 of 13 checks passed
@arthur791004 arthur791004 deleted the feat/assembler-shuffle-patterns branch August 1, 2023 09:17
@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 Aug 1, 2023
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.

3 participants