From cdbb2bbcfdf2f8dcf5230d61360a485e5f64c1d1 Mon Sep 17 00:00:00 2001 From: Flashy78 <90150289+Flashy78@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:35:08 -0700 Subject: [PATCH] Add disambiguation and links to tagger results (#4180) Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com> --- .../components/Performers/PerformerSelect.tsx | 9 ++- .../Tagger/scenes/PerformerResult.tsx | 61 ++++++++++++++++++- .../Tagger/scenes/StashSearchResult.tsx | 12 ++-- .../components/Tagger/scenes/StudioResult.tsx | 48 ++++++++++++++- 4 files changed, 118 insertions(+), 12 deletions(-) diff --git a/ui/v2.5/src/components/Performers/PerformerSelect.tsx b/ui/v2.5/src/components/Performers/PerformerSelect.tsx index de1cf6771a9..d37b8fe375a 100644 --- a/ui/v2.5/src/components/Performers/PerformerSelect.tsx +++ b/ui/v2.5/src/components/Performers/PerformerSelect.tsx @@ -122,7 +122,14 @@ export const PerformerSelect: React.FC< thisOptionProps = { ...optionProps, - children: object.name, + children: ( + <> + {object.name} + {object.disambiguation && ( + {` (${object.disambiguation})`} + )} + + ), }; return ; diff --git a/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx b/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx index 6afbc442730..9d58f1f6ff2 100755 --- a/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/PerformerResult.tsx @@ -11,6 +11,41 @@ import { Performer, PerformerSelect, } from "src/components/Performers/PerformerSelect"; +import { getStashboxBase } from "src/utils/stashbox"; + +interface IPerformerName { + performer: GQL.ScrapedPerformer | Performer; + className?: string; + baseURL: string | undefined; + id: string | undefined | null; +} + +const PerformerName: React.FC = ({ + performer, + className, + baseURL, + id, +}) => { + const name = + baseURL && id ? ( + + {performer.name} + + ) : ( + performer.name + ); + + return ( + + {name} + {performer.disambiguation && ( + + {` (${performer.disambiguation})`} + + )} + + ); +}; interface IPerformerResultProps { performer: GQL.ScrapedPerformer; @@ -44,6 +79,11 @@ const PerformerResult: React.FC = ({ const [selectedPerformer, setSelectedPerformer] = useState(); + const stashboxPerformerPrefix = endpoint + ? `${getStashboxBase(endpoint)}performers/` + : undefined; + const performerURLPrefix = "/performers/"; + function selectPerformer(selected: Performer | undefined) { setSelectedPerformer(selected); setSelectedID(selected?.id); @@ -77,7 +117,12 @@ const PerformerResult: React.FC = ({
: - {performer.name} +
= ({ : - {matchedPerformer.name} +
@@ -119,7 +169,12 @@ const PerformerResult: React.FC = ({
: - {performer.name} +