mirror of https://github.com/stashapp/stash.git
[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
|
@ -148,7 +148,6 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
|
|||
handyKey := config.GetHandyKey()
|
||||
scriptOffset := config.GetFunscriptOffset()
|
||||
imageLightboxOptions := config.GetImageLightboxOptions()
|
||||
|
||||
// FIXME - misnamed output field means we have redundant fields
|
||||
disableDropdownCreate := config.GetDisableDropdownCreate()
|
||||
|
||||
|
|
|
@ -39,9 +39,14 @@ const allMenuItems = [
|
|||
export const SettingsInterfacePanel: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
|
||||
const { interface: iface, saveInterface, loading, error } = React.useContext(
|
||||
SettingStateContext
|
||||
);
|
||||
const {
|
||||
interface: iface,
|
||||
saveInterface,
|
||||
ui,
|
||||
saveUI,
|
||||
loading,
|
||||
error,
|
||||
} = React.useContext(SettingStateContext);
|
||||
|
||||
const {
|
||||
interactive,
|
||||
|
@ -241,6 +246,24 @@ export const SettingsInterfacePanel: React.FC = () => {
|
|||
}}
|
||||
/>
|
||||
</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">
|
||||
<NumberSetting
|
||||
|
|
|
@ -45,7 +45,7 @@ export interface ISettingsContextState {
|
|||
saveDefaults: (input: Partial<GQL.ConfigDefaultSettingsInput>) => void;
|
||||
saveScraping: (input: Partial<GQL.ConfigScrapingInput>) => void;
|
||||
saveDLNA: (input: Partial<GQL.ConfigDlnaInput>) => void;
|
||||
saveUI: (input: IUIConfig) => void;
|
||||
saveUI: (input: Partial<IUIConfig>) => void;
|
||||
}
|
||||
|
||||
export const SettingStateContext = React.createContext<ISettingsContextState>({
|
||||
|
@ -443,7 +443,11 @@ export const SettingsContext: React.FC = ({ children }) => {
|
|||
|
||||
setPendingUI((current) => {
|
||||
if (!current) {
|
||||
return input;
|
||||
// use full UI object to ensure nothing is wiped
|
||||
return {
|
||||
...ui,
|
||||
...input,
|
||||
};
|
||||
}
|
||||
return {
|
||||
...current,
|
||||
|
|
|
@ -28,6 +28,8 @@ export type FrontPageContent = ISavedFilterRow | ICustomFilter;
|
|||
export interface IUIConfig {
|
||||
frontPageContent?: FrontPageContent[];
|
||||
lastNoteSeen?: number;
|
||||
showChildTagContent?: boolean;
|
||||
showChildStudioContent?: boolean;
|
||||
}
|
||||
|
||||
function recentlyReleased(
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import * as GQL from "src/core/generated-graphql";
|
||||
import { StudiosCriterion } from "src/models/list-filter/criteria/studios";
|
||||
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) => {
|
||||
return (filter: ListFilterModel) => {
|
||||
const studioValue = { id: studio.id, label: studio.name };
|
||||
const config = React.useContext(ConfigurationContext);
|
||||
// if studio is already present, then we modify it, otherwise add
|
||||
let studioCriterion = filter.criteria.find((c) => {
|
||||
return c.criterionOption.type === "studios";
|
||||
|
@ -28,7 +32,9 @@ export const studioFilterHook = (studio: GQL.StudioDataFragment) => {
|
|||
studioCriterion = new StudiosCriterion();
|
||||
studioCriterion.value = {
|
||||
items: [studioValue],
|
||||
depth: 0,
|
||||
depth: (config?.configuration?.ui as IUIConfig)?.showChildStudioContent
|
||||
? -1
|
||||
: 0,
|
||||
};
|
||||
filter.criteria.push(studioCriterion);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,13 @@ import {
|
|||
TagsCriterionOption,
|
||||
} from "src/models/list-filter/criteria/tags";
|
||||
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) => {
|
||||
return (filter: ListFilterModel) => {
|
||||
const config = React.useContext(ConfigurationContext);
|
||||
const tagValue = { id: tag.id, label: tag.name };
|
||||
// if tag is already present, then we modify it, otherwise add
|
||||
let tagCriterion = filter.criteria.find((c) => {
|
||||
|
@ -35,7 +39,9 @@ export const tagFilterHook = (tag: GQL.TagDataFragment) => {
|
|||
tagCriterion = new TagsCriterion(TagsCriterionOption);
|
||||
tagCriterion.value = {
|
||||
items: [tagValue],
|
||||
depth: 0,
|
||||
depth: (config?.configuration?.ui as IUIConfig)?.showChildTagContent
|
||||
? -1
|
||||
: 0,
|
||||
};
|
||||
filter.criteria.push(tagCriterion);
|
||||
}
|
||||
|
|
|
@ -553,6 +553,24 @@
|
|||
"description": "Slideshow is available in galleries when in wall view mode",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue