| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { 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 { apiUrl, metaMode, syncUrl, weightableFields, weightingConfiguration } from './config'; |
| 12 |
import { WeightingSettingsProvider } from './provider'; |
| 13 |
import Weighting from './apps/weighting'; |
| 14 |
|
| 15 |
/** |
| 16 |
* Styles. |
| 17 |
*/ |
| 18 |
import './style.css'; |
| 19 |
|
| 20 |
/** |
| 21 |
* App component. |
| 22 |
* |
| 23 |
* @returns {WPElement} App component. |
| 24 |
*/ |
| 25 |
const App = () => ( |
| 26 |
<SettingsScreenProvider title={__('Manage Search Fields & Weighting', 'elasticpress')}> |
| 27 |
<WeightingSettingsProvider |
| 28 |
apiUrl={apiUrl} |
| 29 |
metaMode={metaMode} |
| 30 |
syncUrl={syncUrl} |
| 31 |
weightingConfiguration={weightingConfiguration} |
| 32 |
weightableFields={weightableFields} |
| 33 |
> |
| 34 |
<Weighting /> |
| 35 |
</WeightingSettingsProvider> |
| 36 |
</SettingsScreenProvider> |
| 37 |
); |
| 38 |
|
| 39 |
if (typeof createRoot === 'function') { |
| 40 |
const root = createRoot(document.getElementById('ep-weighting-screen')); |
| 41 |
|
| 42 |
root.render(<App />); |
| 43 |
} else { |
| 44 |
render(<App />, document.getElementById('ep-weighting-screen')); |
| 45 |
} |
| 46 |
|