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

Chrome: Add a Post Publish Panel #4158

Merged
merged 2 commits into from
Jan 5, 2018
Merged

Conversation

youknowriad
Copy link
Contributor

@youknowriad youknowriad commented Dec 25, 2017

This PR updates the Publish Panel and shows some additional information when the Post is published

screen shot 2017-12-25 at 10 45 09

blocked by #4157 and closes #3496 and closes #3279

@youknowriad youknowriad self-assigned this Dec 25, 2017
border-radius: $button-style__radius-roundrect;
margin: 15px 0;
background: $white;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a styling issue here? Looks like there's only two spaces instead of a tab - same as next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, there's a tabs/spaces mix :)

label={ __( 'Close Publish Panel' ) }
/>
</div>

Copy link
Member

Choose a reason for hiding this comment

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

I'd remove this empty line.

<a href={ post.link }>{ post.title || __( '(no title)' ) }</a>{ __( ' is now live.' ) }
</PanelBody>
<PanelBody>
<div><strong>{ __( 'What\'s next?' ) }</strong></div>
Copy link
Member

Choose a reason for hiding this comment

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

Prefer to use "What's next?" in these cases instead of escaping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may have to tweak our ESlint settings to do so.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer as currently proposed 😉

/>
<div className="post-publish-panel__postpublish-buttons">
<Button className="button" href={ post.link }>
{ __( 'View Post' ) }
Copy link
Member

Choose a reason for hiding this comment

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

This label would need to account for "Page" and CPTs.

Copy link
Member

Choose a reason for hiding this comment

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

This label would need to account for "Page" and CPTs.

Specifically, we could use the type.labels.view_item label from /wp/v2/types?context=edit.

display: flex;
align-content: space-between;

> * {
Copy link
Member

Choose a reason for hiding this comment

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

Why need this selector? It generally degrades performance a tiny bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the "ClipboardButton" needs a wrapper, we can't target children buttons using a selector. I can replace it with something like > .components__button, > span, what do you think? I like the genericity of > * though?

*/
import { getCurrentPost } from '../../store/selectors';

class PostPublishPanelPostpublish extends Component {
Copy link
Member

Choose a reason for hiding this comment

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

A bit of inconsistency here between the name of the class and the name of the file. I'm not entirely sure if the correct spelling would be "Postpublish" (file name postpublish.js) or "PostPublish" (file name post-publish.js) but the two should align.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there's no inconsistency. The PostPublishPanel in the classname refers to the foldeer and the Postpublish to the filename. Hard to distringuish between PostPublish and Postpublish though? Maybe we'd want to change the name for the component entirely?

} );

clearTimeout( this.dismissCopyConfirmation );
this.dismissCopyConfirmation = setTimeout( () => {
Copy link
Member

Choose a reason for hiding this comment

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

There's no issue here, but this pattern is so easy to get wrong, makes me wonder if we ought to explore a higher-order component like https://www.npmjs.com/package/@hocs/safe-timers or our own.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mmm! sounds like a good idea to me.

type="text"
readOnly
value={ post.link }
onClick={ this.onSelectInput }
Copy link
Member

Choose a reason for hiding this comment

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

Should this be onFocus for keyboard navigation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point

<div><strong>{ __( 'What\'s next?' ) }</strong></div>
<input
className="post-publish-panel__postpublish-link-input"
type="text"
Copy link
Member

Choose a reason for hiding this comment

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

type="text" is default, so this is redundant, unless you think it's wise to be explicit here.

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 strong opinion, just a habit


export default connect(
state => ( {
post: getCurrentPost( state ),
Copy link
Member

Choose a reason for hiding this comment

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

Minor: Do we need the entire post object if we're only using post.link in the component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use the "title" as well.

@jasmussen
Copy link
Contributor

Designwise, love it. @karmatosed and I have been discussing some further improvements to this, like showing a checkmark being animated into being when the publishing is complete, but nothing that should be part of this PR, nor anything incompatible with what you've built here. Nice!

@youknowriad youknowriad force-pushed the update/post-publish-flow branch 2 times, most recently from 0a0cb63 to b076507 Compare January 4, 2018 10:32
@youknowriad
Copy link
Contributor Author

Merging soon if no more concerns here?

@youknowriad youknowriad merged commit 255fe64 into master Jan 5, 2018
@youknowriad youknowriad deleted the update/post-publish-flow branch January 5, 2018 15:17
@afercia
Copy link
Contributor

afercia commented Jan 5, 2018

The URL readonly field misses an associated label element, noted also in #4187

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.

Improve Publishing Flow Only require a single click to update a post
6 participants