diff --git a/frontend/src/Movie/MovieCollection.js b/frontend/src/Movie/MovieCollection.js index a42b2b421..09a8eea73 100644 --- a/frontend/src/Movie/MovieCollection.js +++ b/frontend/src/Movie/MovieCollection.js @@ -1,30 +1,65 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { Component } from 'react'; import MonitorToggleButton from 'Components/MonitorToggleButton'; +import EditNetImportModalConnector from 'Settings/NetImport/NetImport/EditNetImportModalConnector'; import styles from './MovieCollection.css'; -function MovieCollection(props) { - const { - name, - collectionList, - isSaving, - onMonitorTogglePress - } = props; +class MovieCollection extends Component { - const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; + // + // Lifecycle - return ( -
- - {name} -
- ); + constructor(props, context) { + super(props, context); + + this.state = { + hasPosterError: false, + isEditNetImportModalOpen: false + }; + } + + onAddNetImportPress = (monitored) => { + if (this.props.collectionList) { + this.props.onMonitorTogglePress(monitored); + } else { + this.props.onMonitorTogglePress(monitored); + this.setState({ isEditNetImportModalOpen: true }); + } + } + + onEditNetImportModalClose = () => { + this.setState({ isEditNetImportModalOpen: false }); + } + + render() { + const { + name, + collectionList, + isSaving + } = this.props; + + const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; + const netImportId = collectionList ? collectionList.id : 0; + + return ( +
+ + {name} + +
+ ); + } } MovieCollection.propTypes = { diff --git a/frontend/src/Movie/MovieCollectionConnector.js b/frontend/src/Movie/MovieCollectionConnector.js index a40654675..43a6718d0 100644 --- a/frontend/src/Movie/MovieCollectionConnector.js +++ b/frontend/src/Movie/MovieCollectionConnector.js @@ -16,7 +16,6 @@ function createMapStateToProps() { const { monitored, qualityProfileId, - path, minimumAvailability } = movie; @@ -24,7 +23,6 @@ function createMapStateToProps() { collectionList, monitored, qualityProfileId, - path, minimumAvailability, isSaving: netImports.isSaving }; @@ -55,11 +53,9 @@ class MovieCollectionConnector extends Component { this.props.setNetImportValue({ name: 'enabled', value: true }); this.props.setNetImportValue({ name: 'enableAuto', value: true }); this.props.setNetImportValue({ name: 'name', value: `${this.props.name} - ${this.props.tmdbId}` }); - this.props.setNetImportValue({ name: 'rootFolderPath', value: this.props.path }); this.props.setNetImportValue({ name: 'qualityProfileId', value: this.props.qualityProfileId }); this.props.setNetImportValue({ name: 'monitored', value: this.props.monitored }); this.props.setNetImportValue({ name: 'minimumAvailability', value: this.props.minimumAvailability }); - this.props.saveNetImport(); } } @@ -83,7 +79,6 @@ MovieCollectionConnector.propTypes = { collectionList: PropTypes.object, monitored: PropTypes.bool.isRequired, qualityProfileId: PropTypes.number.isRequired, - path: PropTypes.string.isRequired, minimumAvailability: PropTypes.string.isRequired, isSaving: PropTypes.bool.isRequired, selectNetImportSchema: PropTypes.func.isRequired,