mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
Initial Commit Rework
This commit is contained in:
parent
74a4cc048c
commit
95051cbd63
2483 changed files with 101351 additions and 111396 deletions
|
@ -0,0 +1,73 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { addRecentFolder } from 'Store/Actions/interactiveImportActions';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import * as commandNames from 'Commands/commandNames';
|
||||
import InteractiveImportSelectFolderModalContent from './InteractiveImportSelectFolderModalContent';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.interactiveImport.recentFolders,
|
||||
(recentFolders) => {
|
||||
return {
|
||||
recentFolders
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
addRecentFolder,
|
||||
executeCommand
|
||||
};
|
||||
|
||||
class InteractiveImportSelectFolderModalContentConnector extends Component {
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onQuickImportPress = (folder) => {
|
||||
this.props.addRecentFolder({ folder });
|
||||
|
||||
this.props.executeCommand({
|
||||
name: commandNames.DOWNLOADED_EPSIODES_SCAN,
|
||||
path: folder
|
||||
});
|
||||
|
||||
this.props.onModalClose();
|
||||
}
|
||||
|
||||
onInteractiveImportPress = (folder) => {
|
||||
this.props.addRecentFolder({ folder });
|
||||
this.props.onFolderSelect(folder);
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
if (this.path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<InteractiveImportSelectFolderModalContent
|
||||
{...this.props}
|
||||
onQuickImportPress={this.onQuickImportPress}
|
||||
onInteractiveImportPress={this.onInteractiveImportPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
InteractiveImportSelectFolderModalContentConnector.propTypes = {
|
||||
path: PropTypes.string,
|
||||
onFolderSelect: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
addRecentFolder: PropTypes.func.isRequired,
|
||||
executeCommand: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(InteractiveImportSelectFolderModalContentConnector);
|
Loading…
Add table
Add a link
Reference in a new issue