import React, { ReactElement, useEffect } from "react"; import prettyBytes from "pretty-bytes"; import { isEmpty, isUndefined, map } from "lodash"; export const LibraryStatistics = ( props: ILibraryStatisticsProps, ): ReactElement => { // const { stats } = props; return (

Your Library In Numbers

A brief snapshot of your library.

{props.stats.totalDocuments} {" "} files
Library size {" "} {props.stats.comicDirectorySize && prettyBytes(props.stats.comicDirectorySize)}
{!isUndefined(props.stats.statistics) && !isEmpty(props.stats.statistics[0].issues) && (
{props.stats.statistics[0].issues.length} {" "} tagged with ComicVine
)} {!isUndefined(props.stats.statistics) && !isEmpty(props.stats.statistics[0].issuesWithComicInfoXML) && (
{props.stats.statistics[0].issuesWithComicInfoXML.length} {" "} with ComicInfo.xml
)}
Issues
304 Volumes
{!isUndefined(props.stats.statistics) && !isEmpty(props.stats.statistics[0].fileTypes) && map(props.stats.statistics[0].fileTypes, (fileType, idx) => { return ( {fileType.data.length} {fileType._id} ); })}
{/* file types */}
{/* publisher with most issues */}
{!isUndefined(props.stats.statistics) && !isEmpty( props.stats.statistics[0].publisherWithMostComicsInLibrary[0], ) && (
{ props.stats.statistics[0] .publisherWithMostComicsInLibrary[0]._id } {" has the most issues "} { props.stats.statistics[0] .publisherWithMostComicsInLibrary[0].count }
)}
304 Volumes
); }; export default LibraryStatistics;