New: Add/remove individual albums

This commit is contained in:
ta264 2019-12-16 21:21:32 +00:00 committed by Qstick
parent 8da53ae6aa
commit 0bde5fd9e5
128 changed files with 2796 additions and 743 deletions

View file

@ -4,6 +4,7 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import sortByName from 'Utilities/Array/sortByName';
import { metadataProfileNames } from 'Helpers/Props';
import SelectInput from './SelectInput';
function createMapStateToProps() {
@ -11,14 +12,26 @@ function createMapStateToProps() {
(state) => state.settings.metadataProfiles,
(state, { includeNoChange }) => includeNoChange,
(state, { includeMixed }) => includeMixed,
(metadataProfiles, includeNoChange, includeMixed) => {
const values = _.map(metadataProfiles.items.sort(sortByName), (metadataProfile) => {
(state, { includeNone }) => includeNone,
(metadataProfiles, includeNoChange, includeMixed, includeNone) => {
const profiles = metadataProfiles.items.filter((item) => item.name !== metadataProfileNames.NONE);
const noneProfile = metadataProfiles.items.find((item) => item.name === metadataProfileNames.NONE);
const values = _.map(profiles.sort(sortByName), (metadataProfile) => {
return {
key: metadataProfile.id,
value: metadataProfile.name
};
});
if (includeNone) {
values.push({
key: noneProfile.id,
value: noneProfile.name
});
}
if (includeNoChange) {
values.unshift({
key: 'noChange',
@ -88,6 +101,7 @@ MetadataProfileSelectInputConnector.propTypes = {
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
values: PropTypes.arrayOf(PropTypes.object).isRequired,
includeNoChange: PropTypes.bool.isRequired,
includeNone: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired
};