mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 04:44:28 +01:00
Fix parent/child links on tag pages (#3978)
This commit is contained in:
parent
29fb570582
commit
15f91fda13
3 changed files with 22 additions and 4 deletions
|
|
@ -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>;
|
||||
|
|
@ -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:
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
|
@ -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"
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -373,6 +377,7 @@ const NavUtils = {
|
|||
makeStudioGalleriesUrl,
|
||||
makeStudioMoviesUrl,
|
||||
makeStudioPerformersUrl,
|
||||
makeTagUrl,
|
||||
makeParentTagsUrl,
|
||||
makeChildTagsUrl,
|
||||
makeTagSceneMarkersUrl,
|
||||
|
|
|
|||
Loading…
Reference in a new issue