mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add parent/sub-tags to tag cards (#1792)
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
ParentStudiosCriterion,
|
||||
} from "src/models/list-filter/criteria/studios";
|
||||
import {
|
||||
ChildTagsCriterionOption,
|
||||
ParentTagsCriterionOption,
|
||||
TagsCriterion,
|
||||
TagsCriterionOption,
|
||||
} from "src/models/list-filter/criteria/tags";
|
||||
@@ -167,6 +169,40 @@ const makeMovieScenesUrl = (movie: Partial<GQL.MovieDataFragment>) => {
|
||||
return `/scenes?${filter.makeQueryParameters()}`;
|
||||
};
|
||||
|
||||
const makeParentTagsUrl = (tag: Partial<GQL.TagDataFragment>) => {
|
||||
if (!tag.id) return "#";
|
||||
const filter = new ListFilterModel(GQL.FilterMode.Tags);
|
||||
const criterion = new TagsCriterion(ChildTagsCriterionOption);
|
||||
criterion.value = {
|
||||
items: [
|
||||
{
|
||||
id: tag.id,
|
||||
label: tag.name || `Tag ${tag.id}`,
|
||||
},
|
||||
],
|
||||
depth: 0,
|
||||
};
|
||||
filter.criteria.push(criterion);
|
||||
return `/tags?${filter.makeQueryParameters()}`;
|
||||
};
|
||||
|
||||
const makeChildTagsUrl = (tag: Partial<GQL.TagDataFragment>) => {
|
||||
if (!tag.id) return "#";
|
||||
const filter = new ListFilterModel(GQL.FilterMode.Tags);
|
||||
const criterion = new TagsCriterion(ParentTagsCriterionOption);
|
||||
criterion.value = {
|
||||
items: [
|
||||
{
|
||||
id: tag.id,
|
||||
label: tag.name || `Tag ${tag.id}`,
|
||||
},
|
||||
],
|
||||
depth: 0,
|
||||
};
|
||||
filter.criteria.push(criterion);
|
||||
return `/tags?${filter.makeQueryParameters()}`;
|
||||
};
|
||||
|
||||
const makeTagScenesUrl = (tag: Partial<GQL.TagDataFragment>) => {
|
||||
if (!tag.id) return "#";
|
||||
const filter = new ListFilterModel(GQL.FilterMode.Scenes);
|
||||
@@ -259,6 +295,8 @@ export default {
|
||||
makeStudioImagesUrl,
|
||||
makeStudioGalleriesUrl,
|
||||
makeStudioMoviesUrl,
|
||||
makeParentTagsUrl,
|
||||
makeChildTagsUrl,
|
||||
makeTagSceneMarkersUrl,
|
||||
makeTagScenesUrl,
|
||||
makeTagPerformersUrl,
|
||||
|
||||
Reference in New Issue
Block a user