🤼 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,85 +34,56 @@ 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>
<div className="field is-horizontal"> <span className="h-px flex-1 bg-slate-200 dark:bg-slate-400"></span>
<div className="field-body"> </span>
<div className="field"> <label className="block py-1">Issue Name</label>
<Field name="issueName"> <Field name="issueName">
{(props) => ( {(props) => (
<p className="control is-expanded has-icons-left">
<input <input
{...props.input} {...props.input}
className="input is-normal" 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"
placeholder="Type the issue name" placeholder="Type the issue name"
/> />
<span className="icon is-small is-left">
<i className="fas fa-journal-whills"></i>
</span>
</p>
)} )}
</Field> </Field>
</div> <div className="flex flex-row gap-4">
</div> <div>
</div> <label className="block py-1">Number</label>
<div className="field is-horizontal">
<div className="field-body">
<div className="field">
<Field name="issueNumber"> <Field name="issueNumber">
{(props) => ( {(props) => (
<p className="control has-icons-left">
<input <input
{...props.input} {...props.input}
className="input is-normal" 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" placeholder="Type the issue number"
/> />
<span className="icon is-small is-left">
<i className="fas fa-hashtag"></i>
</span>
</p>
)} )}
</Field> </Field>
</div> </div>
<div>
<div className="field"> <label className="block py-1">Issue Number</label>
<Field name="issueYear"> <Field name="issueYear">
{(props) => ( {(props) => (
<p className="control has-icons-left">
<input <input
{...props.input} {...props.input}
className="input is-normal" 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" placeholder="Type the issue year"
/> />
<span className="icon is-small is-left">
<i className="fas fa-hashtag"></i>
</span>
</p>
)} )}
</Field> </Field>
</div> </div>
</div> </div>
</div> <div className="flex justify-end">
<div className="field is-horizontal">
<div className="field-body">
<div className="field">
<div className="control">
<button <button
type="submit" type="submit"
className="button is-success is-light is-outlined is-small" 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"
> >
<span className="icon"> Search
<i className="fas fa-search"></i>
</span>
<span>Search</span>
</button> </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,9 +59,8 @@ 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 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 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="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>
@@ -63,7 +69,6 @@ export const MatchResult = (props: MatchResultProps) => {
</span> </span>
</span> </span>
</div> </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">
<span className="pr-1 pt-1"> <span className="pr-1 pt-1">
@@ -111,16 +116,18 @@ export const MatchResult = (props: MatchResultProps) => {
</div> </div>
</div> </div>
</div> </div>
<div className="flex justify-end">
<button <button
className="button is-normal is-outlined is-primary is-light is-pulled-right" 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)} onClick={() => applyCVMatch(match, props.comicObjectId)}
> >
<span className="icon is-size-5"> <span className="text-md">Apply Match</span>
<i className="fas fa-clipboard-check"></i> <span className="w-5 h-5">
<i className="h-5 w-5 icon-[solar--magic-stick-3-bold-duotone]"></i>
</span> </span>
<span>Apply Match</span>
</button> </button>
</div> </div>
</div>
); );
})} })}
</> </>