Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b7cc241
Add PrePublish panel option to the general menu tools section
oandregal Sep 7, 2018
e3f0c24
Add data API
oandregal Sep 7, 2018
85edadc
Rename PublishPanel to PrePublishPanel
oandregal Sep 7, 2018
0488595
Implement core/edit-post actions and selector
oandregal Sep 10, 2018
14ea423
Rename pre-publish-panel-toggle to publish-sidebar-toggle
oandregal Sep 10, 2018
f4c237e
Connect the dots: publish toggles publish sidebar or publish directly
oandregal Sep 10, 2018
1a00c13
Update test for isPublishSidebarEnable preference
oandregal Sep 11, 2018
c659529
Expose dismissing option as a checkbox in the sidebar
oandregal Sep 11, 2018
e888220
Move publish sidebar logic to core/editor store
oandregal Sep 11, 2018
b3e9fa8
docs: tweak comment on isPublishSidebarEnabled
tofumatt Sep 11, 2018
f78a332
Use arrow function instead of traditional function
oandregal Sep 11, 2018
3e2877f
Fix linting issue that went undetected by eslint
oandregal Sep 11, 2018
dbd6090
Use english apostrophe, not single commas
oandregal Sep 11, 2018
ea5dc6a
Make enable/disable actions more obvious
oandregal Sep 11, 2018
afae18d
Inline PostPublish button / toggle logic
oandregal Sep 11, 2018
2f45e20
Add padding to align and give it space
oandregal Sep 11, 2018
7bfc2a5
Align to bottom
oandregal Sep 11, 2018
c65ea7c
Update wording
oandregal Sep 11, 2018
18036e2
Update copy
oandregal Sep 12, 2018
c37b6a8
Tweak microcopy for pre-publish checks.
sarahmonster Sep 12, 2018
d1c69c5
Remove outdated docs
oandregal Sep 13, 2018
1be0b54
Preventive measure
oandregal Sep 14, 2018
79ced01
Fix and add tests
oandregal Sep 14, 2018
78ebeec
Add e2e test
oandregal Sep 17, 2018
87b372d
Refactor code to avoid duplication
oandregal Sep 17, 2018
acffe70
chore: Tweak styles
tofumatt Sep 18, 2018
37900cc
Disable pre-publish checks after test
oandregal Sep 19, 2018
6637b7e
Add enable/disable functions
oandregal Sep 19, 2018
d7c7151
Use specific selector to target pre-publish checks menu item
oandregal Sep 19, 2018
b50ca1d
Do not make assumptions about previous states
oandregal Sep 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add data API
  • Loading branch information
oandregal committed Sep 17, 2018
commit e3f0c24138b010995767cb619073c47ccf2bb47d
27 changes: 22 additions & 5 deletions edit-post/components/header/publish-panel-toggle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,35 @@
*/
import { __ } from '@wordpress/i18n';
import { MenuItem } from '@wordpress/components';
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';

const PublishPanelToggle = function( { onToggle, isActive } ) {
const PublishPanelToggle = function( { onToggle, isEnabled } ) {
return (
<MenuItem
icon={ isActive && 'yes' }
isSelected={ isActive }
icon={ isEnabled && 'yes' }
isSelected={ isEnabled }
role="menuitemcheckbox"
onClick={ onToggle }
>
{ __( 'PrePublish Panel' ) }
</MenuItem>
);
}
};

export default PublishPanelToggle;
export default compose( [
withSelect( ( select ) => ( {
isEnabled: select( 'core/nux' ).isPrePublishPanelEnabled(),
} ) ),
withDispatch( ( dispatch, ownProps ) => ( {
onToggle() {
const { disablePrePublishPanel, enablePrePublishPanel } = dispatch( 'core/nux' );
if ( ownProps.isActive ) {
disablePrePublishPanel();
} else {
enablePrePublishPanel();
}
ownProps.onToggle();
},
} ) ),
] )( PublishPanelToggle );