diff --git a/src/client/actions/comicinfo.actions.tsx b/src/client/actions/comicinfo.actions.tsx index 419ee59..818a7c9 100644 --- a/src/client/actions/comicinfo.actions.tsx +++ b/src/client/actions/comicinfo.actions.tsx @@ -43,7 +43,7 @@ export const getWeeklyPullList = (options) => async (dispatch) => { url: `${COMICVINE_SERVICE_URI}/getWeeklyPullList`, method: "get", params: { - startDate: "2022-2-28", + startDate: "2022-3-7", pageSize: "15", currentPage: "1", }, diff --git a/src/client/components/ComicDetail.tsx b/src/client/components/ComicDetail.tsx index 8bdf859..43bf883 100644 --- a/src/client/components/ComicDetail.tsx +++ b/src/client/components/ComicDetail.tsx @@ -120,6 +120,9 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { const isComicBookMetadataAvailable = comicBookDetailData.sourcedMetadata && !isUndefined(comicBookDetailData.sourcedMetadata.comicvine) && + !isUndefined( + comicBookDetailData.sourcedMetadata.comicvine.volumeInformation, + ) && !isEmpty(comicBookDetailData.sourcedMetadata); // Tab content and header details @@ -214,10 +217,7 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { ); imagePath = escapePoundSymbol(encodedFilePath); comicBookTitle = comicBookDetailData.rawFileDetails.name; - } else if ( - !isNil(comicBookDetailData.sourcedMetadata) && - !isNil(comicBookDetailData.sourcedMetadata.comicvine) - ) { + } else if (isComicBookMetadataAvailable) { imagePath = comicBookDetailData.sourcedMetadata.comicvine.image.small_url; comicBookTitle = comicBookDetailData.sourcedMetadata.comicvine.name; } @@ -254,10 +254,19 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { inferredMetadata: comicBookDetailData.inferredMetadata, }} /> + {!isNil(comicBookDetailData.sourcedMetadata.comicInfo) && ( +
+
+                          {JSON.stringify(
+                            comicBookDetailData.sourcedMetadata, null, 2
+                          )}
+                        
+
+ )} )} {/* comic vine scraped metadata */} - {!isNil(comicBookDetailData.sourcedMetadata.comicvine) && ( + {isComicBookMetadataAvailable && ( { const dispatch = useDispatch(); @@ -46,7 +47,7 @@ export const Dashboard = (): ReactElement => {

Statistics

-
+
@@ -54,6 +55,14 @@ export const Dashboard = (): ReactElement => { {" "} files
+
+ Library size + + {" "} + {libraryStatistics.comicDirectorySize && + prettyBytes(libraryStatistics.comicDirectorySize)} + +
{!isUndefined(libraryStatistics.statistics) && !isEmpty(libraryStatistics.statistics[0].issues) && (
diff --git a/src/client/components/Dashboard/RecentlyImported.tsx b/src/client/components/Dashboard/RecentlyImported.tsx index 76b20ec..2867480 100644 --- a/src/client/components/Dashboard/RecentlyImported.tsx +++ b/src/client/components/Dashboard/RecentlyImported.tsx @@ -3,7 +3,7 @@ import Card from "../Carda"; import { Link } from "react-router-dom"; import ellipsize from "ellipsize"; import { escapePoundSymbol } from "../../shared/utils/formatting.utils"; -import { isNil, isUndefined, map } from "lodash"; +import { isEmpty, isNil, isUndefined, map } from "lodash"; import { detectIssueTypes } from "../../shared/utils/tradepaperback.utils"; import Masonry from "react-masonry-css"; import { LIBRARY_SERVICE_HOST } from "../../constants/endpoints"; @@ -21,6 +21,7 @@ export const RecentlyImported = ({ 700: 2, 600: 2, }; + return ( <>
@@ -37,6 +38,11 @@ export const RecentlyImported = ({ {map( comicBookCovers.docs, ({ _id, rawFileDetails, sourcedMetadata }) => { + const isComicBookMetadataAvailable = + sourcedMetadata && + !isUndefined(sourcedMetadata.comicvine) && + !isUndefined(sourcedMetadata.comicvine.volumeInformation) && + !isEmpty(sourcedMetadata); let imagePath = ""; let comicName = ""; if (!isNil(rawFileDetails)) { @@ -45,7 +51,7 @@ export const RecentlyImported = ({ ); imagePath = escapePoundSymbol(encodedFilePath); comicName = rawFileDetails.name; - } else if (!isNil(sourcedMetadata.comicvine)) { + } else if (!isEmpty(sourcedMetadata.comicvine)) { imagePath = sourcedMetadata.comicvine.image.small_url; comicName = sourcedMetadata.comicvine.name; } @@ -63,7 +69,7 @@ export const RecentlyImported = ({ title={comicName ? titleElement : null} >
- {!isNil(sourcedMetadata.comicvine) && ( + {isComicBookMetadataAvailable && ( @@ -75,7 +81,7 @@ export const RecentlyImported = ({ )} {/* Issue type */} - {!isUndefined(sourcedMetadata.comicvine) && + {isComicBookMetadataAvailable && !isNil( detectIssueTypes( sourcedMetadata.comicvine.volumeInformation.description, diff --git a/src/client/components/Library.tsx b/src/client/components/Library.tsx index f1c3e21..47458c1 100644 --- a/src/client/components/Library.tsx +++ b/src/client/components/Library.tsx @@ -4,7 +4,7 @@ import { useHistory } from "react-router"; import { useTable, usePagination } from "react-table"; import { useDispatch, useSelector } from "react-redux"; import { getComicBooks } from "../actions/fileops.actions"; -import { isEmpty, isNil } from "lodash"; +import { isEmpty, isNil, isUndefined } from "lodash"; import RawFileDetails from "./Library/RawFileDetails"; import ComicVineDetails from "./Library/ComicVineDetails"; import SearchBar from "./Library/SearchBar"; @@ -79,7 +79,8 @@ export const Library = ({}: IComicBookLibraryProps): ReactElement => { accessor: "sourcedMetadata", Cell(props) { return ( - !isNil(props.cell.value.comicvine) && ( + !isUndefined(props.cell.value) && + !isUndefined(props.cell.value.comicvine) && (
{props.cell.value.comicvine.issue_number}
) );