From 2a2d996d54acf8f34c1f003e3ef9304dcabebc9e Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 9 Aug 2021 14:05:18 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=9B=20Adding=20details=20to=20the=20Co?= =?UTF-8?q?micDetail=20tab=20groups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/Card.tsx | 5 +- src/client/components/ComicDetail.tsx | 79 +++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/client/components/Card.tsx b/src/client/components/Card.tsx index b9360a3..cfecbc6 100644 --- a/src/client/components/Card.tsx +++ b/src/client/components/Card.tsx @@ -4,14 +4,15 @@ import { removeLeadingPeriod, escapePoundSymbol, } from "../shared/utils/formatting.utils"; -import { isUndefined, isEmpty } from "lodash"; +import { isUndefined, isEmpty, isNil } from "lodash"; import { Link } from "react-router-dom"; import ellipsize from "ellipsize"; interface IProps { - comicBookCoversMetadata: IExtractedComicBookCoverFile; + comicBookCoversMetadata?: IExtractedComicBookCoverFile; mongoObjId?: number; hasTitle: boolean; + title?: string; isHorizontal: boolean; } interface IState {} diff --git a/src/client/components/ComicDetail.tsx b/src/client/components/ComicDetail.tsx index 22cc533..aeb8410 100644 --- a/src/client/components/ComicDetail.tsx +++ b/src/client/components/ComicDetail.tsx @@ -11,7 +11,7 @@ import { IExtractedComicBookCoverFile, RootState } from "threetwo-ui-typings"; import { fetchComicVineMatches } from "../actions/fileops.actions"; import { getComicBookDetailById } from "../actions/comicinfo.actions"; import { Drawer, Divider } from "antd"; -import * as dayjs from "dayjs"; +import dayjs from "dayjs"; const prettyBytes = require("pretty-bytes"); import "antd/dist/antd.css"; @@ -60,10 +60,74 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => { setVisible(false); }; + const tabs = ["Volume Information", "Other Metadata", "Acquistion Details"]; + + const [active, setActive] = useState({ currentTab: tabs[0], markup: <> }); + const renderTabContent = (tab, data) => { + switch (tab) { + case "Volume Information": + setActive({ + currentTab: tab, + markup: ( +
+
+
+ +
+
+
+
+
+ {data.data.sourcedMetadata.comicvine.volumeInformation.name} +
+
+ Published by + + {" "} + { + data.data.sourcedMetadata.comicvine.volumeInformation + .publisher.name + } + +
+
+
+
+ ), + }); + break; + } + }; + const MetadataTabGroup = (data) => { + return ( + <> +
+ +
+ {active.markup} + + ); + }; + return (
- {!isEmpty(comicBookDetailData) && !isUndefined(comicBookDetailData) && ( + {!isNil(comicBookDetailData) && !isEmpty(comicBookDetailData) && ( <>

{comicBookDetailData.rawFileDetails.name}

@@ -77,9 +141,7 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
-
- Raw File Details -
+
Raw File Details
{comicBookDetailData.rawFileDetails.containedIn}
{prettyBytes(comicBookDetailData.rawFileDetails.fileSize)} @@ -142,7 +204,10 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
)} -
+ +