2017-09-17 06:24:15 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { inputTypes } from 'Helpers/Props';
|
|
|
|
import Button from 'Components/Link/Button';
|
|
|
|
import Form from 'Components/Form/Form';
|
|
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
|
|
import ModalContent from 'Components/Modal/ModalContent';
|
|
|
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
|
|
import ModalBody from 'Components/Modal/ModalBody';
|
|
|
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
|
|
|
|
|
|
const bannerSizeOptions = [
|
|
|
|
{ key: 'small', value: 'Small' },
|
|
|
|
{ key: 'medium', value: 'Medium' },
|
|
|
|
{ key: 'large', value: 'Large' }
|
|
|
|
];
|
|
|
|
|
|
|
|
class ArtistIndexBannerOptionsModalContent extends Component {
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lifecycle
|
|
|
|
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
detailedProgressBar: props.detailedProgressBar,
|
|
|
|
size: props.size,
|
|
|
|
showTitle: props.showTitle,
|
2017-12-30 03:23:04 +00:00
|
|
|
showMonitored: props.showMonitored,
|
2018-11-11 04:08:31 +00:00
|
|
|
showQualityProfile: props.showQualityProfile,
|
|
|
|
showSearchAction: props.showSearchAction
|
2017-09-17 06:24:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
const {
|
|
|
|
detailedProgressBar,
|
|
|
|
size,
|
|
|
|
showTitle,
|
2017-12-30 03:23:04 +00:00
|
|
|
showMonitored,
|
2018-11-11 04:08:31 +00:00
|
|
|
showQualityProfile,
|
|
|
|
showSearchAction
|
2017-09-17 06:24:15 +00:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const state = {};
|
|
|
|
|
|
|
|
if (detailedProgressBar !== prevProps.detailedProgressBar) {
|
|
|
|
state.detailedProgressBar = detailedProgressBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size !== prevProps.size) {
|
|
|
|
state.size = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (showTitle !== prevProps.showTitle) {
|
|
|
|
state.showTitle = showTitle;
|
|
|
|
}
|
|
|
|
|
2017-12-30 03:23:04 +00:00
|
|
|
if (showMonitored !== prevProps.showMonitored) {
|
|
|
|
state.showMonitored = showMonitored;
|
|
|
|
}
|
|
|
|
|
2017-09-17 06:24:15 +00:00
|
|
|
if (showQualityProfile !== prevProps.showQualityProfile) {
|
|
|
|
state.showQualityProfile = showQualityProfile;
|
|
|
|
}
|
|
|
|
|
2018-11-11 04:08:31 +00:00
|
|
|
if (showSearchAction !== prevProps.showSearchAction) {
|
|
|
|
state.showSearchAction = showSearchAction;
|
|
|
|
}
|
|
|
|
|
2017-09-17 06:24:15 +00:00
|
|
|
if (!_.isEmpty(state)) {
|
|
|
|
this.setState(state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Listeners
|
|
|
|
|
2017-12-30 03:23:04 +00:00
|
|
|
onChangeBannerOption = ({ name, value }) => {
|
2017-09-17 06:24:15 +00:00
|
|
|
this.setState({
|
|
|
|
[name]: value
|
|
|
|
}, () => {
|
2017-12-30 03:23:04 +00:00
|
|
|
this.props.onChangeBannerOption({ [name]: value });
|
2017-09-17 06:24:15 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
onModalClose
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
detailedProgressBar,
|
|
|
|
size,
|
|
|
|
showTitle,
|
2017-12-30 03:23:04 +00:00
|
|
|
showMonitored,
|
2018-11-11 04:08:31 +00:00
|
|
|
showQualityProfile,
|
|
|
|
showSearchAction
|
2017-09-17 06:24:15 +00:00
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ModalContent onModalClose={onModalClose}>
|
|
|
|
<ModalHeader>
|
2020-06-27 21:51:59 +00:00
|
|
|
Options
|
2017-09-17 06:24:15 +00:00
|
|
|
</ModalHeader>
|
|
|
|
|
|
|
|
<ModalBody>
|
|
|
|
<Form>
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel> Size</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.SELECT}
|
|
|
|
name="size"
|
|
|
|
value={size}
|
|
|
|
values={bannerSizeOptions}
|
2017-12-30 03:23:04 +00:00
|
|
|
onChange={this.onChangeBannerOption}
|
2017-09-17 06:24:15 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Detailed Progress Bar</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="detailedProgressBar"
|
|
|
|
value={detailedProgressBar}
|
|
|
|
helpText="Show text on progess bar"
|
2017-12-30 03:23:04 +00:00
|
|
|
onChange={this.onChangeBannerOption}
|
2017-09-17 06:24:15 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Show Name</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="showTitle"
|
|
|
|
value={showTitle}
|
|
|
|
helpText="Show artist name under banner"
|
2017-12-30 03:23:04 +00:00
|
|
|
onChange={this.onChangeBannerOption}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Show Monitored</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="showMonitored"
|
|
|
|
value={showMonitored}
|
|
|
|
helpText="Show monitored status under banner"
|
|
|
|
onChange={this.onChangeBannerOption}
|
2017-09-17 06:24:15 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Show Quality Profile</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="showQualityProfile"
|
|
|
|
value={showQualityProfile}
|
|
|
|
helpText="Show quality profile under banner"
|
2017-12-30 03:23:04 +00:00
|
|
|
onChange={this.onChangeBannerOption}
|
2017-09-17 06:24:15 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-11-11 04:08:31 +00:00
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
<FormLabel>Show Search</FormLabel>
|
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="showSearchAction"
|
|
|
|
value={showSearchAction}
|
|
|
|
helpText="Show search button on hover"
|
|
|
|
onChange={this.onChangeBannerOption}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2017-09-17 06:24:15 +00:00
|
|
|
</Form>
|
|
|
|
</ModalBody>
|
|
|
|
|
|
|
|
<ModalFooter>
|
|
|
|
<Button
|
|
|
|
onPress={onModalClose}
|
|
|
|
>
|
|
|
|
Close
|
|
|
|
</Button>
|
|
|
|
</ModalFooter>
|
|
|
|
</ModalContent>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ArtistIndexBannerOptionsModalContent.propTypes = {
|
|
|
|
size: PropTypes.string.isRequired,
|
|
|
|
showTitle: PropTypes.bool.isRequired,
|
|
|
|
showQualityProfile: PropTypes.bool.isRequired,
|
|
|
|
detailedProgressBar: PropTypes.bool.isRequired,
|
2018-11-11 04:08:31 +00:00
|
|
|
showSearchAction: PropTypes.bool.isRequired,
|
2017-12-30 03:23:04 +00:00
|
|
|
onChangeBannerOption: PropTypes.func.isRequired,
|
|
|
|
showMonitored: PropTypes.bool.isRequired,
|
2017-09-17 06:24:15 +00:00
|
|
|
onModalClose: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ArtistIndexBannerOptionsModalContent;
|