PluginProbe
ElasticPress / 5.0.1
ElasticPress v5.0.1
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / features / components / feature.js

feature.js in ElasticPress 5.0.1, at assets/js/features/components/feature.js

58 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { Notice } from '@wordpress/components';
5 import { safeHTML } from '@wordpress/dom';
6 import { RawHTML, WPElement } from '@wordpress/element';
7 import { __ } from '@wordpress/i18n';
8
9 /**
10 * Internal dependencies.
11 */
12 import { useFeatureSettings } from '../provider';
13 import Settings from './settings';
14
15 /**
16 * Reports component.
17 *
18 * @param {object} props Component props.
19 * @param {WPElement} props.feature Feature slug.
20 * @returns {WPElement} Reports component.
21 */
22 export default ({ feature }) => {
23 const { epioLogoUrl, getFeature } = useFeatureSettings();
24
25 const { isPoweredByEpio, reqStatusCode, reqStatusMessages, settingsSchema, summary, title } =
26 getFeature(feature);
27
28 return (
29 <>
30 {/* eslint-disable-next-line react/no-danger */}
31 <h3 className="ep-dashboard-heading">
32 <RawHTML>{safeHTML(title)}</RawHTML>
33 {isPoweredByEpio ? (
34 <img
35 alt={__('ElasticPress.io logo')}
36 height="20"
37 src={epioLogoUrl}
38 width="110"
39 />
40 ) : null}
41 </h3>
42 {/* eslint-disable-next-line react/no-danger */}
43 <p dangerouslySetInnerHTML={{ __html: safeHTML(summary) }} />
44 {reqStatusMessages.map((m, i) => (
45 <Notice
46 isDismissible={false}
47 key={i} // eslint-disable-line react/no-array-index-key
48 status={reqStatusCode === 2 ? 'error' : 'warning'}
49 >
50 {/* eslint-disable-next-line react/no-danger */}
51 <span dangerouslySetInnerHTML={{ __html: safeHTML(m) }} />
52 </Notice>
53 ))}
54 <Settings feature={feature} settingsSchema={settingsSchema} />
55 </>
56 );
57 };
58