Lidarr/frontend/src/AlbumStudio/AlbumStudioRow.js

102 lines
2.7 KiB
JavaScript
Raw Normal View History

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';
import AlbumStudioAlbum from './AlbumStudioAlbum';
import styles from './AlbumStudioRow.css';
2017-09-04 02:20:56 +00:00
class AlbumStudioRow extends Component {
2017-09-04 02:20:56 +00:00
//
// Render
render() {
const {
artistId,
status,
nameSlug,
artistName,
2017-09-04 02:20:56 +00:00
monitored,
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
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}>
{
albums.map((season) => {
2017-09-04 02:20:56 +00:00
return (
<AlbumStudioAlbum
key={season.id}
2017-09-04 02:20:56 +00:00
{...season}
onSeasonMonitoredPress={onSeasonMonitoredPress}
/>
);
})
}
</TableRowCell>
</TableRow>
);
}
}
AlbumStudioRow.propTypes = {
2017-09-04 02:20:56 +00:00
artistId: PropTypes.number.isRequired,
status: PropTypes.string.isRequired,
nameSlug: PropTypes.string.isRequired,
artistName: PropTypes.string.isRequired,
2017-09-04 02:20:56 +00:00
monitored: PropTypes.bool.isRequired,
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
};
AlbumStudioRow.defaultProps = {
2017-09-04 02:20:56 +00:00
isSaving: false
};
export default AlbumStudioRow;