diff --git a/shared/js/ui/modal/global-settings-editor/Controller.tsx b/shared/js/ui/modal/global-settings-editor/Controller.tsx index 843779c1..5a2924b7 100644 --- a/shared/js/ui/modal/global-settings-editor/Controller.tsx +++ b/shared/js/ui/modal/global-settings-editor/Controller.tsx @@ -2,7 +2,7 @@ import {spawnReactModal} from "tc-shared/ui/react-elements/Modal"; import {ModalGlobalSettingsEditor} from "tc-shared/ui/modal/global-settings-editor/Renderer"; import {Registry} from "tc-shared/events"; import {ModalGlobalSettingsEditorEvents, Setting} from "tc-shared/ui/modal/global-settings-editor/Definitions"; -import {settings, Settings, SettingsKey} from "tc-shared/settings"; +import {ConfigValueTypes, settings, Settings, SettingsKey} from "tc-shared/settings"; export function spawnGlobalSettingsEditor() { const events = new Registry(); @@ -41,7 +41,7 @@ function initializeController(events: Registry) const setting = Settings.KEYS.map(setting => Settings[setting] as SettingsKey).find(e => e.key === event.setting); if(typeof setting === "undefined") { events.fire("notify_setting", { - key: event.setting, + setting: event.setting, status: "not-found" }); return; @@ -56,7 +56,7 @@ function initializeController(events: Registry) type: setting.valueType, defaultValue: setting.defaultValue }, - value: settings.global(setting) + value: settings.global(setting, undefined) }); }); diff --git a/shared/js/ui/modal/global-settings-editor/Definitions.ts b/shared/js/ui/modal/global-settings-editor/Definitions.ts index bde5d3f2..3bc18980 100644 --- a/shared/js/ui/modal/global-settings-editor/Definitions.ts +++ b/shared/js/ui/modal/global-settings-editor/Definitions.ts @@ -1,10 +1,12 @@ +import {ConfigValueTypeNames} from "tc-shared/settings"; + export interface Setting { key: string; type: ConfigValueTypeNames; description: string | undefined; - defaultValue: string | undefined; + defaultValue: any | undefined; } export interface ModalGlobalSettingsEditorEvents { diff --git a/shared/js/ui/modal/global-settings-editor/Renderer.tsx b/shared/js/ui/modal/global-settings-editor/Renderer.tsx index 51f6030a..b498c530 100644 --- a/shared/js/ui/modal/global-settings-editor/Renderer.tsx +++ b/shared/js/ui/modal/global-settings-editor/Renderer.tsx @@ -22,8 +22,8 @@ const SettingEditor = () => { const [ isApplying, setApplying ] = useState(false); const [ currentValue, setCurrentValue ] = useState(); - const [ currentSetting, setCurrentSetting ] = useState(false); - const currentSettingKey = useRef(); + const [ currentSetting, setCurrentSetting ] = useState(undefined); + const currentSettingKey = useRef(); events.reactUse("notify_selected_setting", event => { if(event.setting === currentSettingKey.current) {