* Export initial states for each reducer * combine all gui reducers (excludes scratchPaint and intl) * combine all initial states to create default guiState for preloading in www * expect all of the gui state to be accessible at `state.scratchGui`
48 lines
1.2 KiB
React
48 lines
1.2 KiB
React
import bindAll from 'lodash.bindall';
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import {connect} from 'react-redux';
|
|
import {moveMonitorRect} from '../reducers/monitor-layout';
|
|
|
|
import errorBoundaryHOC from '../lib/error-boundary-hoc.jsx';
|
|
|
|
import MonitorListComponent from '../components/monitor-list/monitor-list.jsx';
|
|
|
|
class MonitorList extends React.Component {
|
|
constructor (props) {
|
|
super(props);
|
|
bindAll(this, [
|
|
'handleMonitorChange'
|
|
]);
|
|
}
|
|
handleMonitorChange (id, x, y) { // eslint-disable-line no-unused-vars
|
|
this.props.moveMonitorRect(id, x, y);
|
|
}
|
|
render () {
|
|
return (
|
|
<MonitorListComponent
|
|
onMonitorChange={this.handleMonitorChange}
|
|
{...this.props}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
MonitorList.propTypes = {
|
|
moveMonitorRect: PropTypes.func.isRequired
|
|
};
|
|
const mapStateToProps = state => ({
|
|
monitors: state.scratchGui.monitors
|
|
});
|
|
const mapDispatchToProps = dispatch => ({
|
|
moveMonitorRect: (id, x, y) => dispatch(moveMonitorRect(id, x, y))
|
|
});
|
|
|
|
export default errorBoundaryHOC('Monitors')(
|
|
connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(MonitorList)
|
|
);
|