import React, { ReactElement } from "react"; import PropTypes from "prop-types"; import { detectIssueTypes } from "../../shared/utils/tradepaperback.utils"; import dayjs from "dayjs"; import { isUndefined } from "lodash"; import Card from "../Carda"; export const ComicVineDetails = (props): ReactElement => { const { data, updatedAt } = props; return (
ComicVine Metadata
Last scraped on {dayjs(updatedAt).format("MMM D YYYY [at] h:mm a")}
{data.name}
Is a part of{" "} {data.volumeInformation.name}
Published by {" "} {data.volumeInformation.publisher.name}
Total issues in this volume: {data.volumeInformation.count_of_issues}
{data.issue_number && (
Issue Number {data.issue_number}
)} {!isUndefined( detectIssueTypes(data.volumeInformation.description), ) ? (
Detected Type { detectIssueTypes( data.volumeInformation.description, ).displayName }
) : data.resource_type ? (
Type {data.resource_type}
) : null}
ComicVine Issue ID {data.id}
); }; export default ComicVineDetails; ComicVineDetails.propTypes = { updatedAt: PropTypes.string, data: PropTypes.shape({ name: PropTypes.string, number: PropTypes.string, resource_type: PropTypes.string, id: PropTypes.number, }), };