Lidarr/frontend/src/AlbumStudio/AlbumStudioRow.js

101 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,
foreignArtistId,
artistName,
2017-09-04 02:20:56 +00:00
monitored,
albums,
2017-09-04 02:20:56 +00:00
isSaving,
isSelected,
onSelectedChange,
onArtistMonitoredPress,
onAlbumMonitoredPress
2017-09-04 02:20:56 +00:00
} = this.props;
return (
<TableRow>
<TableSelectCell
id={artistId}
isSelected={isSelected}
onSelectedChange={onSelectedChange}
/>
<TableRowCell className={styles.status}>
<Icon
className={styles.statusIcon}
name={status === 'ended' ? icons.ARTIST_ENDED : icons.ARTIST_CONTINUING}
title={status === 'ended' ? 'Ended' : 'Continuing'}
/>
2017-09-04 02:20:56 +00:00
</TableRowCell>
<TableRowCell className={styles.title}>
<ArtistNameLink
foreignArtistId={foreignArtistId}
artistName={artistName}
2017-09-04 02:20:56 +00:00
/>
</TableRowCell>
<TableRowCell className={styles.monitored}>
<MonitorToggleButton
monitored={monitored}
isSaving={isSaving}
onPress={onArtistMonitoredPress}
2017-09-04 02:20:56 +00:00
/>
</TableRowCell>
<TableRowCell className={styles.albums}>
2017-09-04 02:20:56 +00:00
{
albums.map((album) => {
2017-09-04 02:20:56 +00:00
return (
<AlbumStudioAlbum
key={album.id}
{...album}
onAlbumMonitoredPress={onAlbumMonitoredPress}
2017-09-04 02:20:56 +00:00
/>
);
})
}
</TableRowCell>
</TableRow>
);
}
}
AlbumStudioRow.propTypes = {
2017-09-04 02:20:56 +00:00
artistId: PropTypes.number.isRequired,
status: PropTypes.string.isRequired,
foreignArtistId: 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,
onArtistMonitoredPress: PropTypes.func.isRequired,
onAlbumMonitoredPress: PropTypes.func.isRequired
2017-09-04 02:20:56 +00:00
};
AlbumStudioRow.defaultProps = {
2017-09-04 02:20:56 +00:00
isSaving: false
};
export default AlbumStudioRow;