import _ from 'lodash'; import PropTypes from 'prop-types'; import React, { Fragment } from 'react'; import DescriptionList from 'Components/DescriptionList/DescriptionList'; import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription'; import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle'; import Link from 'Components/Link/Link'; import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; import styles from './FileDetails.css'; function renderRejections(rejections) { return ( Rejections { _.map(rejections, (item, key) => { return ( {item.reason} ); }) } ); } function FileDetails(props) { const { filename, audioTags, rejections } = props; return (
{ filename && } { audioTags.title !== undefined && } { audioTags.trackNumbers[0] > 0 && } { audioTags.discNumber > 0 && } { audioTags.discCount > 0 && } { audioTags.albumTitle !== undefined && } { audioTags.artistTitle !== undefined && } { audioTags.country !== undefined && } { audioTags.year > 0 && } { audioTags.label !== undefined && } { audioTags.catalogNumber !== undefined && } { audioTags.disambiguation !== undefined && } { audioTags.duration !== undefined && } { audioTags.artistMBId !== undefined && } { audioTags.albumMBId !== undefined && } { audioTags.releaseMBId !== undefined && } { audioTags.recordingMBId !== undefined && } { audioTags.trackMBId !== undefined && } { !!rejections && rejections.length > 0 && renderRejections(rejections) }
); } FileDetails.propTypes = { filename: PropTypes.string, audioTags: PropTypes.object.isRequired, rejections: PropTypes.arrayOf(PropTypes.object) }; export default FileDetails;