Skip to content

Commit

Permalink
Add linkTypes to performer popover (#5195)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogwithakeyboard authored Sep 5, 2024
1 parent 283f762 commit 879c20e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
7 changes: 6 additions & 1 deletion ui/v2.5/src/components/Galleries/GalleryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ export const GalleryCard: React.FC<IProps> = (props) => {
function maybeRenderPerformerPopoverButton() {
if (props.gallery.performers.length <= 0) return;

return <PerformerPopoverButton performers={props.gallery.performers} />;
return (
<PerformerPopoverButton
performers={props.gallery.performers}
linkType="gallery"
/>
);
}

function maybeRenderImagesPopoverButton() {
Expand Down
7 changes: 6 additions & 1 deletion ui/v2.5/src/components/Images/ImageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ export const ImageCard: React.FC<IImageCardProps> = (
function maybeRenderPerformerPopoverButton() {
if (props.image.performers.length <= 0) return;

return <PerformerPopoverButton performers={props.image.performers} />;
return (
<PerformerPopoverButton
performers={props.image.performers}
linkType="image"
/>
);
}

function maybeRenderOCounter() {
Expand Down
7 changes: 6 additions & 1 deletion ui/v2.5/src/components/Scenes/SceneCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ const SceneCardPopovers = PatchComponent(
function maybeRenderPerformerPopoverButton() {
if (props.scene.performers.length <= 0) return;

return <PerformerPopoverButton performers={props.scene.performers} />;
return (
<PerformerPopoverButton
performers={props.scene.performers}
linkType="scene"
/>
);
}

function maybeRenderGroupPopoverButton() {
Expand Down
9 changes: 7 additions & 2 deletions ui/v2.5/src/components/Shared/PerformerPopoverButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ import * as GQL from "src/core/generated-graphql";
import { sortPerformers } from "src/core/performers";
import { HoverPopover } from "./HoverPopover";
import { Icon } from "./Icon";
import { PerformerLink } from "./TagLink";
import { PerformerLink, PerformerLinkType } from "./TagLink";

interface IProps {
performers: Pick<
GQL.Performer,
"id" | "name" | "image_path" | "disambiguation" | "gender"
>[];
linkType?: PerformerLinkType;
}

export const PerformerPopoverButton: React.FC<IProps> = ({ performers }) => {
export const PerformerPopoverButton: React.FC<IProps> = ({
performers,
linkType,
}) => {
const sorted = sortPerformers(performers);
const popoverContent = sorted.map((performer) => (
<div className="performer-tag-container row" key={performer.id}>
Expand All @@ -33,6 +37,7 @@ export const PerformerPopoverButton: React.FC<IProps> = ({ performers }) => {
key={performer.id}
performer={performer}
className="d-block"
linkType={linkType}
/>
</div>
));
Expand Down
2 changes: 2 additions & 0 deletions ui/v2.5/src/components/Shared/TagLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ interface IPerformerLinkProps {
className?: string;
}

export type PerformerLinkType = IPerformerLinkProps["linkType"];

export const PerformerLink: React.FC<IPerformerLinkProps> = ({
performer,
linkType = "scene",
Expand Down

0 comments on commit 879c20e

Please sign in to comment.