-
Notifications
You must be signed in to change notification settings - Fork 2k
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: Add themes detail page #3053
Conversation
Possible that you didn't add |
BTW, I just added a |
Feature flag it? |
|
||
console.log( 'running ze details controller' ); | ||
|
||
if ( true ) { // bail if we're logged out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this to if ( user )
gets rid of the replacement error
c5e3345
to
b619f61
Compare
How are you doing this? Back button? Address bar? Both fine for me. |
Direct hit on |
4376aa5
to
5c5b59d
Compare
.filter( r => r.match !== null ); | ||
|
||
|
||
if ( matchedRoutes.length ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is our own mini-router. We need to do this before the layout is rendered.
625d8d0
to
868de4e
Compare
In the spirit of @mcsf's routing PR, I extracted the |
868de4e
to
0dad4f9
Compare
e588710
to
5fbd76f
Compare
I'd love if we combined the theme sheet with the routing from #3207. Rationale -- I'd really like to avoid introducing new special cases that are spread over a couple of files, specifically
I think we'll only need a couple of changes to |
-> #3302 |
5fbd76f
to
797cf2b
Compare
I would rather see this PR merged sooner rather than later, since it is harder to build on top of while it is out on a branch. For example, it makes it hard to see the (pretty small) changes involved in #3279. Removing the ugly hacks later will be the payoff from the routing work. |
*/ | ||
import config from 'config'; | ||
|
||
const memoizedRenderToString = memoize( ReactDomServer.renderToString, element => JSON.stringify( element ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's assume that any data retrieval has to happen outside of the renderToSting
call, because there will always be some async component to it. Does that we are caching a call here that actually does very little, giving us an extra layer of cache alongside the data cache that may not save any time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a data cache at the moment, though. I'd prefer some kind of caching that we could always remove later. Also, themes data isn't hugely variable, so I believe there will be some benefit to caching the markup — especially if we can share the markup between node instances.
OK, so should I split this into multiple PRs? e.g. |
|
||
const themesRoutes = [ | ||
{ name: 'design', path: new Path( '/design' ) }, | ||
{ name: 'themes', path: new Path( '/themes/:theme_slug' ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature check here maybe?
Ok, looking good now. Ready to merge 👍 |
|
||
.themes__sheet-bar | ||
{ | ||
background-color: #0087be; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$blue-wordpress
instead of hard coded color. :)
(don't forget to squash...) |
- add an isFullScreen option to layouts ( gets rid of side margins ) - unmount sidebar for sheet view - set no masterbar border for fullscreen mode
- implement a pre-layout router, that will be gone as soon as we have an isomorphic, single render tree layout solution. which is soon! - factor out renderToString into render module - use memoize, resolve by JSON.stringify( element ), use LruMap to make sure cache isn't unbounded
77ba955
to
1f05fee
Compare
props = { routeName: matchedRoutes[0].name, match: matchedRoutes[0].match }; | ||
Layout = require( 'layout/logged-out-design' ); | ||
} | ||
} else if ( startsWith( '/design', window.location.pathname ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the wrong arg order? cf L188 and https://lodash.com/docs#startsWith
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, yes. Why does it work?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cause this is only for logged-out, where we don't care for single sites. Then again, we should check if it breaks tiers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #3374 to fix this.
Implements part of #2875 & #2876
This PR deals with setting up a
/themes/[x]
route, which will eventually contain details about the theme. We're only concerned with showing a fake, static title, real data comes later.Notes:
isFullScreen
layout prop introduced, so we can get rid of borders/margins/padding.TODO:
isFullScreen
renderToString
businessTo test:
/design
and click on a theme's menu, and choose detailsCurrent UI state: