import React from "react"; import { isNil, map } from "lodash"; import { convert } from "html-to-text"; import ellipsize from "ellipsize"; import { LIBRARY_SERVICE_BASE_URI } from "../../constants/endpoints"; import axios from "axios"; interface MatchResultProps { matchData: any; comicObjectId: string; } const handleBrokenImage = (e) => { e.target.src = "http://localhost:3050/dist/img/noimage.svg"; }; export const MatchResult = (props: MatchResultProps) => { const applyCVMatch = async (match, comicObjectId) => { return await axios.request({ url: `${LIBRARY_SERVICE_BASE_URI}/applyComicVineMetadata`, method: "POST", data: { match, comicObjectId, }, }); }; return ( <> ComicVine Matches {map(props.matchData, (match, idx) => { let issueDescription = ""; if (!isNil(match.description)) { issueDescription = convert(match.description, { baseElements: { selectors: ["p"], }, }); } const bestMatchCSSClass = idx === 0 ? "bg-green-100" : "bg-slate-300"; return (
{match.name}
) : null} {/* score */} {parseInt(match.score, 10)}Total Issues: {match.volumeInformation.results.count_of_issues}
Published by{" "} {match.volumeInformation.results.publisher.name}