diff --git a/ui/v2.5/src/components/Performers/PerformerPopover.tsx b/ui/v2.5/src/components/Performers/PerformerPopover.tsx new file mode 100644 index 000000000..fa5b60e69 --- /dev/null +++ b/ui/v2.5/src/components/Performers/PerformerPopover.tsx @@ -0,0 +1,71 @@ +import React from "react"; +import { ErrorMessage } from "../Shared/ErrorMessage"; +import { LoadingIndicator } from "../Shared/LoadingIndicator"; +import { HoverPopover } from "../Shared/HoverPopover"; +import { useFindPerformer } from "../../core/StashService"; +import { PerformerCard } from "./PerformerCard"; +import { ConfigurationContext } from "../../hooks/Config"; +import { Placement } from "react-bootstrap/esm/Overlay"; + +interface IPeromerPopoverCardProps { + id: string; +} + +export const PerformerPopoverCard: React.FC = ({ + id, +}) => { + const { data, loading, error } = useFindPerformer(id); + + if (loading) + return ( +
+ +
+ ); + if (error) return ; + if (!data?.findPerformer) + return ; + + const performer = data.findPerformer; + + return ( +
+ +
+ ); +}; + +interface IPeroformerPopoverProps { + id: string; + hide?: boolean; + placement?: Placement; + target?: React.RefObject; +} + +export const PerformerPopover: React.FC = ({ + id, + hide, + children, + placement = "top", + target, +}) => { + const { configuration: config } = React.useContext(ConfigurationContext); + + const showPerformerCardOnHover = config?.ui.showTagCardOnHover ?? true; + + if (hide || !showPerformerCardOnHover) { + return <>{children}; + } + + return ( + } + > + {children} + + ); +}; diff --git a/ui/v2.5/src/components/Performers/PerformerSelect.tsx b/ui/v2.5/src/components/Performers/PerformerSelect.tsx index 15d878e02..d31dc3ec7 100644 --- a/ui/v2.5/src/components/Performers/PerformerSelect.tsx +++ b/ui/v2.5/src/components/Performers/PerformerSelect.tsx @@ -30,6 +30,8 @@ import { sortByRelevance } from "src/utils/query"; import { PatchComponent, PatchFunction } from "src/patch"; import { TruncatedText } from "../Shared/TruncatedText"; import TextUtils from "src/utils/text"; +import { PerformerPopover } from "./PerformerPopover"; +import { Placement } from "react-bootstrap/esm/Overlay"; export type SelectObject = { id: string; @@ -71,7 +73,12 @@ const performerSelectSort = PatchFunction( ); const _PerformerSelect: React.FC< - IFilterProps & IFilterValueProps & { ageFromDate?: string | null } + IFilterProps & + IFilterValueProps & { + ageFromDate?: string | null; + hoverPlacementLabel?: Placement; + hoverPlacementOptions?: Placement; + } > = (props) => { const [createPerformer] = usePerformerCreate(); @@ -201,12 +208,17 @@ const _PerformerSelect: React.FC< thisOptionProps = { ...optionProps, children: ( - - {object.name} - {object.disambiguation && ( - {` (${object.disambiguation})`} - )} - + + + {object.name} + {object.disambiguation && ( + {` (${object.disambiguation})`} + )} + + ), }; diff --git a/ui/v2.5/src/components/Tags/TagSelect.tsx b/ui/v2.5/src/components/Tags/TagSelect.tsx index 18f667cba..b93270e68 100644 --- a/ui/v2.5/src/components/Tags/TagSelect.tsx +++ b/ui/v2.5/src/components/Tags/TagSelect.tsx @@ -57,6 +57,7 @@ const tagSelectSort = PatchFunction("TagSelect.sort", sortTagsByRelevance); export type TagSelectProps = IFilterProps & IFilterValueProps & { hoverPlacement?: Placement; + hoverPlacementLabel?: Placement; excludeIds?: string[]; }; @@ -151,7 +152,14 @@ const _TagSelect: React.FC = (props) => { thisOptionProps = { ...optionProps, - children: object.name, + children: ( + + {object.name} + + ), }; return ;