IssuePane.js (1611B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 createFactory, 9 PureComponent, 10 } = require("resource://devtools/client/shared/vendor/react.mjs"); 11 const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js"); 12 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs"); 13 14 const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js"); 15 const Localized = createFactory(FluentReact.Localized); 16 17 const Types = require("resource://devtools/client/inspector/compatibility/types.js"); 18 19 const IssueList = createFactory( 20 require("resource://devtools/client/inspector/compatibility/components/IssueList.js") 21 ); 22 23 class IssuePane extends PureComponent { 24 static get propTypes() { 25 return { 26 dispatch: PropTypes.func.isRequired, 27 issues: PropTypes.arrayOf(PropTypes.shape(Types.issue)).isRequired, 28 setSelectedNode: PropTypes.func.isRequired, 29 }; 30 } 31 32 _renderNoIssues() { 33 return Localized( 34 { id: "compatibility-no-issues-found" }, 35 dom.p( 36 { className: "devtools-sidepanel-no-result" }, 37 "compatibility-no-issues-found" 38 ) 39 ); 40 } 41 42 render() { 43 const { dispatch, issues, setSelectedNode } = this.props; 44 45 return issues.length 46 ? IssueList({ 47 dispatch, 48 issues, 49 setSelectedNode, 50 }) 51 : this._renderNoIssues(); 52 } 53 } 54 55 module.exports = IssuePane;