mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
[UI Work] Artist Detail Page, Album Studio, Wanted, NavSearch, Rename
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { createSelector } from 'reselect';
|
||||
import connectSection from 'Store/connectSection';
|
||||
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||
import createCommandSelector from 'Store/Selectors/createCommandSelector';
|
||||
import { setArtistEditorSort, setArtistEditorFilter, saveArtistEditor } from 'Store/Actions/artistEditorActions';
|
||||
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
|
||||
import * as commandNames from 'Commands/commandNames';
|
||||
import ArtistEditor from './ArtistEditor';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.settings.languageProfiles,
|
||||
createClientSideCollectionSelector(),
|
||||
createCommandSelector(commandNames.RENAME_ARTIST),
|
||||
(languageProfiles, series, isOrganizingArtist) => {
|
||||
return {
|
||||
isOrganizingArtist,
|
||||
showLanguageProfile: languageProfiles.items.length > 1,
|
||||
...series
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
setArtistEditorSort,
|
||||
setArtistEditorFilter,
|
||||
saveArtistEditor,
|
||||
fetchRootFolders
|
||||
};
|
||||
|
||||
class ArtistEditorConnector extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchRootFolders();
|
||||
}
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onSortPress = (sortKey) => {
|
||||
this.props.setArtistEditorSort({ sortKey });
|
||||
}
|
||||
|
||||
onFilterSelect = (filterKey, filterValue, filterType) => {
|
||||
this.props.setArtistEditorFilter({ filterKey, filterValue, filterType });
|
||||
}
|
||||
|
||||
onSaveSelected = (payload) => {
|
||||
this.props.saveArtistEditor(payload);
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ArtistEditor
|
||||
{...this.props}
|
||||
onSortPress={this.onSortPress}
|
||||
onFilterSelect={this.onFilterSelect}
|
||||
onSaveSelected={this.onSaveSelected}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ArtistEditorConnector.propTypes = {
|
||||
setArtistEditorSort: PropTypes.func.isRequired,
|
||||
setArtistEditorFilter: PropTypes.func.isRequired,
|
||||
saveArtistEditor: PropTypes.func.isRequired,
|
||||
fetchRootFolders: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connectSection(
|
||||
createMapStateToProps,
|
||||
mapDispatchToProps,
|
||||
undefined,
|
||||
undefined,
|
||||
{ section: 'series', uiSection: 'artistEditor' }
|
||||
)(ArtistEditorConnector);
|
||||
Reference in New Issue
Block a user