UNPKG

nexshop-web-contents

Version:

Nexshop Web Contents Project

70 lines (62 loc) 2.78 kB
import React, {Component} from 'react'; import {connect} from "react-redux"; import PropTypes from 'prop-types'; import {bindActionCreators} from "redux"; import {previewActions, playlistActions} from "nexshop-web-store"; import PlaylistEditorView from "./playlist-editor-view"; class PlaylistEditor extends Component { constructor(props) { super(props); this.onSelectPreviewItem = this.onSelectPreviewItem.bind(this); } onSelectPreviewItem(index) { this.props.moveToPreview(index); } render() { return ( <PlaylistEditorView resolution={this.props.resolution} contentItems={this.props.contentItems} blankIndex={this.props.blankIndex} onDropDragContentsItem={this.props.actions.dropDragContentsItem} onDeleteItem={this.props.actions.deleteContentItem} onOrderChangeStart={this.props.actions.changeContentItemsOrderStart} onOrderChangeProcess={this.props.actions.changeContentItemsOrderProcess} onOrderChangeEnd={this.props.actions.changeContentItemsOrderEnd} onSelectPreviewItem={this.onSelectPreviewItem} onUpdateContentItemTransition={this.props.actions.updateContentItemTransition} onUpdateContentItemDuration={this.props.actions.updateContentItemDuration} onUpdateContentItemFitMode={this.props.actions.updateContentItemFitMode} /> ); } } const mapStateToProps = (state) => { let {playlist: {resolution, contentItems, blankIndex}} = state; return {resolution, contentItems, blankIndex}; }; const mapDispatchToProps = (dispatch) => { const {selectPreviewItem} = previewActions; const { changeContentItemsOrderEnd, changeContentItemsOrderProcess, changeContentItemsOrderStart, deleteContentItem, dropDragContentsItem, updateContentItemDuration, updateContentItemTransition, updateContentItemFitMode, } = playlistActions; return { actions: bindActionCreators({ dropDragContentsItem, deleteContentItem, changeContentItemsOrderStart, changeContentItemsOrderProcess, changeContentItemsOrderEnd, selectPreviewItem, updateContentItemTransition, updateContentItemDuration, updateContentItemFitMode }, dispatch) } }; export default connect(mapStateToProps, mapDispatchToProps)(PlaylistEditor); PlaylistEditor.propTypes = { moveToPreview: PropTypes.func.isRequired };