Merge pull request #42 from woocommerce/update/41-add-warning-when-trackig-is-disabled
Add warning when tracking is disabled
This commit is contained in:
commit
d26077b1e9
|
@ -4,17 +4,45 @@
|
|||
import { withDispatch, withSelect } from '@wordpress/data';
|
||||
import { compose } from '@wordpress/compose';
|
||||
import { Button } from '@wordpress/components';
|
||||
|
||||
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { STORE_KEY } from './data/constants';
|
||||
import './data';
|
||||
|
||||
function Experiments( { experiments, toggleExperiment } ) {
|
||||
function Experiments( {
|
||||
experiments,
|
||||
toggleExperiment,
|
||||
isTrackingEnabled,
|
||||
isResolving,
|
||||
} ) {
|
||||
if ( isResolving ) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div id="wc-admin-test-helper-experiments">
|
||||
<h2>Experiments</h2>
|
||||
{ isTrackingEnabled === 'no' && (
|
||||
<p className="tracking-disabled">
|
||||
The following list might not be complete without tracking
|
||||
enabled. <br />
|
||||
Please visit
|
||||
<a
|
||||
target="_blank"
|
||||
href={
|
||||
wcSettings.adminUrl +
|
||||
'/admin.php?page=wc-settings&tab=advanced§ion=woocommerce_com'
|
||||
}
|
||||
rel="noreferrer"
|
||||
>
|
||||
WooCommerce → Settings → Advanced →
|
||||
Woocommerce.com
|
||||
</a>
|
||||
and check{ ' ' }
|
||||
<b>Allow usage of WooCommerce to be tracked</b>.
|
||||
</p>
|
||||
) }
|
||||
<table className="experiments wp-list-table striped table-view-list widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -61,8 +89,12 @@ function Experiments( { experiments, toggleExperiment } ) {
|
|||
export default compose(
|
||||
withSelect( ( select ) => {
|
||||
const { getExperiments } = select( STORE_KEY );
|
||||
const { getOption, isResolving } = select( OPTIONS_STORE_NAME );
|
||||
|
||||
return {
|
||||
experiments: getExperiments(),
|
||||
isTrackingEnabled: getOption( 'woocommerce_allow_tracking' ),
|
||||
isResolving: isResolving( 'getOption', [ 'getExperiments' ] ),
|
||||
};
|
||||
} ),
|
||||
withDispatch( ( dispatch ) => {
|
||||
|
|
|
@ -83,6 +83,13 @@
|
|||
.components-notice {
|
||||
margin: 0px 0px 10px 0px;
|
||||
}
|
||||
.tracking-disabled {
|
||||
border: 1px solid #cc99c2;
|
||||
border-left: 4px solid #cc99c2;
|
||||
line-height: 1.5em;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#wc-admin-test-helper-rest-api-filters {
|
||||
|
|
Loading…
Reference in New Issue