Fixed small compile errors
parent
2a25d5ae83
commit
7db0d9f492
|
@ -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<ModalGlobalSettingsEditorEvents>();
|
||||
|
@ -41,7 +41,7 @@ function initializeController(events: Registry<ModalGlobalSettingsEditorEvents>)
|
|||
const setting = Settings.KEYS.map(setting => Settings[setting] as SettingsKey<ConfigValueTypes>).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<ModalGlobalSettingsEditorEvents>)
|
|||
type: setting.valueType,
|
||||
defaultValue: setting.defaultValue
|
||||
},
|
||||
value: settings.global(setting)
|
||||
value: settings.global(setting, undefined)
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -22,8 +22,8 @@ const SettingEditor = () => {
|
|||
|
||||
const [ isApplying, setApplying ] = useState(false);
|
||||
const [ currentValue, setCurrentValue ] = useState<string>();
|
||||
const [ currentSetting, setCurrentSetting ] = useState<Setting | "not-found">(false);
|
||||
const currentSettingKey = useRef();
|
||||
const [ currentSetting, setCurrentSetting ] = useState<Setting | "not-found">(undefined);
|
||||
const currentSettingKey = useRef<string>();
|
||||
|
||||
events.reactUse("notify_selected_setting", event => {
|
||||
if(event.setting === currentSettingKey.current) {
|
||||
|
|
Loading…
Reference in New Issue