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

Themes: Split main into single-site, multi-site,and logged-out #2743

Merged
merged 1 commit into from
Feb 2, 2016

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Jan 25, 2016

my-sites/themes/main.jsx has been overflowing with imports and methods, most of which were used in only one or two out of the single-site, multi-site, and logged-out scenario. Likewise, theme-options had to cater for all of those three cases.

This PR hence breaks main into 3 components corresponding to each of those cases and moves getButtonOptions() to each of them, removing conditionals that would only serve the other cases. Because of fewer imports, methods, and branches in each of those files, I believe they are now more legible. It's however even more important now to factor out re-usable parts that at least two of those components use. Hence, this PR also introduces <ThemePreview>.

Also, logged-out.jsx will hopefully come in handy for SSR.

Fixes #2714

PS:

  • controller.js could obviously still need a makeover after this PR, but since we might end up with a slightly different routing anyway, I'm postponing that.
  • Historically, we introduced themes-selection to bundle themes-list and search for SSR. That might be an obsolete level of abstraction with the new logged-out component (which also has theme preview) that this PR introduces, so in another iteration, we are probably going to remove themes-selection.
  • We also might want to move that lonely lib/themes/helpers.js to my-sites/themes/ (Themes: Move themes/helpers from lib/ to my-sites/ #3055)

@ockham ockham added [Feature Group] Appearance & Themes Features related to the appearance of sites. [Status] In Progress labels Jan 25, 2016
@ockham ockham self-assigned this Jan 25, 2016
@ockham ockham added this to the Themes: Maintenance milestone Jan 25, 2016
@ockham ockham force-pushed the update/themes-split-main-jsx branch 5 times, most recently from 881378a to c66409e Compare January 27, 2016 22:59
@ockham ockham changed the title Update/themes split main jsx Themes: Split main into multi-site and single-site Jan 27, 2016
@ockham ockham force-pushed the update/themes-split-main-jsx branch from c66409e to d42fac6 Compare January 27, 2016 23:18
@ockham ockham added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 29, 2016
@ockham ockham changed the title Themes: Split main into multi-site and single-site Themes: Split main into multi-site,single-site, and logged-out Jan 29, 2016
@ockham ockham changed the title Themes: Split main into multi-site,single-site, and logged-out Themes: Split main into single-site, multi-site,and logged-out Jan 29, 2016
@ockham ockham force-pushed the update/themes-split-main-jsx branch from 9d7a572 to bd43cc1 Compare February 1, 2016 13:42
<Button primary
onClick={ this.onButtonClick }
>{ this.props.buttonLabel }</Button>
</WebPreview>
Copy link
Member

Choose a reason for hiding this comment

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

Please indent me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No component left behind: 7c1ef85

@ockham ockham force-pushed the update/themes-split-main-jsx branch 2 times, most recently from 7a724f4 to c9b34ed Compare February 2, 2016 14:02
@ehg
Copy link
Member

ehg commented Feb 2, 2016

Looks good! Can't see anything obviously wrong with the code, and tests of LO/SS/MS/analytics seem fine. Going through the code, I noticed that the separation of concerns is a boon to readability. 👍

`my-sites/themes/main.jsx` has been overflowing with imports and methods, most
of which were used in only one or two out of the single-site, multi-site, and
logged-out scenario. Likewise, `theme-options` had to cater for all of those
three cases.

This commit hence breaks `main` into 3 components corresponding to each of those
cases and moves `getButtonOptions()` to each of them, removing conditionals that
would only serve the other cases. Because of fewer imports, methods, and
branches in each of those files, they should now be more legible.

To avoid redundancies, this PR also introduces `<ThemePreview>` for use with
each of the three components.
@ockham ockham force-pushed the update/themes-split-main-jsx branch from 38d8ea3 to fe1ba46 Compare February 2, 2016 18:02
ockham added a commit that referenced this pull request Feb 2, 2016
Themes: Split main into single-site, multi-site,and logged-out
@ockham ockham merged commit c79c5e6 into master Feb 2, 2016
@ockham ockham deleted the update/themes-split-main-jsx branch February 2, 2016 18:14
@scruffian scruffian removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Appearance & Themes Features related to the appearance of sites.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants