import PropTypes from 'prop-types'; import React, { Component } from 'react'; import TableRow from 'Components/Table/TableRow'; import TableRowCell from 'Components/Table/Cells/TableRowCell'; import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; import EpisodeStatusConnector from 'Album/EpisodeStatusConnector'; import TrackFileLanguageConnector from 'TrackFile/TrackFileLanguageConnector'; import MediaInfoConnector from 'TrackFile/MediaInfoConnector'; import * as mediaInfoTypes from 'TrackFile/mediaInfoTypes'; import styles from './TrackRow.css'; class TrackRow extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isDetailsModalOpen: false }; } // // Listeners onDetailsModalClose = () => { this.setState({ isDetailsModalOpen: false }); } // // Render render() { const { id, mediumNumber, trackFileId, absoluteTrackNumber, title, duration, trackFilePath, trackFileRelativePath, columns } = this.props; return ( { columns.map((column) => { const { name, isVisible } = column; if (!isVisible) { return null; } if (name === 'medium') { return ( {mediumNumber} ); } if (name === 'absoluteTrackNumber') { return ( {absoluteTrackNumber} ); } if (name === 'title') { return ( {title} ); } if (name === 'path') { return ( { trackFilePath } ); } if (name === 'relativePath') { return ( { trackFileRelativePath } ); } if (name === 'duration') { return ( { formatTimeSpan(duration) } ); } if (name === 'language') { return ( ); } if (name === 'audioInfo') { return ( ); } if (name === 'status') { return ( ); } return null; }) } ); } } TrackRow.propTypes = { id: PropTypes.number.isRequired, albumId: PropTypes.number.isRequired, trackFileId: PropTypes.number, mediumNumber: PropTypes.number.isRequired, trackNumber: PropTypes.string.isRequired, absoluteTrackNumber: PropTypes.number, title: PropTypes.string.isRequired, duration: PropTypes.number.isRequired, isSaving: PropTypes.bool, trackFilePath: PropTypes.string, trackFileRelativePath: PropTypes.string, mediaInfo: PropTypes.object, columns: PropTypes.arrayOf(PropTypes.object).isRequired }; export default TrackRow;