import React, { ReactElement, useEffect, useMemo } from "react"; import { useDispatch, useSelector } from "react-redux"; import { searchIssue } from "../../actions/fileops.actions"; import Card from "../shared/Carda"; import T2Table from "../shared/T2Table"; import ellipsize from "ellipsize"; import { convert } from "html-to-text"; import { isUndefined } from "lodash"; export const Volumes = (props): ReactElement => { const volumes = useSelector((state: RootState) => state.fileOps.volumes); const dispatch = useDispatch(); useEffect(() => { dispatch( searchIssue( { query: {}, }, { pagination: { size: 25, from: 0, }, type: "volumes", trigger: "volumesPage", }, ), ); }, []); const columnData = useMemo( () => [ { header: "Volume Details", id: "volumeDetails", minWidth: 450, accessorKey: "_source", cell: (row) => { const foo = row.getValue(); return (
{ foo.sourcedMetadata.comicvine .volumeInformation.name }
published by{" "} { foo.sourcedMetadata.comicvine .volumeInformation.publisher.name }
{ellipsize( convert( foo.sourcedMetadata.comicvine .volumeInformation.description, { baseElements: { selectors: ["p"], }, }, ), 120, )}
Total Issues { foo.sourcedMetadata.comicvine .volumeInformation.count_of_issues }
); }, }, { header: "Download Status", columns: [ { header: "Files", accessorKey: "_source.acquisition.directconnect", align: "right", cell: (props) => { const row = props.getValue(); return (
{row.length > 0 ? ( {row.length} ) : null}
); }, }, { header: "Type", id: "Air", }, { header: "Type", id: "dcc", }, ], }, ], [], ); return (

Volumes

{!isUndefined(volumes.hits) && (
{}, previousPage: () => {}, }} columns={columnData} />
)}
); }; export default Volumes;