diff --git a/shared/js/ui/modal/echo-test/Controller.tsx b/shared/js/ui/modal/echo-test/Controller.tsx index d4d5d8f1..3451dd8f 100644 --- a/shared/js/ui/modal/echo-test/Controller.tsx +++ b/shared/js/ui/modal/echo-test/Controller.tsx @@ -1,8 +1,5 @@ -import {spawnReactModal} from "tc-shared/ui/react-elements/Modal"; -import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controller"; +import {spawnModal} from "tc-shared/ui/react-elements/Modal"; import * as React from "react"; -import {Translatable} from "tc-shared/ui/react-elements/i18n"; -import {EchoTestEventRegistry, EchoTestModal} from "tc-shared/ui/modal/echo-test/Renderer"; import {Registry} from "tc-shared/events"; import {EchoTestEvents, TestState} from "tc-shared/ui/modal/echo-test/Definitions"; import {ConnectionHandler} from "tc-shared/ConnectionHandler"; @@ -18,30 +15,13 @@ export function spawnEchoTestModal(connection: ConnectionHandler) { initializeController(connection, events); - const modal = spawnReactModal(class extends InternalModal { - constructor() { - super(); - } - - renderBody(): React.ReactElement { - return ( - - - - ); - } - - renderTitle(): string | React.ReactElement { - return Voice echo test; - } - }); - + const modal = spawnModal("echo-test", [ events.generateIpcDescription() ], { popedOut: false }); events.on("action_close", () => { modal.destroy(); }); - modal.events.on("close", () => events.fire_react("notify_close")); - modal.events.on("destroy", () => { + modal.getEvents().on("close", () => events.fire_react("notify_close")); + modal.getEvents().on("destroy", () => { events.fire("notify_destroy"); events.destroy(); }); diff --git a/shared/js/ui/modal/echo-test/Renderer.tsx b/shared/js/ui/modal/echo-test/Renderer.tsx index febcfd94..6ed9af4c 100644 --- a/shared/js/ui/modal/echo-test/Renderer.tsx +++ b/shared/js/ui/modal/echo-test/Renderer.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import {useContext, useState} from "react"; -import {Registry} from "tc-shared/events"; +import {IpcRegistryDescription, Registry} from "tc-shared/events"; import {EchoTestEvents, TestState, VoiceConnectionState} from "./Definitions"; import {Translatable, VariadicTranslatable} from "tc-shared/ui/react-elements/i18n"; import {ClientIcon} from "svg-sprites/client-icons"; @@ -8,10 +8,11 @@ import {ClientIconRenderer} from "tc-shared/ui/react-elements/Icons"; import {Checkbox} from "tc-shared/ui/react-elements/Checkbox"; import {Button} from "tc-shared/ui/react-elements/Button"; import {LoadingDots} from "tc-shared/ui/react-elements/LoadingDots"; +import {AbstractModal} from "tc-shared/ui/react-elements/modal/Definitions"; const cssStyle = require("./Renderer.scss"); -export const EchoTestEventRegistry = React.createContext>(undefined); +const EchoTestEventRegistry = React.createContext>(undefined); const VoiceStateOverlay = () => { const events = useContext(EchoTestEventRegistry); @@ -235,7 +236,7 @@ const TroubleshootingSoundOverlay = () => { ) } -export const TestToggle = () => { +const TestToggle = () => { const events = useContext(EchoTestEventRegistry); const [state, setState] = useState<"loading" | boolean>(() => { @@ -255,7 +256,7 @@ export const TestToggle = () => { ) } -export const EchoTestModal = () => { +const EchoTestModalRenderer = () => { const events = useContext(EchoTestEventRegistry); return ( @@ -290,4 +291,28 @@ export const EchoTestModal = () => { ); -}; \ No newline at end of file +}; + +class ModalEchoTest extends AbstractModal { + private readonly events: Registry; + + constructor(events: IpcRegistryDescription) { + super(); + + this.events = Registry.fromIpcDescription(events); + } + + renderBody(): React.ReactElement { + return ( + + + + ); + } + + renderTitle(): string | React.ReactElement { + return Voice echo test; + } +} + +export = ModalEchoTest; \ No newline at end of file diff --git a/shared/js/ui/react-elements/external-modal/PopoutRenderer.scss b/shared/js/ui/react-elements/external-modal/PopoutRenderer.scss index 818cf393..6cb15278 100644 --- a/shared/js/ui/react-elements/external-modal/PopoutRenderer.scss +++ b/shared/js/ui/react-elements/external-modal/PopoutRenderer.scss @@ -13,7 +13,8 @@ html, body { height: 100vh; width: 100vw; - background: #212529; + background: #19191b; + color: #999; } .container { diff --git a/shared/js/ui/react-elements/modal/Definitions.ts b/shared/js/ui/react-elements/modal/Definitions.ts index 541d503a..8141f328 100644 --- a/shared/js/ui/react-elements/modal/Definitions.ts +++ b/shared/js/ui/react-elements/modal/Definitions.ts @@ -3,6 +3,7 @@ import {VideoViewerEvents} from "tc-shared/video-viewer/Definitions"; 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"; export type ModalType = "error" | "warning" | "info" | "none"; @@ -112,6 +113,9 @@ export interface ModalConstructorArguments { /* events */ IpcRegistryDescription, /* isChannelCreate */ boolean ], + "echo-test": [ + /* events */ IpcRegistryDescription + ], "conversation": any, "css-editor": any, "channel-tree": any, diff --git a/shared/js/ui/react-elements/modal/Registry.ts b/shared/js/ui/react-elements/modal/Registry.ts index 5f4ae90f..e799a520 100644 --- a/shared/js/ui/react-elements/modal/Registry.ts +++ b/shared/js/ui/react-elements/modal/Registry.ts @@ -28,7 +28,13 @@ registerModal({ registerModal({ modalId: "channel-edit", classLoader: async () => await import("tc-shared/ui/modal/channel-edit/Renderer"), - popoutSupported: true + popoutSupported: false /* TODO: Needs style fixing */ +}); + +registerModal({ + modalId: "echo-test", + classLoader: async () => await import("tc-shared/ui/modal/echo-test/Renderer"), + popoutSupported: false /* TODO: Needs style fixing */ }); registerModal({