2017-09-04 02:20:56 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { icons } from 'Helpers/Props';
|
|
|
|
import IconButton from 'Components/Link/IconButton';
|
|
|
|
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
|
|
|
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
2018-01-01 06:05:24 +00:00
|
|
|
import AlbumDetailsModal from './AlbumDetailsModal';
|
2018-01-18 02:28:47 +00:00
|
|
|
import EditAlbumModalConnector from './Edit/EditAlbumModalConnector';
|
2018-01-01 06:05:24 +00:00
|
|
|
import styles from './AlbumSearchCell.css';
|
2017-09-04 02:20:56 +00:00
|
|
|
|
2018-01-01 06:05:24 +00:00
|
|
|
class AlbumSearchCell extends Component {
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Lifecycle
|
|
|
|
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
2018-01-18 02:28:47 +00:00
|
|
|
isDetailsModalOpen: false,
|
|
|
|
isEditAlbumModalOpen: false
|
2017-09-04 02:20:56 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
onManualSearchPress = () => {
|
|
|
|
this.setState({ isDetailsModalOpen: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
onDetailsModalClose = () => {
|
|
|
|
this.setState({ isDetailsModalOpen: false });
|
|
|
|
}
|
|
|
|
|
2018-01-18 02:28:47 +00:00
|
|
|
onEditAlbumPress = () => {
|
|
|
|
this.setState({ isEditAlbumModalOpen: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
onEditAlbumModalClose = () => {
|
|
|
|
this.setState({ isEditAlbumModalOpen: false });
|
|
|
|
}
|
|
|
|
|
2017-09-04 02:20:56 +00:00
|
|
|
//
|
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2017-10-07 02:28:30 +00:00
|
|
|
albumId,
|
2017-09-04 02:20:56 +00:00
|
|
|
artistId,
|
2018-01-01 06:05:24 +00:00
|
|
|
albumTitle,
|
2017-09-04 02:20:56 +00:00
|
|
|
isSearching,
|
|
|
|
onSearchPress,
|
|
|
|
...otherProps
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
2018-01-01 06:05:24 +00:00
|
|
|
<TableRowCell className={styles.AlbumSearchCell}>
|
2017-09-04 02:20:56 +00:00
|
|
|
<SpinnerIconButton
|
|
|
|
name={icons.SEARCH}
|
|
|
|
isSpinning={isSearching}
|
|
|
|
onPress={onSearchPress}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<IconButton
|
|
|
|
name={icons.INTERACTIVE}
|
|
|
|
onPress={this.onManualSearchPress}
|
|
|
|
/>
|
|
|
|
|
2018-01-18 02:28:47 +00:00
|
|
|
<IconButton
|
|
|
|
name={icons.EDIT}
|
|
|
|
title="Edit Album"
|
|
|
|
onPress={this.onEditAlbumPress}
|
|
|
|
/>
|
|
|
|
|
2018-01-01 06:05:24 +00:00
|
|
|
<AlbumDetailsModal
|
2017-09-04 02:20:56 +00:00
|
|
|
isOpen={this.state.isDetailsModalOpen}
|
2017-10-07 02:28:30 +00:00
|
|
|
albumId={albumId}
|
2017-09-04 02:20:56 +00:00
|
|
|
artistId={artistId}
|
2018-01-01 06:05:24 +00:00
|
|
|
albumTitle={albumTitle}
|
2017-09-04 02:20:56 +00:00
|
|
|
selectedTab="search"
|
|
|
|
startInteractiveSearch={true}
|
|
|
|
onModalClose={this.onDetailsModalClose}
|
|
|
|
{...otherProps}
|
|
|
|
/>
|
2018-01-18 02:28:47 +00:00
|
|
|
|
|
|
|
<EditAlbumModalConnector
|
|
|
|
isOpen={this.state.isEditAlbumModalOpen}
|
|
|
|
albumId={albumId}
|
|
|
|
artistId={artistId}
|
|
|
|
onModalClose={this.onEditAlbumModalClose}
|
|
|
|
/>
|
2017-09-04 02:20:56 +00:00
|
|
|
</TableRowCell>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-01 06:05:24 +00:00
|
|
|
AlbumSearchCell.propTypes = {
|
2017-10-07 02:28:30 +00:00
|
|
|
albumId: PropTypes.number.isRequired,
|
2017-09-04 02:20:56 +00:00
|
|
|
artistId: PropTypes.number.isRequired,
|
2018-01-01 06:05:24 +00:00
|
|
|
albumTitle: PropTypes.string.isRequired,
|
2017-09-04 02:20:56 +00:00
|
|
|
isSearching: PropTypes.bool.isRequired,
|
|
|
|
onSearchPress: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
2018-01-01 06:05:24 +00:00
|
|
|
export default AlbumSearchCell;
|