mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
[Feature] Config option for sub content display (#2832)
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
parent
c63c06de1c
commit
b588597f3e
7 changed files with 66 additions and 8 deletions
|
|
@ -148,7 +148,6 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
|
||||||
handyKey := config.GetHandyKey()
|
handyKey := config.GetHandyKey()
|
||||||
scriptOffset := config.GetFunscriptOffset()
|
scriptOffset := config.GetFunscriptOffset()
|
||||||
imageLightboxOptions := config.GetImageLightboxOptions()
|
imageLightboxOptions := config.GetImageLightboxOptions()
|
||||||
|
|
||||||
// FIXME - misnamed output field means we have redundant fields
|
// FIXME - misnamed output field means we have redundant fields
|
||||||
disableDropdownCreate := config.GetDisableDropdownCreate()
|
disableDropdownCreate := config.GetDisableDropdownCreate()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,14 @@ const allMenuItems = [
|
||||||
export const SettingsInterfacePanel: React.FC = () => {
|
export const SettingsInterfacePanel: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const { interface: iface, saveInterface, loading, error } = React.useContext(
|
const {
|
||||||
SettingStateContext
|
interface: iface,
|
||||||
);
|
saveInterface,
|
||||||
|
ui,
|
||||||
|
saveUI,
|
||||||
|
loading,
|
||||||
|
error,
|
||||||
|
} = React.useContext(SettingStateContext);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
interactive,
|
interactive,
|
||||||
|
|
@ -241,6 +246,24 @@ export const SettingsInterfacePanel: React.FC = () => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SettingSection>
|
</SettingSection>
|
||||||
|
<SettingSection headingID="config.ui.tag_panel.heading">
|
||||||
|
<BooleanSetting
|
||||||
|
id="show-child-tagged-content"
|
||||||
|
headingID="config.ui.tag_panel.options.show_child_tagged_content.heading"
|
||||||
|
subHeadingID="config.ui.tag_panel.options.show_child_tagged_content.description"
|
||||||
|
checked={ui.showChildTagContent ?? undefined}
|
||||||
|
onChange={(v) => saveUI({ showChildTagContent: v })}
|
||||||
|
/>
|
||||||
|
</SettingSection>
|
||||||
|
<SettingSection headingID="config.ui.studio_panel.heading">
|
||||||
|
<BooleanSetting
|
||||||
|
id="show-child-studio-content"
|
||||||
|
headingID="config.ui.studio_panel.options.show_child_studio_content.heading"
|
||||||
|
subHeadingID="config.ui.studio_panel.options.show_child_studio_content.description"
|
||||||
|
checked={ui.showChildStudioContent ?? undefined}
|
||||||
|
onChange={(v) => saveUI({ showChildStudioContent: v })}
|
||||||
|
/>
|
||||||
|
</SettingSection>
|
||||||
|
|
||||||
<SettingSection headingID="config.ui.image_lightbox.heading">
|
<SettingSection headingID="config.ui.image_lightbox.heading">
|
||||||
<NumberSetting
|
<NumberSetting
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export interface ISettingsContextState {
|
||||||
saveDefaults: (input: Partial<GQL.ConfigDefaultSettingsInput>) => void;
|
saveDefaults: (input: Partial<GQL.ConfigDefaultSettingsInput>) => void;
|
||||||
saveScraping: (input: Partial<GQL.ConfigScrapingInput>) => void;
|
saveScraping: (input: Partial<GQL.ConfigScrapingInput>) => void;
|
||||||
saveDLNA: (input: Partial<GQL.ConfigDlnaInput>) => void;
|
saveDLNA: (input: Partial<GQL.ConfigDlnaInput>) => void;
|
||||||
saveUI: (input: IUIConfig) => void;
|
saveUI: (input: Partial<IUIConfig>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SettingStateContext = React.createContext<ISettingsContextState>({
|
export const SettingStateContext = React.createContext<ISettingsContextState>({
|
||||||
|
|
@ -443,7 +443,11 @@ export const SettingsContext: React.FC = ({ children }) => {
|
||||||
|
|
||||||
setPendingUI((current) => {
|
setPendingUI((current) => {
|
||||||
if (!current) {
|
if (!current) {
|
||||||
return input;
|
// use full UI object to ensure nothing is wiped
|
||||||
|
return {
|
||||||
|
...ui,
|
||||||
|
...input,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...current,
|
...current,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ export type FrontPageContent = ISavedFilterRow | ICustomFilter;
|
||||||
export interface IUIConfig {
|
export interface IUIConfig {
|
||||||
frontPageContent?: FrontPageContent[];
|
frontPageContent?: FrontPageContent[];
|
||||||
lastNoteSeen?: number;
|
lastNoteSeen?: number;
|
||||||
|
showChildTagContent?: boolean;
|
||||||
|
showChildStudioContent?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function recentlyReleased(
|
function recentlyReleased(
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
import { StudiosCriterion } from "src/models/list-filter/criteria/studios";
|
import { StudiosCriterion } from "src/models/list-filter/criteria/studios";
|
||||||
import { ListFilterModel } from "src/models/list-filter/filter";
|
import { ListFilterModel } from "src/models/list-filter/filter";
|
||||||
|
import React from "react";
|
||||||
|
import { ConfigurationContext } from "src/hooks/Config";
|
||||||
|
import { IUIConfig } from "./config";
|
||||||
|
|
||||||
export const studioFilterHook = (studio: GQL.StudioDataFragment) => {
|
export const studioFilterHook = (studio: GQL.StudioDataFragment) => {
|
||||||
return (filter: ListFilterModel) => {
|
return (filter: ListFilterModel) => {
|
||||||
const studioValue = { id: studio.id, label: studio.name };
|
const studioValue = { id: studio.id, label: studio.name };
|
||||||
|
const config = React.useContext(ConfigurationContext);
|
||||||
// if studio is already present, then we modify it, otherwise add
|
// if studio is already present, then we modify it, otherwise add
|
||||||
let studioCriterion = filter.criteria.find((c) => {
|
let studioCriterion = filter.criteria.find((c) => {
|
||||||
return c.criterionOption.type === "studios";
|
return c.criterionOption.type === "studios";
|
||||||
|
|
@ -28,7 +32,9 @@ export const studioFilterHook = (studio: GQL.StudioDataFragment) => {
|
||||||
studioCriterion = new StudiosCriterion();
|
studioCriterion = new StudiosCriterion();
|
||||||
studioCriterion.value = {
|
studioCriterion.value = {
|
||||||
items: [studioValue],
|
items: [studioValue],
|
||||||
depth: 0,
|
depth: (config?.configuration?.ui as IUIConfig)?.showChildStudioContent
|
||||||
|
? -1
|
||||||
|
: 0,
|
||||||
};
|
};
|
||||||
filter.criteria.push(studioCriterion);
|
filter.criteria.push(studioCriterion);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,13 @@ import {
|
||||||
TagsCriterionOption,
|
TagsCriterionOption,
|
||||||
} from "src/models/list-filter/criteria/tags";
|
} from "src/models/list-filter/criteria/tags";
|
||||||
import { ListFilterModel } from "src/models/list-filter/filter";
|
import { ListFilterModel } from "src/models/list-filter/filter";
|
||||||
|
import React from "react";
|
||||||
|
import { ConfigurationContext } from "src/hooks/Config";
|
||||||
|
import { IUIConfig } from "./config";
|
||||||
|
|
||||||
export const tagFilterHook = (tag: GQL.TagDataFragment) => {
|
export const tagFilterHook = (tag: GQL.TagDataFragment) => {
|
||||||
return (filter: ListFilterModel) => {
|
return (filter: ListFilterModel) => {
|
||||||
|
const config = React.useContext(ConfigurationContext);
|
||||||
const tagValue = { id: tag.id, label: tag.name };
|
const tagValue = { id: tag.id, label: tag.name };
|
||||||
// if tag is already present, then we modify it, otherwise add
|
// if tag is already present, then we modify it, otherwise add
|
||||||
let tagCriterion = filter.criteria.find((c) => {
|
let tagCriterion = filter.criteria.find((c) => {
|
||||||
|
|
@ -35,7 +39,9 @@ export const tagFilterHook = (tag: GQL.TagDataFragment) => {
|
||||||
tagCriterion = new TagsCriterion(TagsCriterionOption);
|
tagCriterion = new TagsCriterion(TagsCriterionOption);
|
||||||
tagCriterion.value = {
|
tagCriterion.value = {
|
||||||
items: [tagValue],
|
items: [tagValue],
|
||||||
depth: 0,
|
depth: (config?.configuration?.ui as IUIConfig)?.showChildTagContent
|
||||||
|
? -1
|
||||||
|
: 0,
|
||||||
};
|
};
|
||||||
filter.criteria.push(tagCriterion);
|
filter.criteria.push(tagCriterion);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -553,6 +553,24 @@
|
||||||
"description": "Slideshow is available in galleries when in wall view mode",
|
"description": "Slideshow is available in galleries when in wall view mode",
|
||||||
"heading": "Slideshow Delay (seconds)"
|
"heading": "Slideshow Delay (seconds)"
|
||||||
},
|
},
|
||||||
|
"tag_panel": {
|
||||||
|
"heading": "Tag view",
|
||||||
|
"options": {
|
||||||
|
"show_child_tagged_content": {
|
||||||
|
"description": "In the tag view, display content from the subtags as well",
|
||||||
|
"heading": "Display subtag content"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"studio_panel": {
|
||||||
|
"heading": "Studio view",
|
||||||
|
"options": {
|
||||||
|
"show_child_studio_content": {
|
||||||
|
"description": "In the studio view, display content from the sub-studios as well",
|
||||||
|
"heading": "Display sub-studios content"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"title": "User Interface"
|
"title": "User Interface"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue