You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
4.0 KiB
149 lines
4.0 KiB
import PropTypes from 'prop-types';
|
|
import React, { Component } from 'react';
|
|
import TextTruncate from 'react-text-truncate';
|
|
import ArtistPoster from 'Artist/ArtistPoster';
|
|
import CheckInput from 'Components/Form/CheckInput';
|
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
|
import ModalBody from 'Components/Modal/ModalBody';
|
|
import ModalContent from 'Components/Modal/ModalContent';
|
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
import { kinds } from 'Helpers/Props';
|
|
import AddArtistOptionsForm from '../Common/AddArtistOptionsForm.js';
|
|
import styles from './AddNewArtistModalContent.css';
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
class AddNewArtistModalContent extends Component {
|
|
|
|
//
|
|
// Lifecycle
|
|
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
|
|
this.state = {
|
|
searchForMissingAlbums: false
|
|
};
|
|
}
|
|
|
|
//
|
|
// Listeners
|
|
|
|
onSearchForMissingAlbumsChange = ({ value }) => {
|
|
this.setState({ searchForMissingAlbums: value });
|
|
};
|
|
|
|
onAddArtistPress = () => {
|
|
this.props.onAddArtistPress(this.state.searchForMissingAlbums);
|
|
};
|
|
|
|
//
|
|
// Render
|
|
|
|
render() {
|
|
const {
|
|
artistName,
|
|
disambiguation,
|
|
overview,
|
|
images,
|
|
isAdding,
|
|
isSmallScreen,
|
|
onModalClose,
|
|
...otherProps
|
|
} = this.props;
|
|
|
|
return (
|
|
<ModalContent onModalClose={onModalClose}>
|
|
<ModalHeader>
|
|
{translate('AddNewArtist')}
|
|
</ModalHeader>
|
|
|
|
<ModalBody>
|
|
<div className={styles.container}>
|
|
{
|
|
isSmallScreen ?
|
|
null:
|
|
<div className={styles.poster}>
|
|
<ArtistPoster
|
|
className={styles.poster}
|
|
images={images}
|
|
size={250}
|
|
/>
|
|
</div>
|
|
}
|
|
|
|
<div className={styles.info}>
|
|
<div className={styles.name}>
|
|
{artistName}
|
|
</div>
|
|
|
|
{
|
|
!!disambiguation &&
|
|
<span className={styles.disambiguation}>({disambiguation})</span>
|
|
}
|
|
|
|
{
|
|
overview ?
|
|
<div className={styles.overview}>
|
|
<TextTruncate
|
|
truncateText="…"
|
|
line={8}
|
|
text={overview}
|
|
/>
|
|
</div> :
|
|
null
|
|
}
|
|
|
|
<AddArtistOptionsForm
|
|
includeNoneMetadataProfile={false}
|
|
{...otherProps}
|
|
/>
|
|
|
|
</div>
|
|
</div>
|
|
</ModalBody>
|
|
|
|
<ModalFooter className={styles.modalFooter}>
|
|
<label className={styles.searchForMissingAlbumsLabelContainer}>
|
|
<span className={styles.searchForMissingAlbumsLabel}>
|
|
Start search for missing albums
|
|
</span>
|
|
|
|
<CheckInput
|
|
containerClassName={styles.searchForMissingAlbumsContainer}
|
|
className={styles.searchForMissingAlbumsInput}
|
|
name="searchForMissingAlbums"
|
|
value={this.state.searchForMissingAlbums}
|
|
onChange={this.onSearchForMissingAlbumsChange}
|
|
/>
|
|
</label>
|
|
|
|
<SpinnerButton
|
|
className={styles.addButton}
|
|
kind={kinds.SUCCESS}
|
|
isSpinning={isAdding}
|
|
onPress={this.onAddArtistPress}
|
|
>
|
|
Add {artistName}
|
|
</SpinnerButton>
|
|
</ModalFooter>
|
|
</ModalContent>
|
|
);
|
|
}
|
|
}
|
|
|
|
AddNewArtistModalContent.propTypes = {
|
|
artistName: PropTypes.string.isRequired,
|
|
disambiguation: PropTypes.string.isRequired,
|
|
overview: PropTypes.string,
|
|
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
isAdding: PropTypes.bool.isRequired,
|
|
addError: PropTypes.object,
|
|
isSmallScreen: PropTypes.bool.isRequired,
|
|
isWindows: PropTypes.bool.isRequired,
|
|
onModalClose: PropTypes.func.isRequired,
|
|
onAddArtistPress: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default AddNewArtistModalContent;
|