mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-08 05:51:47 -07:00
Add options to expand album types by default (#644)
* Add options to expand album types by default * Remove isAfter and simplify slightly * Fix display of settings on large screens
This commit is contained in:
parent
1e48ea58b0
commit
1f483c3a3c
7 changed files with 118 additions and 10 deletions
|
@ -1,7 +1,6 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import isAfter from 'Utilities/Date/isAfter';
|
|
||||||
import getToggledRange from 'Utilities/Table/getToggledRange';
|
import getToggledRange from 'Utilities/Table/getToggledRange';
|
||||||
import { icons, sortDirections } from 'Helpers/Props';
|
import { icons, sortDirections } from 'Helpers/Props';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
|
@ -51,13 +50,16 @@ class ArtistDetailsSeason extends Component {
|
||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
onExpandPress,
|
onExpandPress,
|
||||||
items
|
items,
|
||||||
|
uiSettings
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const expand = _.some(items, (item) => {
|
const expand = _.some(items, (item) =>
|
||||||
return isAfter(item.releaseDate) ||
|
((item.albumType === 'Album') && uiSettings.expandAlbumByDefault) ||
|
||||||
isAfter(item.releaseDate, { days: -365 });
|
((item.albumType === 'Single') && uiSettings.expandSingleByDefault) ||
|
||||||
});
|
((item.albumType === 'EP') && uiSettings.expandEPByDefault) ||
|
||||||
|
((item.albumType === 'Broadcast') && uiSettings.expandBroadcastByDefault) ||
|
||||||
|
((item.albumType === 'Other') && uiSettings.expandOtherByDefault));
|
||||||
|
|
||||||
onExpandPress(name, expand);
|
onExpandPress(name, expand);
|
||||||
}
|
}
|
||||||
|
@ -199,7 +201,7 @@ class ArtistDetailsSeason extends Component {
|
||||||
</Table> :
|
</Table> :
|
||||||
|
|
||||||
<div className={styles.noAlbums}>
|
<div className={styles.noAlbums}>
|
||||||
No albums in this group
|
No releases in this group
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div className={styles.collapseButtonContainer}>
|
<div className={styles.collapseButtonContainer}>
|
||||||
|
@ -243,7 +245,8 @@ ArtistDetailsSeason.propTypes = {
|
||||||
onTableOptionChange: PropTypes.func.isRequired,
|
onTableOptionChange: PropTypes.func.isRequired,
|
||||||
onExpandPress: PropTypes.func.isRequired,
|
onExpandPress: PropTypes.func.isRequired,
|
||||||
onSortPress: PropTypes.func.isRequired,
|
onSortPress: PropTypes.func.isRequired,
|
||||||
onMonitorAlbumPress: PropTypes.func.isRequired
|
onMonitorAlbumPress: PropTypes.func.isRequired,
|
||||||
|
uiSettings: PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ArtistDetailsSeason;
|
export default ArtistDetailsSeason;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
import createArtistSelector from 'Store/Selectors/createArtistSelector';
|
||||||
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
||||||
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
import { toggleAlbumsMonitored, setAlbumsTableOption, setAlbumsSort } from 'Store/Actions/albumActions';
|
import { toggleAlbumsMonitored, setAlbumsTableOption, setAlbumsSort } from 'Store/Actions/albumActions';
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import ArtistDetailsSeason from './ArtistDetailsSeason';
|
import ArtistDetailsSeason from './ArtistDetailsSeason';
|
||||||
|
@ -19,7 +20,8 @@ function createMapStateToProps() {
|
||||||
createArtistSelector(),
|
createArtistSelector(),
|
||||||
createCommandsSelector(),
|
createCommandsSelector(),
|
||||||
createDimensionsSelector(),
|
createDimensionsSelector(),
|
||||||
(label, albums, artist, commands, dimensions) => {
|
createUISettingsSelector(),
|
||||||
|
(label, albums, artist, commands, dimensions, uiSettings) => {
|
||||||
|
|
||||||
const albumsInGroup = _.filter(albums.items, { albumType: label });
|
const albumsInGroup = _.filter(albums.items, { albumType: label });
|
||||||
|
|
||||||
|
@ -37,7 +39,8 @@ function createMapStateToProps() {
|
||||||
sortKey: albums.sortKey,
|
sortKey: albums.sortKey,
|
||||||
sortDirection: albums.sortDirection,
|
sortDirection: albums.sortDirection,
|
||||||
artistMonitored: artist.monitored,
|
artistMonitored: artist.monitored,
|
||||||
isSmallScreen: dimensions.isSmallScreen
|
isSmallScreen: dimensions.isSmallScreen,
|
||||||
|
uiSettings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
3
frontend/src/Settings/UI/UISettings.css
Normal file
3
frontend/src/Settings/UI/UISettings.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.columnGroup {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import Form from 'Components/Form/Form';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import styles from './UISettings.css';
|
||||||
|
|
||||||
export const firstDayOfWeekOptions = [
|
export const firstDayOfWeekOptions = [
|
||||||
{ key: 0, value: 'Sunday' },
|
{ key: 0, value: 'Sunday' },
|
||||||
|
@ -173,6 +174,51 @@ class UISettings extends Component {
|
||||||
{...settings.enableColorImpairedMode}
|
{...settings.enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>Expand Items by Default</FormLabel>
|
||||||
|
<div className={styles.columnGroup}>
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="expandAlbumByDefault"
|
||||||
|
helpText="Albums"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.expandAlbumByDefault}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="expandEPByDefault"
|
||||||
|
helpText="EPs"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.expandEPByDefault}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="expandSingleByDefault"
|
||||||
|
helpText="Singles"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.expandSingleByDefault}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="expandBroadcastByDefault"
|
||||||
|
helpText="Broadcast"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.expandBroadcastByDefault}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="expandOtherByDefault"
|
||||||
|
helpText="Other"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.expandOtherByDefault}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormGroup>
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
</Form>
|
</Form>
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@ namespace Lidarr.Api.V1.Config
|
||||||
public bool ShowRelativeDates { get; set; }
|
public bool ShowRelativeDates { get; set; }
|
||||||
|
|
||||||
public bool EnableColorImpairedMode { get; set; }
|
public bool EnableColorImpairedMode { get; set; }
|
||||||
|
|
||||||
|
public bool ExpandAlbumByDefault { get; set; }
|
||||||
|
public bool ExpandSingleByDefault { get; set; }
|
||||||
|
public bool ExpandEPByDefault { get; set; }
|
||||||
|
public bool ExpandBroadcastByDefault { get; set; }
|
||||||
|
public bool ExpandOtherByDefault { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UiConfigResourceMapper
|
public static class UiConfigResourceMapper
|
||||||
|
@ -33,6 +39,12 @@ namespace Lidarr.Api.V1.Config
|
||||||
ShowRelativeDates = model.ShowRelativeDates,
|
ShowRelativeDates = model.ShowRelativeDates,
|
||||||
|
|
||||||
EnableColorImpairedMode = model.EnableColorImpairedMode,
|
EnableColorImpairedMode = model.EnableColorImpairedMode,
|
||||||
|
|
||||||
|
ExpandAlbumByDefault = model.ExpandAlbumByDefault,
|
||||||
|
ExpandSingleByDefault = model.ExpandSingleByDefault,
|
||||||
|
ExpandEPByDefault = model.ExpandEPByDefault,
|
||||||
|
ExpandBroadcastByDefault = model.ExpandBroadcastByDefault,
|
||||||
|
ExpandOtherByDefault = model.ExpandOtherByDefault
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,6 +314,41 @@ namespace NzbDrone.Core.Configuration
|
||||||
set { SetValue("EnableColorImpairedMode", value); }
|
set { SetValue("EnableColorImpairedMode", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ExpandAlbumByDefault
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("ExpandAlbumByDefault", false); }
|
||||||
|
|
||||||
|
set { SetValue("ExpandAlbumByDefault", value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExpandEPByDefault
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("ExpandEPByDefault", false); }
|
||||||
|
|
||||||
|
set { SetValue("ExpandEPByDefault", value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExpandSingleByDefault
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("ExpandSingleByDefault", false); }
|
||||||
|
|
||||||
|
set { SetValue("ExpandSingleByDefault", value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExpandBroadcastByDefault
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("ExpandBroadcastByDefault", false); }
|
||||||
|
|
||||||
|
set { SetValue("ExpandBroadcastByDefault", value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ExpandOtherByDefault
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("ExpandOtherByDefault", false); }
|
||||||
|
|
||||||
|
set { SetValue("ExpandOtherByDefault", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool CleanupMetadataImages
|
public bool CleanupMetadataImages
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("CleanupMetadataImages", true); }
|
get { return GetValueBoolean("CleanupMetadataImages", true); }
|
||||||
|
|
|
@ -58,6 +58,12 @@ namespace NzbDrone.Core.Configuration
|
||||||
bool ShowRelativeDates { get; set; }
|
bool ShowRelativeDates { get; set; }
|
||||||
bool EnableColorImpairedMode { get; set; }
|
bool EnableColorImpairedMode { get; set; }
|
||||||
|
|
||||||
|
bool ExpandAlbumByDefault { get; set; }
|
||||||
|
bool ExpandSingleByDefault { get; set; }
|
||||||
|
bool ExpandEPByDefault { get; set; }
|
||||||
|
bool ExpandBroadcastByDefault { get; set; }
|
||||||
|
bool ExpandOtherByDefault { get; set; }
|
||||||
|
|
||||||
//Internal
|
//Internal
|
||||||
bool CleanupMetadataImages { get; set; }
|
bool CleanupMetadataImages { get; set; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue