From ffb5d73ab81327fb78b59fa28175967c3c8cbf8e Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 28 Feb 2022 13:42:02 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Added=20visibility=20filters=20t?= =?UTF-8?q?o=20the=20metadata=20tabs=20on=20comic=20details=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/ComicDetail.tsx | 63 ++++++++++++------- .../components/ComicDetail/RawFileDetails.tsx | 4 +- src/client/components/Dashboard/Dashboard.tsx | 6 +- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/src/client/components/ComicDetail.tsx b/src/client/components/ComicDetail.tsx index 43bf883..2132a62 100644 --- a/src/client/components/ComicDetail.tsx +++ b/src/client/components/ComicDetail.tsx @@ -134,23 +134,50 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { content: isComicBookMetadataAvailable ? ( ) : null, + include: isComicBookMetadataAvailable, }, { id: 2, - icon: , - name: "Archive Operations", - content: , + name: "ComicInfo.xml", + icon: , + content: ( +
+
+ {!isNil(comicBookDetailData.sourcedMetadata) && + !isNil(comicBookDetailData.sourcedMetadata.comicInfo) && ( +
+                  {JSON.stringify(
+                    comicBookDetailData.sourcedMetadata.comicInfo,
+                    null,
+                    2,
+                  )}
+                
+ )} +
+
+ ), + include: + !isNil(comicBookDetailData.sourcedMetadata) && + !isEmpty(comicBookDetailData.sourcedMetadata.comicInfo), }, { id: 3, - icon: , - name: "Acquisition", - content: ( - - ), + icon: , + name: "Archive Operations", + content: , + include: !isNil(comicBookDetailData.rawFileDetails), }, { id: 4, + icon: , + name: "Acquisition", + content: ( + + ), + include: !isNil(comicBookDetailData.rawFileDetails), + }, + { + id: 5, icon: null, name: !isNil(comicBookDetailData) && !isEmpty(comicBookDetailData) ? ( @@ -162,18 +189,21 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { ), + include: !isNil(comicBookDetailData.rawFileDetails), }, ]; // Tabs const MetadataTabGroup = () => { + const filteredTabs = tabGroup.filter((tab) => tab.include); + console.log("filter:m", filteredTabs); return ( <>
    - {tabGroup.map(({ id, name, icon }) => ( + {filteredTabs.map(({ id, name, icon }) => (
  • { ))}
- {tabGroup.map(({ id, content }) => { + {filteredTabs.map(({ id, content }) => { return active === id ? content : null; })} @@ -254,15 +284,6 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { inferredMetadata: comicBookDetailData.inferredMetadata, }} /> - {!isNil(comicBookDetailData.sourcedMetadata.comicInfo) && ( -
-
-                          {JSON.stringify(
-                            comicBookDetailData.sourcedMetadata, null, 2
-                          )}
-                        
-
- )} )} {/* comic vine scraped metadata */} @@ -275,7 +296,7 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { - {isComicBookMetadataAvailable ? : null} + {} { {/* inferred metadata */} -
-
Inferred Issue Metadata
+
Inferred Issue Metadata
+
diff --git a/src/client/components/Dashboard/Dashboard.tsx b/src/client/components/Dashboard/Dashboard.tsx index bf842ef..5b3a19c 100644 --- a/src/client/components/Dashboard/Dashboard.tsx +++ b/src/client/components/Dashboard/Dashboard.tsx @@ -92,16 +92,16 @@ export const Dashboard = (): ReactElement => { !isEmpty(libraryStatistics.statistics[0].fileTypes) && map( libraryStatistics.statistics[0].fileTypes, - (fileType) => { + (fileType, idx) => { return ( - <> + {fileType.data.length} {fileType._id} - + ); }, )}