import { SelectTheme } from "./select-theme"; import { SaveOutputFolderToggle } from "./save-output-folder-toggle"; import { InputGpuId } from "./input-gpu-id"; import { CustomModelsFolderSelect } from "./select-custom-models-folder"; import { LogArea } from "./log-area"; import { SelectImageScale } from "./select-image-scale"; import { SelectImageFormat } from "./select-image-format"; import { DonateButton } from "./donate-button"; import React, { useEffect, useState } from "react"; import { themeChange } from "theme-change"; import { useAtom, useAtomValue } from "jotai"; import { customModelsPathAtom, scaleAtom } from "@/atoms/user-settings-atom"; import { customModelIdsAtom } from "@/atoms/models-list-atom"; import useLogger from "@/components/hooks/use-logger"; import { InputCompression } from "./input-compression"; import OverwriteToggle from "./overwrite-toggle"; import { UpscaylCloudModal } from "@/components/upscayl-cloud-modal"; import { ResetSettingsButton } from "./reset-settings-button"; import { FEATURE_FLAGS } from "@common/feature-flags"; import TurnOffNotificationsToggle from "./turn-off-notifications-toggle"; import { cn } from "@/lib/utils"; import { InputCustomResolution } from "./input-custom-resolution"; import { InputTileSize } from "./input-tile-size"; import LanguageSwitcher from "./language-switcher"; import { translationAtom } from "@/atoms/translations-atom"; import { ImageFormat } from "@/lib/valid-formats"; interface IProps { batchMode: boolean; saveImageAs: ImageFormat; setSaveImageAs: React.Dispatch>; compression: number; setCompression: React.Dispatch>; gpuId: string; setGpuId: React.Dispatch>; logData: string[]; show: boolean; setShow: React.Dispatch>; setDontShowCloudModal: React.Dispatch>; } function SettingsTab({ batchMode, compression, setCompression, gpuId, setGpuId, saveImageAs, setSaveImageAs, logData, show, setShow, setDontShowCloudModal, }: IProps) { const [isCopied, setIsCopied] = useState(false); const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom); const [scale, setScale] = useAtom(scaleAtom); const [enableScrollbar, setEnableScrollbar] = useState(true); const [timeoutId, setTimeoutId] = useState(null); const t = useAtomValue(translationAtom); useEffect(() => { themeChange(false); }, []); // HANDLERS const setExportType = (format: ImageFormat) => { setSaveImageAs(format); localStorage.setItem("saveImageAs", format); }; const handleCompressionChange = (e) => { setCompression(e.target.value); }; const handleGpuIdChange = (e) => { setGpuId(e.target.value); localStorage.setItem("gpuId", e.target.value); }; const copyOnClickHandler = () => { navigator.clipboard.writeText(logData.join("\n")); setIsCopied(true); setTimeout(() => { setIsCopied(false); }, 2000); }; const upscaylVersion = navigator?.userAgent?.match( /Upscayl\/([\d\.]+\d+)/, )[1]; function disableScrolling() { if (timeoutId !== null) { clearTimeout(timeoutId); } setTimeoutId( setTimeout(function () { setEnableScrollbar(false); }, 1000), ); } function enableScrolling() { if (timeoutId !== null) { clearTimeout(timeoutId); } setEnableScrollbar(true); } return (
{ if (enableScrollbar) disableScrolling(); }} onWheel={() => { enableScrolling(); }} >

{t("SETTINGS.SUPPORT.TITLE")}

{t("SETTINGS.SUPPORT.DOCS_BUTTON_TITLE")} {FEATURE_FLAGS.APP_STORE_BUILD && ( {t("SETTINGS.SUPPORT.EMAIL_BUTTON_TITLE")} )} {!FEATURE_FLAGS.APP_STORE_BUILD && }
{/* THEME SELECTOR */} {/* IMAGE FORMAT BUTTONS */} {/* IMAGE SCALE */} {/* GPU ID INPUT */} {/* CUSTOM MODEL */} {/* RESET SETTINGS */} {FEATURE_FLAGS.SHOW_UPSCAYL_CLOUD_INFO && ( <> )}
); } export default SettingsTab;