🔧 Various fixes

This commit is contained in:
2021-09-08 22:52:00 -07:00
parent f3d94f2a75
commit f04641986d
10 changed files with 145 additions and 24 deletions

View File

@@ -76,7 +76,13 @@ $border-color: red;
}
}
.card-content {
padding: 1rem;
.card-title {
margin-bottom: 0.2rem;
}
.cv-icon, i {
margin: 4px 4px 4px 0;
}
padding: 0.5rem 1rem;
}
}
.card-container {

View File

@@ -110,8 +110,8 @@ export const AcquisitionPanel = (
)}
</div>
{/* AirDC++ results */}
<div>
{!isNil(airDCPPSearchResults) && !isEmpty(airDCPPSearchResults) && (
<div className="columns">
{!isNil(airDCPPSearchResults) && !isEmpty(airDCPPSearchResults) ? (
<table className="table is-striped">
<thead>
<tr>
@@ -182,6 +182,17 @@ export const AcquisitionPanel = (
})}
</tbody>
</table>
) : (
<div className="column is-three-fifths">
<article className="message is-info">
<div className="message-body is-size-6 is-family-secondary">
Searching via <strong>AirDC++</strong> is still in{" "}
<strong>alpha</strong>. Some searches may take arbitrarily long,
or may not work at all. Searches from <code>ADCS</code> hubs are more
reliable than <code>NMDCS</code> ones.
</div>
</article>
</div>
)}
</div>
</>

View File

@@ -32,7 +32,9 @@ const renderCard = (props): ReactElement => {
</div>
{props.hasDetails && (
<div className="card-content">
{isNil(props.title) ? "No Name" : props.title}
<div className="card-title is-size-6 is-family-secondary">
{isNil(props.title) ? "No Name" : props.title}
</div>
{props.children}
</div>
)}

View File

@@ -16,6 +16,7 @@ import { isEmpty, isUndefined, isNil } from "lodash";
import { RootState } from "threetwo-ui-typings";
import { fetchComicVineMatches } from "../actions/fileops.actions";
import { getComicBookDetailById } from "../actions/comicinfo.actions";
import { detectTradePaperbacks } from "../shared/utils/tradepaperback.utils";
import dayjs from "dayjs";
const prettyBytes = require("pretty-bytes");
@@ -115,11 +116,17 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
</span>
</dd>
<dd>
Total issues in this volume:{" "}
Total issues in this volume:
{
comicBookDetailData.sourcedMetadata.comicvine
.volumeInformation.count_of_issues
}
{JSON.stringify(
detectTradePaperbacks(
comicBookDetailData.sourcedMetadata.comicvine
.volumeInformation.description,
),
)}
</dd>
</dl>
</div>
@@ -274,6 +281,9 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
}),
};
// Determine which cover image to use:
// 1. from the locally imported, non-CV-scraped version, or
// 2. from the CV-scraped version
let imagePath = "";
let comicBookTitle = "";
if (!isNil(comicBookDetailData.rawFileDetails)) {

View File

@@ -39,7 +39,16 @@ export const RecentlyImported = ({
imageUrl={imagePath}
hasDetails
title={comicName ? titleElement : null}
></Card>
>
{!isNil(sourcedMetadata.comicvine) && (
<div className="content is-flex is-flex-direction-row">
<span className="icon cv-icon is-small">
<img src="/dist/img/cvlogo.svg" />
</span>
<i className="fas fa-paper-plane is-small has-text-warning has-text-light"></i>
</div>
)}
</Card>
);
})}
</section>

View File

@@ -0,0 +1,34 @@
import Classifier from "ml-classify-text";
export const detectTradePaperbacks = (deck: string): any => {
const classifier = new Classifier({ nGramMin: 2, nGramMax: 2 });
const positiveTPBIdentifiers = [
"trade paperbacks",
"TPB",
"paperback",
"hardcover",
"collects the following issues",
"collected issues",
"collecting the issues",
"collecting the following issues",
"collected editions",
];
const negativeTPBIdentifiers = ["mini-series"];
classifier.train(positiveTPBIdentifiers, "Possibly a trade paperback");
classifier.train(negativeTPBIdentifiers, "Not a trade paperback");
if (deck) {
console.log("DEC", deck);
const predictions = classifier.predict(deck);
if (predictions.length) {
predictions.forEach((prediction) => {
console.log(`${prediction.label} (${prediction.confidence})`);
return prediction;
});
} else {
console.log("No predictions returned.");
}
}
};

View File

@@ -0,0 +1,14 @@
[
{"phrase": "Twelve issue mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Trade paperback collecting Jean Grey #7-11.", "result": {"paperback": 1}},
{"phrase": "Trade paperback collecting Iron Fist #6-7 & 73-77", "result": {"paperback ": 1}},
{"phrase": "Collected Editions", "result": {"paperback": 1}},
{"phrase": "Six issue mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Four issue mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Seventy-two issue digital prequel to the Injustice 2 video game.", "result": {"not_a_paperback": 1}},
{"phrase": "Total issues in this volume:50", "result": {"paperback": 1}},
{"phrase": "Five issue mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Digital mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Six issue mini-series.", "result": {"not_a_paperback": 1}},
{"phrase": "Six issue mini-series.", "result": {"not_a_paperback": 1}}
]