Threads.js (1110B)
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 import React, { Component } from "devtools/client/shared/vendor/react"; 6 import { div } from "devtools/client/shared/vendor/react-dom-factories"; 7 import PropTypes from "devtools/client/shared/vendor/react-prop-types"; 8 import { connect } from "devtools/client/shared/vendor/react-redux"; 9 10 import { getAllThreads } from "../../selectors/index"; 11 import Thread from "./Thread"; 12 13 export class Threads extends Component { 14 static get propTypes() { 15 return { 16 threads: PropTypes.array.isRequired, 17 }; 18 } 19 20 render() { 21 const { threads } = this.props; 22 return div( 23 { 24 className: "pane threads-list", 25 }, 26 threads.map(thread => 27 React.createElement(Thread, { 28 thread, 29 key: thread.actor, 30 }) 31 ) 32 ); 33 } 34 } 35 36 const mapStateToProps = state => ({ 37 threads: getAllThreads(state), 38 }); 39 40 export default connect(mapStateToProps)(Threads);