Cleanup PerformerPopover to remove old loading state

- Eliminated the PerformerPreviewCard component, simplifying the PerformerPopoverCard structure.
- Updated loading state logic to directly display loading text without relying on preview data.
- Removed unused props related to performer preview data for cleaner code and improved maintainability.
This commit is contained in:
KennyG 2026-05-04 10:56:25 -04:00
parent 455cac489f
commit 255b1d6b9a
2 changed files with 4 additions and 72 deletions

View file

@ -6,15 +6,10 @@ import { useFindPerformer } from "../../core/StashService";
import { useConfigurationContext } from "../../hooks/Config";
import { Placement } from "react-bootstrap/esm/Overlay";
import { PerformerCard } from "./PerformerCard";
import {
IPerformerPreviewData,
PerformerPreviewCard,
} from "./PerformerPreviewCard";
interface IPeromerPopoverCardProps {
id?: string;
cardContent?: React.ReactNode;
previewData?: IPerformerPreviewData;
loading?: boolean;
loadingText?: string;
cardExtras?: React.ReactNode;
@ -51,7 +46,6 @@ const PerformerPopoverCardByID: React.FC<{
export const PerformerPopoverCard: React.FC<IPeromerPopoverCardProps> = ({
id,
cardContent,
previewData,
loading,
loadingText = "",
cardExtras,
@ -65,16 +59,12 @@ export const PerformerPopoverCard: React.FC<IPeromerPopoverCardProps> = ({
);
}
if (previewData || loading) {
if (loading) {
return (
<>
{previewData ? (
<PerformerPreviewCard {...previewData} />
) : (
<div className="tag-popover-card performer-preview-popover p-3">
{loading ? loadingText : null}
</div>
)}
<div className="tag-popover-card performer-preview-popover p-3">
{loadingText}
</div>
{cardExtras}
</>
);
@ -87,7 +77,6 @@ export const PerformerPopoverCard: React.FC<IPeromerPopoverCardProps> = ({
interface IPeroformerPopoverProps {
id?: string;
cardContent?: React.ReactNode;
previewData?: IPerformerPreviewData;
loading?: boolean;
loadingText?: string;
cardExtras?: React.ReactNode;
@ -104,7 +93,6 @@ interface IPeroformerPopoverProps {
export const PerformerPopover: React.FC<IPeroformerPopoverProps> = ({
id,
cardContent,
previewData,
loading,
loadingText,
cardExtras,
@ -139,7 +127,6 @@ export const PerformerPopover: React.FC<IPeroformerPopoverProps> = ({
<PerformerPopoverCard
id={id}
cardContent={cardContent}
previewData={previewData}
loading={loading}
loadingText={loadingText}
cardExtras={cardExtras}

View file

@ -1,55 +0,0 @@
import * as GQL from "src/core/generated-graphql";
import { CountryFlag } from "src/components/Shared/CountryFlag";
import GenderIcon from "./GenderIcon";
export interface IPerformerPreviewData {
name: string;
image?: string | null;
country?: string | null;
gender?: GQL.Maybe<GQL.GenderEnum>;
disambiguation?: string | null;
ageString?: string | null;
}
export const PerformerPreviewCard = ({
name,
image,
country,
gender,
disambiguation,
ageString,
}: IPerformerPreviewData) => (
<div className="tag-popover-card performer-preview-popover">
<div className="card performer-card zoom-0">
<div className="thumbnail-section">
<img
loading="lazy"
className="performer-card-image"
alt={name}
src={image ?? ""}
/>
{country && (
<CountryFlag
className="performer-card__country-flag"
country={country}
includeOverlay
/>
)}
</div>
<div className="card-section">
<div className="performer-card__title">
<GenderIcon className="gender-icon" gender={gender} />
<span className="performer-name">{name}</span>
{disambiguation && (
<span className="performer-disambiguation">
{` (${disambiguation})`}
</span>
)}
</div>
{ageString ? (
<div className="performer-card__age">{ageString}</div>
) : null}
</div>
</div>
</div>
);