🤼 Revamped CV match panel UX

This commit is contained in:
2024-01-04 00:39:29 -05:00
parent d2873893b8
commit 9bbb066c38
4 changed files with 83 additions and 103 deletions

View File

@@ -115,14 +115,16 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
<div> <div>
<ComicVineSearchForm data={rawFileDetails} /> <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}
<div className="border-slate-500 border rounded-lg p-2 mt-3">
<p className="">Searching for:</p>
{inferredMetadata.issue ? (
<>
<span className="">{inferredMetadata.issue.name} </span>
<span className=""> # {inferredMetadata.issue.number} </span>
</>
) : null}
</div>
<ComicVineMatchPanel <ComicVineMatchPanel
props={{ props={{
comicVineMatches, comicVineMatches,

View File

@@ -21,7 +21,7 @@ export const ComicVineMatchPanel = (comicVineData): ReactElement => {
comicObjectId={comicObjectId} comicObjectId={comicObjectId}
/> />
) : ( ) : (
<>{comicvine.scrapingStatus}</> <div className="text-md my-5">{comicvine.scrapingStatus}</div>
)} )}
</div> </div>
</> </>

View File

@@ -34,84 +34,55 @@ export const ComicVineSearchForm = (data) => {
validate={validate} validate={validate}
render={({ handleSubmit }) => ( render={({ handleSubmit }) => (
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<span className="field is-normal"> <span className="flex items-center">
<label className="label mb-2 is-size-5">Search Manually</label> <span className="text-md text-slate-500 dark:text-slate-500 pr-5">
Override Search Query
</span>
<span className="h-px flex-1 bg-slate-200 dark:bg-slate-400"></span>
</span> </span>
<div className="field is-horizontal"> <label className="block py-1">Issue Name</label>
<div className="field-body"> <Field name="issueName">
<div className="field"> {(props) => (
<Field name="issueName"> <input
{(props) => ( {...props.input}
<p className="control is-expanded has-icons-left"> className="appearance-none dark:bg-slate-400 bg-slate-100 h-10 w-full rounded-md border-none text-gray-700 dark:text-slate-200 py-1 pr-7 pl-3 sm:text-md sm:leading-5 focus:outline-none focus:shadow-outline-blue focus:border-blue-300"
<input placeholder="Type the issue name"
{...props.input} />
className="input is-normal" )}
placeholder="Type the issue name" </Field>
/> <div className="flex flex-row gap-4">
<span className="icon is-small is-left"> <div>
<i className="fas fa-journal-whills"></i> <label className="block py-1">Number</label>
</span> <Field name="issueNumber">
</p> {(props) => (
)} <input
</Field> {...props.input}
</div> className="appearance-none dark:bg-slate-400 bg-slate-100 h-10 w-14 rounded-md border-none text-gray-700 dark:text-slate-200 py-1 pr-7 pl-3 sm:text-md sm:leading-5 focus:outline-none focus:shadow-outline-blue focus:border-blue-300"
placeholder="Type the issue number"
/>
)}
</Field>
</div>
<div>
<label className="block py-1">Issue Number</label>
<Field name="issueYear">
{(props) => (
<input
{...props.input}
className="appearance-none dark:bg-slate-400 bg-slate-100 h-10 rounded-md border-none text-gray-700 dark:text-slate-200 py-1 pr-7 pl-3 sm:text-md sm:leading-5 focus:outline-none focus:shadow-outline-blue focus:border-blue-300"
placeholder="Type the issue year"
/>
)}
</Field>
</div> </div>
</div> </div>
<div className="flex justify-end">
<div className="field is-horizontal"> <button
<div className="field-body"> type="submit"
<div className="field"> className="flex space-x-1 sm:mt-3 sm:flex-row sm:items-center rounded-lg border border-green-400 dark:border-green-200 bg-green-200 px-4 py-2 text-gray-500 hover:bg-transparent hover:text-red-600 focus:outline-none focus:ring active:text-indigo-500"
<Field name="issueNumber"> >
{(props) => ( Search
<p className="control has-icons-left"> </button>
<input
{...props.input}
className="input is-normal"
placeholder="Type the issue number"
/>
<span className="icon is-small is-left">
<i className="fas fa-hashtag"></i>
</span>
</p>
)}
</Field>
</div>
<div className="field">
<Field name="issueYear">
{(props) => (
<p className="control 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 className="field is-horizontal">
<div className="field-body">
<div className="field">
<div className="control">
<button
type="submit"
className="button is-success is-light is-outlined is-small"
>
<span className="icon">
<i className="fas fa-search"></i>
</span>
<span>Search</span>
</button>
</div>
</div>
</div>
</div> </div>
</form> </form>
)} )}

View File

@@ -27,6 +27,12 @@ export const MatchResult = (props: MatchResultProps) => {
}; };
return ( return (
<> <>
<span className="flex items-center mt-6">
<span className="text-md text-slate-500 dark:text-slate-500 pr-5">
ComicVine Matches
</span>
<span className="h-px flex-1 bg-slate-200 dark:bg-slate-400"></span>
</span>
{map(props.matchData, (match, idx) => { {map(props.matchData, (match, idx) => {
let issueDescription = ""; let issueDescription = "";
if (!isNil(match.description)) { if (!isNil(match.description)) {
@@ -36,8 +42,9 @@ export const MatchResult = (props: MatchResultProps) => {
}, },
}); });
} }
const bestMatchCSSClass = idx === 0 ? "bg-green-100" : "bg-slate-300";
return ( return (
<div className="mb-4" key={idx}> <div className={`${bestMatchCSSClass} my-5 p-4 rounded-lg`} key={idx}>
<div className="flex flex-row gap-4"> <div className="flex flex-row gap-4">
<div className="min-w-fit"> <div className="min-w-fit">
<img <img
@@ -52,17 +59,15 @@ export const MatchResult = (props: MatchResultProps) => {
<p className="text-md w-full">{match.name}</p> <p className="text-md w-full">{match.name}</p>
) : null} ) : null}
<div className="flex"> {/* score */}
{/* score */} <span className="inline-flex h-fit w-fit items-center bg-green-50 text-sm text-slate-800 font-medium px-2 rounded-md dark:text-slate-900 dark:bg-green-400">
<span className="inline-flex items-center bg-green-50 text-sm text-slate-800 font-medium px-2 rounded-md dark:text-slate-900 dark:bg-green-400"> <span className="pr-1 pt-1">
<span className="pr-1 pt-1"> <i className="icon-[solar--course-up-line-duotone] w-4 h-4"></i>
<i className="icon-[solar--course-up-line-duotone] w-4 h-4"></i>
</span>
<span className="text-slate-900 dark:text-slate-900">
{parseInt(match.score, 10)}
</span>
</span> </span>
</div> <span className="text-slate-900 dark:text-slate-900">
{parseInt(match.score, 10)}
</span>
</span>
</div> </div>
<span className="flex flex-row gap-2 mb-2"> <span className="flex flex-row gap-2 mb-2">
<span className="inline-flex items-center bg-slate-50 text-sm text-slate-800 font-medium px-2 rounded-md dark:text-slate-900 dark:bg-slate-400"> <span className="inline-flex items-center bg-slate-50 text-sm text-slate-800 font-medium px-2 rounded-md dark:text-slate-900 dark:bg-slate-400">
@@ -111,15 +116,17 @@ export const MatchResult = (props: MatchResultProps) => {
</div> </div>
</div> </div>
</div> </div>
<button <div className="flex justify-end">
className="button is-normal is-outlined is-primary is-light is-pulled-right" <button
onClick={() => applyCVMatch(match, props.comicObjectId)} className="flex space-x-1 sm:mt-0 sm:flex-row sm:items-center rounded-lg border border-green-400 dark:border-green-200 bg-green-200 px-3 py-1 text-gray-500 hover:bg-transparent hover:text-green-600 focus:outline-none focus:ring active:text-indigo-500"
> onClick={() => applyCVMatch(match, props.comicObjectId)}
<span className="icon is-size-5"> >
<i className="fas fa-clipboard-check"></i> <span className="text-md">Apply Match</span>
</span> <span className="w-5 h-5">
<span>Apply Match</span> <i className="h-5 w-5 icon-[solar--magic-stick-3-bold-duotone]"></i>
</button> </span>
</button>
</div>
</div> </div>
); );
})} })}