🔧 Moved metadata panels to its own component
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import React, { ReactElement, useEffect, useMemo } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { searchIssue } from "../../actions/fileops.actions";
|
||||
import Card from "../Carda";
|
||||
import SearchBar from "../Library/SearchBar";
|
||||
import T2Table from "../shared/T2Table";
|
||||
import ellipsize from "ellipsize";
|
||||
import { isEmpty, isUndefined } from "lodash";
|
||||
import { convert } from "html-to-text";
|
||||
import MetadataPanel from "../shared/MetadataPanel";
|
||||
|
||||
export const WantedComics = (props): ReactElement => {
|
||||
const wantedComics = useSelector(
|
||||
@@ -38,108 +36,8 @@ export const WantedComics = (props): ReactElement => {
|
||||
Header: "Details",
|
||||
id: "comicDetails",
|
||||
minWidth: 350,
|
||||
accessor: (row) => {
|
||||
return row._source.sourcedMetadata.comicvine.volumeInformation ? (
|
||||
<div className="columns">
|
||||
<div className="column">
|
||||
<div className="comic-detail issue-metadata">
|
||||
<dl>
|
||||
<dd>
|
||||
<div className="columns mt-2">
|
||||
<div className="column is-3">
|
||||
{!isUndefined(
|
||||
row._source.sourcedMetadata.comicvine.image,
|
||||
) && (
|
||||
<Card
|
||||
imageUrl={
|
||||
row._source.sourcedMetadata.comicvine.image
|
||||
.thumb_url
|
||||
}
|
||||
orientation={"vertical"}
|
||||
hasDetails={false}
|
||||
// cardContainerStyle={{ maxWidth: 200 }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="column">
|
||||
<dl>
|
||||
<dd>
|
||||
{row._source.sourcedMetadata.comicvine.name
|
||||
? row._source.sourcedMetadata.comicvine.name
|
||||
: "No Name"}
|
||||
</dd>
|
||||
<dd>
|
||||
<h6 className="name has-text-weight-medium mb-1">
|
||||
{
|
||||
row._source.sourcedMetadata.comicvine
|
||||
.volumeInformation.name
|
||||
}
|
||||
</h6>
|
||||
</dd>
|
||||
<dd className="is-size-7">
|
||||
published by{" "}
|
||||
<span className="has-text-weight-semibold">
|
||||
{
|
||||
row._source.sourcedMetadata.comicvine
|
||||
.volumeInformation.publisher.name
|
||||
}
|
||||
</span>
|
||||
</dd>
|
||||
|
||||
<dd className="is-size-7">
|
||||
<span>
|
||||
{ellipsize(
|
||||
convert(
|
||||
row._source.sourcedMetadata.comicvine
|
||||
.description,
|
||||
{
|
||||
baseElements: {
|
||||
selectors: ["p"],
|
||||
},
|
||||
},
|
||||
),
|
||||
120,
|
||||
)}
|
||||
</span>
|
||||
</dd>
|
||||
|
||||
<dd className="is-size-7 mt-2">
|
||||
<div className="field is-grouped is-grouped-multiline">
|
||||
<div className="control">
|
||||
<span className="tags">
|
||||
<span className="tag is-success is-light has-text-weight-semibold">
|
||||
{
|
||||
row._source.sourcedMetadata
|
||||
.comicvine.volumeInformation.id
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div className="control">
|
||||
<span className="tags has-addons">
|
||||
<span className="tag">
|
||||
ComicVine Id
|
||||
</span>
|
||||
<span className="tag is-success is-light">
|
||||
{
|
||||
row._source.sourcedMetadata
|
||||
.comicvine.id
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null;
|
||||
},
|
||||
accessor: "_source",
|
||||
Cell: ({ value }) => <MetadataPanel data={value} />,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -194,11 +92,11 @@ export const WantedComics = (props): ReactElement => {
|
||||
rowData={wantedComics.hits.hits}
|
||||
totalPages={wantedComics.hits.total.value}
|
||||
columns={columnData}
|
||||
// paginationHandlers={{
|
||||
// nextPage: goToNextPage,
|
||||
// previousPage: goToPreviousPage,
|
||||
// }}
|
||||
// rowClickHandler={navigateToComicDetail}
|
||||
// paginationHandlers={{
|
||||
// nextPage: goToNextPage,
|
||||
// previousPage: goToPreviousPage,
|
||||
// }}
|
||||
// rowClickHandler={navigateToComicDetail}
|
||||
/>
|
||||
{/* pagination controls */}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user