swap to UIConfig

This commit is contained in:
Gykes 2026-04-26 16:26:29 -07:00
parent 9aac8b30ad
commit d421948e0a
9 changed files with 16 additions and 36 deletions

View file

@ -428,9 +428,6 @@ input ConfigInterfaceInput {
"Set to true to disable creating new objects via the dropdown menus"
disableDropdownCreate: ConfigDisableDropdownCreateInput
"Set to true to skip the auto tag confirmation warning"
disableAutoTagWarning: Boolean
"Handy Connection Key"
handyKey: String
"Funscript Time Offset"
@ -508,9 +505,6 @@ type ConfigInterfaceResult {
"Fields are true if creating via dropdown menus are disabled"
disableDropdownCreate: ConfigDisableDropdownCreate!
"True if the auto tag confirmation warning should be skipped"
disableAutoTagWarning: Boolean
"Handy Connection Key"
handyKey: String
"Funscript Time Offset"

View file

@ -538,8 +538,6 @@ func (r *mutationResolver) ConfigureInterface(ctx context.Context, input ConfigI
r.setConfigBool(config.DisableDropdownCreateGallery, ddc.Gallery)
}
r.setConfigBool(config.DisableAutoTagWarning, input.DisableAutoTagWarning)
r.setConfigString(config.HandyKey, input.HandyKey)
r.setConfigInt(config.FunscriptOffset, input.FunscriptOffset)
r.setConfigBool(config.UseStashHostedFunscript, input.UseStashHostedFunscript)

View file

@ -168,7 +168,6 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
useStashHostedFunscript := config.GetUseStashHostedFunscript()
imageLightboxOptions := config.GetImageLightboxOptions()
disableDropdownCreate := config.GetDisableDropdownCreate()
disableAutoTagWarning := config.GetDisableAutoTagWarning()
return &ConfigInterfaceResult{
SfwContentMode: config.GetSFWContentMode(),
@ -197,8 +196,6 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
DisableDropdownCreate: disableDropdownCreate,
DisableAutoTagWarning: &disableAutoTagWarning,
HandyKey: &handyKey,
FunscriptOffset: &scriptOffset,
UseStashHostedFunscript: &useStashHostedFunscript,

View file

@ -237,8 +237,6 @@ const (
DisableDropdownCreateMovie = "disable_dropdown_create.movie"
DisableDropdownCreateGallery = "disable_dropdown_create.gallery"
DisableAutoTagWarning = "auto_tag.disable_warning"
HandyKey = "handy_key"
FunscriptOffset = "funscript_offset"
UseStashHostedFunscript = "use_stash_hosted_funscript"
@ -1313,10 +1311,6 @@ func (i *Config) GetShowStudioAsText() bool {
return i.getBool(ShowStudioAsText)
}
func (i *Config) GetDisableAutoTagWarning() bool {
return i.getBool(DisableAutoTagWarning)
}
func (i *Config) getSlideshowDelay() int {
// assume have lock

View file

@ -115,7 +115,6 @@ fragment ConfigInterfaceData on ConfigInterfaceResult {
movie
gallery
}
disableAutoTagWarning
handyKey
funscriptOffset
useStashHostedFunscript

View file

@ -76,13 +76,7 @@ const AutoTagOptions: React.FC<IAutoTagOptions> = ({
export const LibraryTasks: React.FC = () => {
const intl = useIntl();
const Toast = useToast();
const {
ui,
saveUI,
interface: iface,
saveInterface,
loading,
} = useSettings();
const { ui, saveUI, loading } = useSettings();
const { taskDefaults } = ui;
@ -205,7 +199,7 @@ export const LibraryTasks: React.FC = () => {
const onAutoTagClick = useAutoTagTrigger(
() => runAutoTag(),
() => setDialogOpen({ autoTagAlert: true }),
iface.disableAutoTagWarning
ui.disableAutoTagWarning
);
function renderScanDialog() {
@ -485,8 +479,8 @@ export const LibraryTasks: React.FC = () => {
id="disable_auto_tag_warning"
headingID="config.tasks.auto_tag.disable_warning.heading"
subHeadingID="config.tasks.auto_tag.disable_warning.description"
checked={iface.disableAutoTagWarning ?? undefined}
onChange={(v) => saveInterface({ disableAutoTagWarning: v })}
checked={ui.disableAutoTagWarning ?? undefined}
onChange={(v) => saveUI({ disableAutoTagWarning: v })}
/>
</SettingGroup>
</SettingSection>

View file

@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from "react";
import { Form } from "react-bootstrap";
import { FormattedMessage, useIntl } from "react-intl";
import { faExclamationTriangle } from "@fortawesome/free-solid-svg-icons";
import { useConfigureInterface } from "src/core/StashService";
import { useConfigureUISetting } from "src/core/StashService";
import { SettingStateContext } from "src/components/Settings/context";
import { useToast } from "src/hooks/Toast";
import { ModalComponent } from "./Modal";
@ -37,7 +37,7 @@ export const AutoTagConfirmDialog: React.FC<IAutoTagConfirmDialog> = ({
const intl = useIntl();
const Toast = useToast();
const [dontShowAgain, setDontShowAgain] = useState(false);
const [configureInterface] = useConfigureInterface();
const [saveUISetting] = useConfigureUISetting();
const settingsContext = useContext(SettingStateContext);
useEffect(() => {
@ -49,11 +49,11 @@ export const AutoTagConfirmDialog: React.FC<IAutoTagConfirmDialog> = ({
function handleConfirm() {
if (dontShowAgain) {
if (settingsContext) {
settingsContext.saveInterface({ disableAutoTagWarning: true });
settingsContext.saveUI({ disableAutoTagWarning: true });
} else {
configureInterface({
variables: { input: { disableAutoTagWarning: true } },
}).catch((e) => Toast.error(e));
saveUISetting({
variables: { key: "disableAutoTagWarning", value: true },
}).catch((e: unknown) => Toast.error(e));
}
}
onConfirm();

View file

@ -105,6 +105,9 @@ export interface IUIConfig {
taskDefaults?: Record<string, {}>;
// if true the auto tag confirmation warning is skipped
disableAutoTagWarning?: boolean;
defaultFilters?: DefaultFilters;
taggerConfig?: ITaggerConfig;

View file

@ -1,4 +1,5 @@
import { useCallback } from "react";
import { IUIConfig } from "src/core/config";
import { useConfigurationContext } from "./Config";
export function useAutoTagTrigger(
@ -7,8 +8,8 @@ export function useAutoTagTrigger(
override?: boolean | null
) {
const { configuration } = useConfigurationContext();
const disabled =
override ?? configuration?.interface.disableAutoTagWarning ?? false;
const ui = configuration?.ui as IUIConfig | undefined;
const disabled = override ?? ui?.disableAutoTagWarning ?? false;
return useCallback(() => {
if (disabled) {
onRun();