| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { createInterpolateElement, createRoot, render, WPElement } from '@wordpress/element'; |
| 5 |
import { __ } from '@wordpress/i18n'; |
| 6 |
|
| 7 |
/** |
| 8 |
* Internal dependencies. |
| 9 |
*/ |
| 10 |
import { SettingsScreenProvider } from '../settings-screen'; |
| 11 |
import { |
| 12 |
apiUrl, |
| 13 |
epioLogoUrl, |
| 14 |
features, |
| 15 |
indexMeta, |
| 16 |
settings, |
| 17 |
settingsDraft, |
| 18 |
syncUrl, |
| 19 |
} from './config'; |
| 20 |
import { FeatureSettingsProvider } from './provider'; |
| 21 |
import Features from './apps/features'; |
| 22 |
|
| 23 |
/** |
| 24 |
* Styles. |
| 25 |
*/ |
| 26 |
import './style.css'; |
| 27 |
|
| 28 |
/** |
| 29 |
* App component. |
| 30 |
* |
| 31 |
* @returns {WPElement} App component. |
| 32 |
*/ |
| 33 |
const App = () => ( |
| 34 |
<SettingsScreenProvider title={__('Features', 'elasticpress')}> |
| 35 |
<FeatureSettingsProvider |
| 36 |
apiUrl={apiUrl} |
| 37 |
defaultSettings={settingsDraft || settings} |
| 38 |
epioLogoUrl={epioLogoUrl} |
| 39 |
features={features} |
| 40 |
indexMeta={indexMeta} |
| 41 |
syncedSettings={settings} |
| 42 |
syncUrl={syncUrl} |
| 43 |
> |
| 44 |
<p> |
| 45 |
{createInterpolateElement( |
| 46 |
__( |
| 47 |
'ElasticPress Features add functionality to enhance search and queries on your site. You may choose to activate some or all of these Features depending on your needs. You can learn more about each Feature <a>here</a>.', |
| 48 |
'elasticpress', |
| 49 |
), |
| 50 |
{ |
| 51 |
a: ( |
| 52 |
// eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/control-has-associated-label |
| 53 |
<a |
| 54 |
target="_blank" |
| 55 |
href="https://elasticpress.zendesk.com/hc/en-us/articles/16671825423501-Features" |
| 56 |
rel="noreferrer" |
| 57 |
/> |
| 58 |
), |
| 59 |
}, |
| 60 |
)} |
| 61 |
</p> |
| 62 |
<Features /> |
| 63 |
</FeatureSettingsProvider> |
| 64 |
</SettingsScreenProvider> |
| 65 |
); |
| 66 |
|
| 67 |
if (typeof createRoot === 'function') { |
| 68 |
const root = createRoot(document.getElementById('ep-dashboard')); |
| 69 |
|
| 70 |
root.render(<App />); |
| 71 |
} else { |
| 72 |
render(<App />, document.getElementById('ep-dashboard')); |
| 73 |
} |
| 74 |
|