mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
107 lines
3.0 KiB
JavaScript
107 lines
3.0 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import FieldSet from 'Components/FieldSet';
|
|
import Form from 'Components/Form/Form';
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
import { inputTypes } from 'Helpers/Props';
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
const writeBookTagOptions = [
|
|
{ key: 'sync', value: 'All files; keep in sync with Goodreads' },
|
|
{ key: 'allFiles', value: 'All files; initial import only' },
|
|
{ key: 'newFiles', value: 'For new downloads only' }
|
|
];
|
|
|
|
function MetadataProvider(props) {
|
|
const {
|
|
isFetching,
|
|
error,
|
|
settings,
|
|
hasSettings,
|
|
onInputChange
|
|
} = props;
|
|
|
|
return (
|
|
|
|
<div>
|
|
{
|
|
isFetching &&
|
|
<LoadingIndicator />
|
|
}
|
|
|
|
{
|
|
!isFetching && error &&
|
|
<div>
|
|
{translate('UnableToLoadMetadataProviderSettings')}
|
|
</div>
|
|
}
|
|
|
|
{
|
|
hasSettings && !isFetching && !error &&
|
|
<Form>
|
|
<FieldSet legend={translate('CalibreMetadata')}>
|
|
<FormGroup>
|
|
<FormLabel>
|
|
{translate('SendMetadataToCalibre')}
|
|
</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.SELECT}
|
|
name="writeBookTags"
|
|
helpTextWarning={translate('WriteBookTagsHelpTextWarning')}
|
|
helpLink="https://wiki.servarr.com/Readarr_Settings#Write_Metadata_to_Book_Files"
|
|
values={writeBookTagOptions}
|
|
onChange={onInputChange}
|
|
{...settings.writeBookTags}
|
|
/>
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
<FormLabel>
|
|
{translate('UpdateCovers')}
|
|
</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.CHECK}
|
|
name="updateCovers"
|
|
helpText={translate('UpdateCoversHelpText')}
|
|
onChange={onInputChange}
|
|
{...settings.updateCovers}
|
|
/>
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
<FormLabel>
|
|
{translate('EmbedMetadataInBookFiles')}
|
|
</FormLabel>
|
|
|
|
<FormInputGroup
|
|
type={inputTypes.CHECK}
|
|
name="embedMetadata"
|
|
helpText={translate('EmbedMetadataHelpText')}
|
|
onChange={onInputChange}
|
|
{...settings.embedMetadata}
|
|
/>
|
|
</FormGroup>
|
|
|
|
</FieldSet>
|
|
</Form>
|
|
}
|
|
</div>
|
|
|
|
);
|
|
}
|
|
|
|
MetadataProvider.propTypes = {
|
|
isFetching: PropTypes.bool.isRequired,
|
|
error: PropTypes.object,
|
|
settings: PropTypes.object.isRequired,
|
|
hasSettings: PropTypes.bool.isRequired,
|
|
onInputChange: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default MetadataProvider;
|