Skip to content

Commit

Permalink
Fix parent/child links on tag pages (#3978)
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants authored Aug 1, 2023
1 parent 29fb570 commit 15f91fd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ui/v2.5/src/components/Shared/TagLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type SceneMarkerFragment = Pick<GQL.SceneMarker, "id" | "title" | "seconds"> & {

interface IProps {
tag?: Partial<TagDataFragment>;
tagType?: "performer" | "scene" | "gallery" | "image";
tagType?: "performer" | "scene" | "gallery" | "image" | "details";
performer?: Partial<PerformerDataFragment>;
marker?: SceneMarkerFragment;
movie?: Partial<MovieDataFragment>;
Expand All @@ -49,6 +49,7 @@ export const TagLink: React.FC<IProps> = (props: IProps) => {
let link: string = "#";
let title: string = "";
if (props.tag) {
id = props.tag.id || "";
switch (props.tagType) {
case "scene":
case undefined:
Expand All @@ -63,8 +64,10 @@ export const TagLink: React.FC<IProps> = (props: IProps) => {
case "image":
link = NavUtils.makeTagImagesUrl(props.tag);
break;
case "details":
link = NavUtils.makeTagUrl(id);
break;
}
id = props.tag.id || "";
title = props.tag.name || "";
} else if (props.performer) {
link = NavUtils.makePerformerScenesUrl(props.performer);
Expand Down
14 changes: 12 additions & 2 deletions ui/v2.5/src/components/Tags/TagDetails/TagDetailsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export const TagDetailsPanel: React.FC<ITagDetails> = ({ tag, fullWidth }) => {
return (
<>
{tag.parents.map((p) => (
<TagLink key={p.id} tag={p} hoverPlacement="bottom" />
<TagLink
key={p.id}
tag={p}
hoverPlacement="bottom"
tagType="details"
/>
))}
</>
);
Expand All @@ -31,7 +36,12 @@ export const TagDetailsPanel: React.FC<ITagDetails> = ({ tag, fullWidth }) => {
return (
<>
{tag.children.map((c) => (
<TagLink key={c.id} tag={c} hoverPlacement="bottom" />
<TagLink
key={c.id}
tag={c}
hoverPlacement="bottom"
tagType="details"
/>
))}
</>
);
Expand Down
5 changes: 5 additions & 0 deletions ui/v2.5/src/utils/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ const makeMovieScenesUrl = (movie: Partial<GQL.MovieDataFragment>) => {
return `/scenes?${filter.makeQueryParameters()}`;
};

const makeTagUrl = (id: string) => {
return `/tags/${id}`;
};

const makeParentTagsUrl = (tag: Partial<GQL.TagDataFragment>) => {
if (!tag.id) return "#";
const filter = new ListFilterModel(GQL.FilterMode.Tags, undefined);
Expand Down Expand Up @@ -373,6 +377,7 @@ const NavUtils = {
makeStudioGalleriesUrl,
makeStudioMoviesUrl,
makeStudioPerformersUrl,
makeTagUrl,
makeParentTagsUrl,
makeChildTagsUrl,
makeTagSceneMarkersUrl,
Expand Down

0 comments on commit 15f91fd

Please sign in to comment.