🕵🏼 Added manual search form for CV matching
This commit is contained in:
@@ -194,6 +194,7 @@ export const fetchVolumeGroups = () => async (dispatch) => {
|
|||||||
};
|
};
|
||||||
export const fetchComicVineMatches =
|
export const fetchComicVineMatches =
|
||||||
(searchPayload, issueSearchQuery, seriesSearchQuery?) => async (dispatch) => {
|
(searchPayload, issueSearchQuery, seriesSearchQuery?) => async (dispatch) => {
|
||||||
|
console.log(issueSearchQuery);
|
||||||
try {
|
try {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CV_API_CALL_IN_PROGRESS,
|
type: CV_API_CALL_IN_PROGRESS,
|
||||||
@@ -223,7 +224,6 @@ export const fetchComicVineMatches =
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response);
|
|
||||||
let matches: any = [];
|
let matches: any = [];
|
||||||
if (
|
if (
|
||||||
!isNil(response.data.results) &&
|
!isNil(response.data.results) &&
|
||||||
@@ -233,7 +233,6 @@ export const fetchComicVineMatches =
|
|||||||
} else {
|
} else {
|
||||||
matches = response.data.map((match) => match);
|
matches = response.data.map((match) => match);
|
||||||
}
|
}
|
||||||
console.log(matches);
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CV_SEARCH_SUCCESS,
|
type: CV_SEARCH_SUCCESS,
|
||||||
searchResults: matches,
|
searchResults: matches,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export const AirDCPPSettingsForm = (): ReactElement => {
|
|||||||
catch {
|
catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit = useCallback(async (values) => {
|
const onSubmit = useCallback(async (values) => {
|
||||||
try {
|
try {
|
||||||
airDCPPSettings.setSettings(values);
|
airDCPPSettings.setSettings(values);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export const Menu = (props): ReactElement => {
|
|||||||
} else if (!isEmpty(data.sourcedMetadata)) {
|
} else if (!isEmpty(data.sourcedMetadata)) {
|
||||||
issueSearchQuery = refineQuery(data.sourcedMetadata.comicvine.name);
|
issueSearchQuery = refineQuery(data.sourcedMetadata.comicvine.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(fetchComicVineMatches(data, issueSearchQuery, seriesSearchQuery));
|
dispatch(fetchComicVineMatches(data, issueSearchQuery, seriesSearchQuery));
|
||||||
setSlidingPanelContentId("CVMatches");
|
setSlidingPanelContentId("CVMatches");
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Card from "../Carda";
|
|||||||
import { ComicVineMatchPanel } from "./ComicVineMatchPanel";
|
import { ComicVineMatchPanel } from "./ComicVineMatchPanel";
|
||||||
|
|
||||||
import { RawFileDetails } from "./RawFileDetails";
|
import { RawFileDetails } from "./RawFileDetails";
|
||||||
|
import { ComicVineSearchForm } from "../ComicVineSearchForm";
|
||||||
|
|
||||||
import TabControls from "./TabControls";
|
import TabControls from "./TabControls";
|
||||||
import { EditMetadataPanel } from "./EditMetadataPanel";
|
import { EditMetadataPanel } from "./EditMetadataPanel";
|
||||||
@@ -40,6 +41,15 @@ type ComicDetailProps = {};
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
||||||
|
const {
|
||||||
|
data: {
|
||||||
|
_id,
|
||||||
|
rawFileDetails,
|
||||||
|
inferredMetadata,
|
||||||
|
sourcedMetadata: { comicvine, locg, comicInfo },
|
||||||
|
},
|
||||||
|
userSettings,
|
||||||
|
} = data;
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [slidingPanelContentId, setSlidingPanelContentId] = useState("");
|
const [slidingPanelContentId, setSlidingPanelContentId] = useState("");
|
||||||
@@ -67,9 +77,10 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
|||||||
dispatch(extractComicArchive(filePath));
|
dispatch(extractComicArchive(filePath));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const afterOpenModal = useCallback(() => {
|
const afterOpenModal = useCallback((things) => {
|
||||||
// references are now sync'd and can be accessed.
|
// references are now sync'd and can be accessed.
|
||||||
// subtitle.style.color = "#f00";
|
// subtitle.style.color = "#f00";
|
||||||
|
console.log(things);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const closeModal = useCallback(() => {
|
const closeModal = useCallback(() => {
|
||||||
@@ -79,9 +90,21 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
|||||||
// sliding panel init
|
// sliding panel init
|
||||||
const contentForSlidingPanel = {
|
const contentForSlidingPanel = {
|
||||||
CVMatches: {
|
CVMatches: {
|
||||||
content: () => {
|
content: (props) => (
|
||||||
if (!comicVineAPICallProgress) {
|
<>
|
||||||
return (
|
<div className="card search-criteria-card">
|
||||||
|
<div className="card-content">
|
||||||
|
<ComicVineSearchForm data={rawFileDetails}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p className="is-size-5 mt-3 mb-2 ml-3">Searching for:</p>
|
||||||
|
{inferredMetadata.issue ? (
|
||||||
|
<div className="ml-3">
|
||||||
|
<span className="tag mr-3">{inferredMetadata.issue.name} </span>
|
||||||
|
<span className="tag"> # {inferredMetadata.issue.number} </span>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{!comicVineAPICallProgress ? (
|
||||||
<ComicVineMatchPanel
|
<ComicVineMatchPanel
|
||||||
props={{
|
props={{
|
||||||
comicVineSearchQueryObject,
|
comicVineSearchQueryObject,
|
||||||
@@ -89,11 +112,7 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
|||||||
comicVineSearchResults,
|
comicVineSearchResults,
|
||||||
comicObjectId,
|
comicObjectId,
|
||||||
}}
|
}}
|
||||||
/>
|
/>) : (<div className="progress-indicator-container" >
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<div className="progress-indicator-container">
|
|
||||||
<div className="indicator">
|
<div className="indicator">
|
||||||
<Loader
|
<Loader
|
||||||
type="MutatingDots"
|
type="MutatingDots"
|
||||||
@@ -104,24 +123,16 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
|||||||
visible={comicVineAPICallProgress}
|
visible={comicVineAPICallProgress}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div >)}
|
||||||
);
|
</>),
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
editComicBookMetadata: {
|
editComicBookMetadata: {
|
||||||
content: () => <EditMetadataPanel />,
|
content: () => <EditMetadataPanel />,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const {
|
|
||||||
data: {
|
|
||||||
_id,
|
|
||||||
rawFileDetails,
|
|
||||||
inferredMetadata,
|
|
||||||
sourcedMetadata: { comicvine, locg, comicInfo },
|
|
||||||
},
|
|
||||||
userSettings,
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
// check for the availability of CV metadata
|
// check for the availability of CV metadata
|
||||||
const isComicBookMetadataAvailable =
|
const isComicBookMetadataAvailable =
|
||||||
|
|||||||
@@ -10,38 +10,8 @@ export const ComicVineMatchPanel = (comicVineData): ReactElement => {
|
|||||||
comicVineAPICallProgress,
|
comicVineAPICallProgress,
|
||||||
comicVineSearchResults,
|
comicVineSearchResults,
|
||||||
} = comicVineData.props;
|
} = comicVineData.props;
|
||||||
console.log(comicVineData);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!isEmpty(comicVineSearchQueryObject) && (
|
|
||||||
<div className="card search-criteria-card">
|
|
||||||
<div className="card-content">
|
|
||||||
<ComicVineSearchForm />
|
|
||||||
<p className="is-size-6">Searching against:</p>
|
|
||||||
<div className="field is-grouped is-grouped-multiline">
|
|
||||||
<div className="control">
|
|
||||||
<div className="tags has-addons">
|
|
||||||
<span className="tag">Title</span>
|
|
||||||
<span className="tag is-info">
|
|
||||||
{comicVineSearchQueryObject.issue.inferredIssueDetails.name}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="control">
|
|
||||||
<div className="tags has-addons">
|
|
||||||
<span className="tag">Number</span>
|
|
||||||
<span className="tag is-info">
|
|
||||||
{
|
|
||||||
comicVineSearchQueryObject.issue.inferredIssueDetails
|
|
||||||
.number
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="search-results-container">
|
<div className="search-results-container">
|
||||||
{!isEmpty(comicVineSearchResults) && (
|
{!isEmpty(comicVineSearchResults) && (
|
||||||
<MatchResult
|
<MatchResult
|
||||||
|
|||||||
@@ -1,22 +1,32 @@
|
|||||||
import React from "react";
|
import React, { useCallback } from "react";
|
||||||
import { Form, Field } from "react-final-form";
|
import { Form, Field } from "react-final-form";
|
||||||
import Collapsible from "react-collapsible";
|
import Collapsible from "react-collapsible";
|
||||||
|
import { fetchComicVineMatches } from "../actions/fileops.actions";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { refineQuery } from "filename-parser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for accepting ComicVine search parameters
|
* Component for performing search against ComicVine
|
||||||
*
|
*
|
||||||
* @component
|
* @component
|
||||||
* @example
|
* @example
|
||||||
* const age = 21
|
|
||||||
* const name = 'Jitendra Nirnejak'
|
|
||||||
* return (
|
* return (
|
||||||
* <User age={age} name={name} />
|
* <ComicVineSearchForm data={rawFileDetails} />
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
export const ComicVineSearchForm = () => {
|
export const ComicVineSearchForm = (data) => {
|
||||||
const onSubmit = () => {
|
const dispatch = useDispatch();
|
||||||
return true;
|
const onSubmit = useCallback((value) => {
|
||||||
};
|
const userInititatedQuery = {
|
||||||
|
inferredIssueDetails: {
|
||||||
|
name: value.issueName,
|
||||||
|
number: value.issueNumber,
|
||||||
|
subtitle: "",
|
||||||
|
year: value.issueYear,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispatch(fetchComicVineMatches(data, userInititatedQuery));
|
||||||
|
}, []);
|
||||||
const validate = () => {
|
const validate = () => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -28,7 +38,7 @@ export const ComicVineSearchForm = () => {
|
|||||||
render={({ handleSubmit }) => (
|
render={({ handleSubmit }) => (
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<span className="field is-normal">
|
<span className="field is-normal">
|
||||||
<label className="label">Issue Details</label>
|
<label className="label mb-2 is-size-5">Search Manually</label>
|
||||||
</span>
|
</span>
|
||||||
<div className="field is-horizontal">
|
<div className="field is-horizontal">
|
||||||
<div className="field-body">
|
<div className="field-body">
|
||||||
@@ -64,6 +74,23 @@ export const ComicVineSearchForm = () => {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
|
<div className="field">
|
||||||
|
<Field name="issueYear">
|
||||||
|
{(props) => (
|
||||||
|
<p className="control is-expanded has-icons-left">
|
||||||
|
<input
|
||||||
|
{...props.input}
|
||||||
|
className="input is-normal"
|
||||||
|
placeholder="Type the issue year"
|
||||||
|
/>
|
||||||
|
<span className="icon is-small is-left">
|
||||||
|
<i className="fas fa-hashtag"></i>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</Field>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,16 +116,7 @@ export const ComicVineSearchForm = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return <MyForm />;
|
||||||
<Collapsible
|
|
||||||
trigger={"Match Manually"}
|
|
||||||
triggerTagName="a"
|
|
||||||
triggerClassName={"is-size-6"}
|
|
||||||
triggerOpenedClassName={"is-size-6"}
|
|
||||||
>
|
|
||||||
<MyForm />
|
|
||||||
</Collapsible>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ComicVineSearchForm;
|
export default ComicVineSearchForm;
|
||||||
|
|||||||
Reference in New Issue
Block a user