-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' of github.com:woocommerce/woocommerce into e2e/f…
…ix-command-pallete-with-gb-tests
- Loading branch information
Showing
27 changed files
with
559 additions
and
139 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/js/product-editor/changelog/add-43707_show_prepublish_checks_section
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Add Always show pre-publish checks checkbox #44595 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...js/product-editor/src/components/prepublish-panel/show-prepublish-checks-section/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './show-prepublish-checks-section'; |
39 changes: 39 additions & 0 deletions
39
...onents/prepublish-panel/show-prepublish-checks-section/show-prepublish-checks-section.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { createElement } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { recordEvent } from '@woocommerce/tracks'; | ||
import { CheckboxControl } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { TRACKS_SOURCE } from '../../../constants'; | ||
import { useShowPrepublishChecks } from '../../../hooks/use-show-prepublish-checks'; | ||
|
||
export function ShowPrepublishChecksSection() { | ||
const { isResolving, showPrepublishChecks, togglePrepublishChecks } = | ||
useShowPrepublishChecks(); | ||
|
||
if ( isResolving ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="woocommerce-publish-panel-show-checks"> | ||
<CheckboxControl | ||
label={ __( 'Always show pre-publish checks.', 'woocommerce' ) } | ||
checked={ showPrepublishChecks } | ||
onChange={ ( selected: boolean ) => { | ||
togglePrepublishChecks(); | ||
recordEvent( 'product_prepublish_panel', { | ||
source: TRACKS_SOURCE, | ||
action: 'toggle_prepublish_checks', | ||
value: selected, | ||
} ); | ||
} } | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/js/product-editor/src/hooks/use-show-prepublish-checks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { useSelect, useDispatch } from '@wordpress/data'; | ||
import { OPTIONS_STORE_NAME } from '@woocommerce/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { SHOW_PREPUBLISH_CHECKS_ENABLED_OPTION_NAME } from '../constants'; | ||
|
||
export function useShowPrepublishChecks() { | ||
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME ); | ||
|
||
const { isResolving, showPrepublishChecks } = useSelect( ( select ) => { | ||
const { getOption, hasFinishedResolution } = | ||
select( OPTIONS_STORE_NAME ); | ||
|
||
const showPrepublishChecksOption = | ||
getOption( SHOW_PREPUBLISH_CHECKS_ENABLED_OPTION_NAME ) || 'yes'; | ||
|
||
const resolving = ! hasFinishedResolution( 'getOption', [ | ||
SHOW_PREPUBLISH_CHECKS_ENABLED_OPTION_NAME, | ||
] ); | ||
|
||
return { | ||
isResolving: resolving, | ||
showPrepublishChecks: showPrepublishChecksOption === 'yes', | ||
}; | ||
}, [] ); | ||
|
||
const togglePrepublishChecks = () => { | ||
updateOptions( { | ||
[ SHOW_PREPUBLISH_CHECKS_ENABLED_OPTION_NAME ]: showPrepublishChecks | ||
? 'no' | ||
: 'yes', | ||
} ); | ||
}; | ||
|
||
return { | ||
isResolving, | ||
showPrepublishChecks, | ||
togglePrepublishChecks, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.