2020-09-28 05:26:23 +00:00
|
|
|
import _ from 'lodash';
|
2019-10-02 02:16:16 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
import createMovieSelector from 'Store/Selectors/createMovieSelector';
|
2020-02-26 04:18:49 +00:00
|
|
|
import MovieFileStatus from './MovieFileStatus';
|
2019-10-02 02:16:16 +00:00
|
|
|
|
|
|
|
function createMapStateToProps() {
|
|
|
|
return createSelector(
|
|
|
|
createMovieSelector(),
|
2020-07-25 21:59:03 +00:00
|
|
|
(movie) => {
|
2020-09-28 05:26:23 +00:00
|
|
|
const result = _.pick(movie, [
|
|
|
|
'inCinemas',
|
|
|
|
'isAvailable',
|
|
|
|
'monitored',
|
|
|
|
'grabbed'
|
|
|
|
]);
|
|
|
|
|
|
|
|
result.movieFile = movie.movieFile;
|
|
|
|
|
|
|
|
return result;
|
2019-10-02 02:16:16 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
};
|
|
|
|
|
2020-02-26 04:18:49 +00:00
|
|
|
class MovieFileStatusConnector extends Component {
|
2019-10-02 02:16:16 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2020-02-26 04:18:49 +00:00
|
|
|
<MovieFileStatus
|
2019-10-02 02:16:16 +00:00
|
|
|
{...this.props}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-26 04:18:49 +00:00
|
|
|
MovieFileStatusConnector.propTypes = {
|
2020-07-25 21:59:03 +00:00
|
|
|
movieId: PropTypes.number.isRequired,
|
|
|
|
queueStatus: PropTypes.string,
|
|
|
|
queueState: PropTypes.string
|
2019-10-02 02:16:16 +00:00
|
|
|
};
|
|
|
|
|
2020-02-26 04:18:49 +00:00
|
|
|
export default connect(createMapStateToProps, mapDispatchToProps)(MovieFileStatusConnector);
|