mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Renames in Frontend
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import TextTruncate from 'react-text-truncate';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||
import CheckInput from 'Components/Form/CheckInput';
|
||||
import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import ModalBody from 'Components/Modal/ModalBody';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import BookCover from 'Book/BookCover';
|
||||
import AddAuthorOptionsForm from '../Common/AddAuthorOptionsForm.js';
|
||||
import styles from './AddNewBookModalContent.css';
|
||||
|
||||
class AddNewBookModalContent extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
searchForNewBook: false
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onSearchForNewBookChange = ({ value }) => {
|
||||
this.setState({ searchForNewBook: value });
|
||||
}
|
||||
|
||||
onAddBookPress = () => {
|
||||
this.props.onAddBookPress(this.state.searchForNewBook);
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
const {
|
||||
bookTitle,
|
||||
authorName,
|
||||
disambiguation,
|
||||
overview,
|
||||
images,
|
||||
isAdding,
|
||||
isExistingAuthor,
|
||||
isSmallScreen,
|
||||
onModalClose,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
<ModalHeader>
|
||||
Add new Book
|
||||
</ModalHeader>
|
||||
|
||||
<ModalBody>
|
||||
<div className={styles.container}>
|
||||
{
|
||||
isSmallScreen ?
|
||||
null:
|
||||
<div className={styles.poster}>
|
||||
<BookCover
|
||||
className={styles.poster}
|
||||
images={images}
|
||||
size={250}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div className={styles.info}>
|
||||
<div className={styles.name}>
|
||||
{bookTitle}
|
||||
</div>
|
||||
|
||||
{
|
||||
!!disambiguation &&
|
||||
<span className={styles.disambiguation}>({disambiguation})</span>
|
||||
}
|
||||
|
||||
<div>
|
||||
<span className={styles.authorName}> By: {authorName}</span>
|
||||
</div>
|
||||
|
||||
{
|
||||
overview ?
|
||||
<div className={styles.overview}>
|
||||
<TextTruncate
|
||||
truncateText="…"
|
||||
line={8}
|
||||
text={overview}
|
||||
/>
|
||||
</div> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
!isExistingAuthor &&
|
||||
<AddAuthorOptionsForm
|
||||
authorName={authorName}
|
||||
includeNoneMetadataProfile={true}
|
||||
{...otherProps}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter className={styles.modalFooter}>
|
||||
<label className={styles.searchForNewBookLabelContainer}>
|
||||
<span className={styles.searchForNewBookLabel}>
|
||||
Start search for new book
|
||||
</span>
|
||||
|
||||
<CheckInput
|
||||
containerClassName={styles.searchForNewBookContainer}
|
||||
className={styles.searchForNewBookInput}
|
||||
name="searchForNewBook"
|
||||
value={this.state.searchForNewBook}
|
||||
onChange={this.onSearchForNewBookChange}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<SpinnerButton
|
||||
className={styles.addButton}
|
||||
kind={kinds.SUCCESS}
|
||||
isSpinning={isAdding}
|
||||
onPress={this.onAddBookPress}
|
||||
>
|
||||
Add {bookTitle}
|
||||
</SpinnerButton>
|
||||
</ModalFooter>
|
||||
</ModalContent>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AddNewBookModalContent.propTypes = {
|
||||
bookTitle: PropTypes.string.isRequired,
|
||||
authorName: PropTypes.string.isRequired,
|
||||
disambiguation: PropTypes.string.isRequired,
|
||||
overview: PropTypes.string,
|
||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
isAdding: PropTypes.bool.isRequired,
|
||||
addError: PropTypes.object,
|
||||
isExistingAuthor: PropTypes.bool.isRequired,
|
||||
isSmallScreen: PropTypes.bool.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
onAddBookPress: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default AddNewBookModalContent;
|
||||
Reference in New Issue
Block a user