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 {ModalGlobalSettingsEditor} from "tc-shared/ui/modal/global-settings-editor/Renderer";
|
||||||
import {Registry} from "tc-shared/events";
|
import {Registry} from "tc-shared/events";
|
||||||
import {ModalGlobalSettingsEditorEvents, Setting} from "tc-shared/ui/modal/global-settings-editor/Definitions";
|
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() {
|
export function spawnGlobalSettingsEditor() {
|
||||||
const events = new Registry<ModalGlobalSettingsEditorEvents>();
|
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);
|
const setting = Settings.KEYS.map(setting => Settings[setting] as SettingsKey<ConfigValueTypes>).find(e => e.key === event.setting);
|
||||||
if(typeof setting === "undefined") {
|
if(typeof setting === "undefined") {
|
||||||
events.fire("notify_setting", {
|
events.fire("notify_setting", {
|
||||||
key: event.setting,
|
setting: event.setting,
|
||||||
status: "not-found"
|
status: "not-found"
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -56,7 +56,7 @@ function initializeController(events: Registry<ModalGlobalSettingsEditorEvents>)
|
||||||
type: setting.valueType,
|
type: setting.valueType,
|
||||||
defaultValue: setting.defaultValue
|
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 {
|
export interface Setting {
|
||||||
key: string;
|
key: string;
|
||||||
|
|
||||||
type: ConfigValueTypeNames;
|
type: ConfigValueTypeNames;
|
||||||
|
|
||||||
description: string | undefined;
|
description: string | undefined;
|
||||||
defaultValue: string | undefined;
|
defaultValue: any | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModalGlobalSettingsEditorEvents {
|
export interface ModalGlobalSettingsEditorEvents {
|
||||||
|
|
|
@ -22,8 +22,8 @@ const SettingEditor = () => {
|
||||||
|
|
||||||
const [ isApplying, setApplying ] = useState(false);
|
const [ isApplying, setApplying ] = useState(false);
|
||||||
const [ currentValue, setCurrentValue ] = useState<string>();
|
const [ currentValue, setCurrentValue ] = useState<string>();
|
||||||
const [ currentSetting, setCurrentSetting ] = useState<Setting | "not-found">(false);
|
const [ currentSetting, setCurrentSetting ] = useState<Setting | "not-found">(undefined);
|
||||||
const currentSettingKey = useRef();
|
const currentSettingKey = useRef<string>();
|
||||||
|
|
||||||
events.reactUse("notify_selected_setting", event => {
|
events.reactUse("notify_selected_setting", event => {
|
||||||
if(event.setting === currentSettingKey.current) {
|
if(event.setting === currentSettingKey.current) {
|
||||||
|
|
Loading…
Reference in New Issue