[Feature] Config option for sub content display (#2832)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
HijackHornet
2022-09-30 03:28:47 +02:00
committed by GitHub
parent c63c06de1c
commit b588597f3e
7 changed files with 66 additions and 8 deletions

View File

@@ -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

View File

@@ -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,