Some minor fixes
parent
e28217979d
commit
817fedd00a
|
@ -465,7 +465,7 @@ export function EventHandler<EventTypes>(events: (keyof EventTypes) | (keyof Eve
|
|||
}
|
||||
}
|
||||
|
||||
export function ReactEventHandler<ObjectClass = React.Component<any, any>, Events extends EventMap<Events> = EventMap<any>>(registry_callback: (object: ObjectClass) => Registry<Events>) {
|
||||
export function ReactEventHandler<ObjectClass = React.Component<any, any>, Events = any>(registry_callback: (object: ObjectClass) => Registry<Events>) {
|
||||
return function (constructor: Function) {
|
||||
if(!React.Component.prototype.isPrototypeOf(constructor.prototype))
|
||||
throw "Class/object isn't an instance of React.Component";
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {spawnReactModal} from "tc-shared/ui/react-elements/Modal";
|
||||
import {ModalGlobalSettingsEditor} from "tc-shared/ui/modal/global-settings-editor/Renderer";
|
||||
import {spawnModal} from "tc-shared/ui/react-elements/Modal";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {ModalGlobalSettingsEditorEvents, Setting} from "tc-shared/ui/modal/global-settings-editor/Definitions";
|
||||
import {RegistryKey, RegistryValueType, Settings, settings} from "tc-shared/settings";
|
||||
|
@ -8,9 +7,9 @@ export function spawnGlobalSettingsEditor() {
|
|||
const events = new Registry<ModalGlobalSettingsEditorEvents>();
|
||||
initializeController(events);
|
||||
|
||||
const modal = spawnReactModal(ModalGlobalSettingsEditor, events);
|
||||
const modal = spawnModal("global-settings-editor", [ events.generateIpcDescription() ], { popoutable: true, popedOut: true });
|
||||
modal.show();
|
||||
modal.events.on("destroy", () => {
|
||||
modal.getEvents().on("destroy", () => {
|
||||
events.fire("notify_destroy");
|
||||
events.destroy();
|
||||
});
|
||||
|
|
|
@ -2,10 +2,11 @@ import {Translatable} from "tc-shared/ui/react-elements/i18n";
|
|||
import * as React from "react";
|
||||
import {createContext, useContext, useRef, useState} from "react";
|
||||
import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller";
|
||||
import {Registry} from "tc-shared/events";
|
||||
import {IpcRegistryDescription, Registry} from "tc-shared/events";
|
||||
import {ModalGlobalSettingsEditorEvents, Setting} from "tc-shared/ui/modal/global-settings-editor/Definitions";
|
||||
import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots";
|
||||
import {FlatInputField} from "tc-shared/ui/react-elements/InputField";
|
||||
import {AbstractModal} from "tc-shared/ui/react-elements/modal/Definitions";
|
||||
|
||||
const ModalEvents = createContext<Registry<ModalGlobalSettingsEditorEvents>>(undefined);
|
||||
const cssStyle = require("./Renderer.scss");
|
||||
|
@ -159,13 +160,13 @@ const SettingList = () => {
|
|||
);
|
||||
}
|
||||
|
||||
export class ModalGlobalSettingsEditor extends InternalModal {
|
||||
class ModalGlobalSettingsEditor extends AbstractModal {
|
||||
protected readonly events: Registry<ModalGlobalSettingsEditorEvents>;
|
||||
|
||||
constructor(events: Registry<ModalGlobalSettingsEditorEvents>) {
|
||||
constructor(events: IpcRegistryDescription<ModalGlobalSettingsEditorEvents>) {
|
||||
super();
|
||||
|
||||
this.events = events;
|
||||
this.events = Registry.fromIpcDescription(events);
|
||||
}
|
||||
|
||||
renderBody(): React.ReactElement {
|
||||
|
@ -194,3 +195,4 @@ export class ModalGlobalSettingsEditor extends InternalModal {
|
|||
}
|
||||
}
|
||||
|
||||
export = ModalGlobalSettingsEditor;
|
|
@ -4,6 +4,7 @@ import {ReactElement} from "react";
|
|||
import * as React from "react";
|
||||
import {ChannelEditEvents} from "tc-shared/ui/modal/channel-edit/Definitions";
|
||||
import {EchoTestEvents} from "tc-shared/ui/modal/echo-test/Definitions";
|
||||
import {ModalGlobalSettingsEditorEvents} from "tc-shared/ui/modal/global-settings-editor/Definitions";
|
||||
|
||||
export type ModalType = "error" | "warning" | "info" | "none";
|
||||
|
||||
|
@ -116,6 +117,9 @@ export interface ModalConstructorArguments {
|
|||
"echo-test": [
|
||||
/* events */ IpcRegistryDescription<EchoTestEvents>
|
||||
],
|
||||
"global-settings-editor": [
|
||||
/* events */ IpcRegistryDescription<ModalGlobalSettingsEditorEvents>
|
||||
],
|
||||
"conversation": any,
|
||||
"css-editor": any,
|
||||
"channel-tree": any,
|
||||
|
|
|
@ -37,6 +37,12 @@ registerModal({
|
|||
popoutSupported: false /* TODO: Needs style fixing */
|
||||
});
|
||||
|
||||
registerModal({
|
||||
modalId: "global-settings-editor",
|
||||
classLoader: async () => await import("tc-shared/ui/modal/global-settings-editor/Renderer"),
|
||||
popoutSupported: true
|
||||
});
|
||||
|
||||
registerModal({
|
||||
modalId: "conversation",
|
||||
classLoader: async () => await import("../../frames/side/PopoutConversationRenderer"),
|
||||
|
|
Loading…
Reference in New Issue