2017-09-04 02:20:56 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { icons } from 'Helpers/Props';
|
|
|
|
import Icon from 'Components/Icon';
|
|
|
|
import MonitorToggleButton from 'Components/MonitorToggleButton';
|
|
|
|
import TableRow from 'Components/Table/TableRow';
|
|
|
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
|
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
|
|
|
import ArtistNameLink from 'Artist/ArtistNameLink';
|
2017-09-12 03:11:32 +00:00
|
|
|
import AlbumStudioAlbum from './AlbumStudioAlbum';
|
|
|
|
import styles from './AlbumStudioRow.css';
|
2017-09-04 02:20:56 +00:00
|
|
|
|
2017-09-12 03:11:32 +00:00
|
|
|
class AlbumStudioRow extends Component {
|
2017-09-04 02:20:56 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Render
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
artistId,
|
|
|
|
status,
|
2017-09-12 03:11:32 +00:00
|
|
|
nameSlug,
|
|
|
|
artistName,
|
2017-09-04 02:20:56 +00:00
|
|
|
monitored,
|
2017-09-12 03:11:32 +00:00
|
|
|
albums,
|
2017-09-04 02:20:56 +00:00
|
|
|
isSaving,
|
|
|
|
isSelected,
|
|
|
|
onSelectedChange,
|
|
|
|
onSeriesMonitoredPress,
|
|
|
|
onSeasonMonitoredPress
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<TableRow>
|
|
|
|
<TableSelectCell
|
|
|
|
id={artistId}
|
|
|
|
isSelected={isSelected}
|
|
|
|
onSelectedChange={onSelectedChange}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<TableRowCell className={styles.status}>
|
|
|
|
<Icon
|
|
|
|
className={styles.statusIcon}
|
|
|
|
name={status === 'ended' ? icons.SERIES_ENDED : icons.SERIES_CONTINUING}
|
|
|
|
title={status === 'ended' ? 'Ended' : 'Continuing'}
|
|
|
|
|
|
|
|
/>
|
|
|
|
</TableRowCell>
|
|
|
|
|
|
|
|
<TableRowCell className={styles.title}>
|
|
|
|
<ArtistNameLink
|
2017-09-12 03:11:32 +00:00
|
|
|
nameSlug={nameSlug}
|
|
|
|
artistName={artistName}
|
2017-09-04 02:20:56 +00:00
|
|
|
/>
|
|
|
|
</TableRowCell>
|
|
|
|
|
|
|
|
<TableRowCell className={styles.monitored}>
|
|
|
|
<MonitorToggleButton
|
|
|
|
monitored={monitored}
|
|
|
|
isSaving={isSaving}
|
|
|
|
onPress={onSeriesMonitoredPress}
|
|
|
|
/>
|
|
|
|
</TableRowCell>
|
|
|
|
|
|
|
|
<TableRowCell className={styles.seasons}>
|
|
|
|
{
|
2017-09-12 03:11:32 +00:00
|
|
|
albums.map((season) => {
|
2017-09-04 02:20:56 +00:00
|
|
|
return (
|
2017-09-12 03:11:32 +00:00
|
|
|
<AlbumStudioAlbum
|
|
|
|
key={season.id}
|
2017-09-04 02:20:56 +00:00
|
|
|
{...season}
|
|
|
|
onSeasonMonitoredPress={onSeasonMonitoredPress}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</TableRowCell>
|
|
|
|
</TableRow>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-12 03:11:32 +00:00
|
|
|
AlbumStudioRow.propTypes = {
|
2017-09-04 02:20:56 +00:00
|
|
|
artistId: PropTypes.number.isRequired,
|
|
|
|
status: PropTypes.string.isRequired,
|
2017-09-12 03:11:32 +00:00
|
|
|
nameSlug: PropTypes.string.isRequired,
|
|
|
|
artistName: PropTypes.string.isRequired,
|
2017-09-04 02:20:56 +00:00
|
|
|
monitored: PropTypes.bool.isRequired,
|
2017-09-12 03:11:32 +00:00
|
|
|
albums: PropTypes.arrayOf(PropTypes.object).isRequired,
|
2017-09-04 02:20:56 +00:00
|
|
|
isSaving: PropTypes.bool.isRequired,
|
|
|
|
isSelected: PropTypes.bool,
|
|
|
|
onSelectedChange: PropTypes.func.isRequired,
|
|
|
|
onSeriesMonitoredPress: PropTypes.func.isRequired,
|
|
|
|
onSeasonMonitoredPress: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
2017-09-12 03:11:32 +00:00
|
|
|
AlbumStudioRow.defaultProps = {
|
2017-09-04 02:20:56 +00:00
|
|
|
isSaving: false
|
|
|
|
};
|
|
|
|
|
2017-09-12 03:11:32 +00:00
|
|
|
export default AlbumStudioRow;
|