import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { align, icons, sortDirections } from 'Helpers/Props'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import VirtualTable from 'Components/Table/VirtualTable'; import VirtualTableRow from 'Components/Table/VirtualTableRow'; import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; import PageContent from 'Components/Page/PageContent'; import PageContentBodyConnector from 'Components/Page/PageContentBodyConnector'; import PageToolbar from 'Components/Page/Toolbar/PageToolbar'; import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection'; import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; import UnmappedFilesTableRow from './UnmappedFilesTableRow'; import UnmappedFilesTableHeader from './UnmappedFilesTableHeader'; class UnmappedFilesTable extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { scroller: null }; } // // Control setScrollerRef = (ref) => { this.setState({ scroller: ref }); } rowRenderer = ({ key, rowIndex, style }) => { const { items, columns, deleteUnmappedFile } = this.props; const item = items[rowIndex]; return ( ); } render() { const { isFetching, isPopulated, error, items, columns, sortKey, sortDirection, onTableOptionChange, onSortPress, deleteUnmappedFile, ...otherProps } = this.props; const { scroller } = this.state; return ( { isFetching && !isPopulated && } { isPopulated && !error && !items.length &&
Success! My work is done, all files on disk are matched to known tracks.
} { isPopulated && !error && !!items.length && scroller && } sortKey={sortKey} sortDirection={sortDirection} /> }
); } } UnmappedFilesTable.propTypes = { isFetching: PropTypes.bool.isRequired, isPopulated: PropTypes.bool.isRequired, error: PropTypes.object, items: PropTypes.arrayOf(PropTypes.object).isRequired, columns: PropTypes.arrayOf(PropTypes.object).isRequired, sortKey: PropTypes.string, sortDirection: PropTypes.oneOf(sortDirections.all), onTableOptionChange: PropTypes.func.isRequired, onSortPress: PropTypes.func.isRequired, deleteUnmappedFile: PropTypes.func.isRequired }; export default UnmappedFilesTable;