From 9fa6633a1d74647b7bd9e388b65644f30d15a553 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 20 Mar 2021 16:39:50 +0100 Subject: [PATCH] Fixing up the shared content for the native client --- babel.config.ts | 2 +- .../js/ui/react-elements/modal/Controller.ts | 2 ++ .../js/ui/react-elements/modal/Definitions.ts | 3 +++ .../modal/external/Controller.ts | 20 +++++++++++++++++++ .../react-elements/modal/internal/index.tsx | 3 +++ shared/js/video-viewer/Renderer.tsx | 4 ++-- webpack-client.config.ts | 2 +- webpack-web.config.ts | 2 +- webpack.config.ts | 2 +- 9 files changed, 34 insertions(+), 6 deletions(-) diff --git a/babel.config.ts b/babel.config.ts index bdcb598f..952ab4b6 100644 --- a/babel.config.ts +++ b/babel.config.ts @@ -1,4 +1,4 @@ -export = api => { +export default api => { api.cache(false); const presets = [ [ diff --git a/shared/js/ui/react-elements/modal/Controller.ts b/shared/js/ui/react-elements/modal/Controller.ts index 12459d08..3597fc73 100644 --- a/shared/js/ui/react-elements/modal/Controller.ts +++ b/shared/js/ui/react-elements/modal/Controller.ts @@ -83,6 +83,8 @@ export class GenericModalController i }); events.on("action_close", () => this.destroy()); + events.on("action_minimize", () => this.instance.minimize()); + events.on("action_popout", () => { if(!this.popedOut) { if(!this.getModalClass().popoutSupported) { diff --git a/shared/js/ui/react-elements/modal/Definitions.ts b/shared/js/ui/react-elements/modal/Definitions.ts index 231a6b4b..f4f00445 100644 --- a/shared/js/ui/react-elements/modal/Definitions.ts +++ b/shared/js/ui/react-elements/modal/Definitions.ts @@ -88,6 +88,9 @@ export interface ModalInstanceController { show() : Promise; hide() : Promise; + minimize() : Promise; + maximize() : Promise; + destroy(); } diff --git a/shared/js/ui/react-elements/modal/external/Controller.ts b/shared/js/ui/react-elements/modal/external/Controller.ts index cbcd47c4..fad69437 100644 --- a/shared/js/ui/react-elements/modal/external/Controller.ts +++ b/shared/js/ui/react-elements/modal/external/Controller.ts @@ -172,6 +172,26 @@ export class ExternalModalController implements ModalInstanceController { }); } + async minimize(): Promise { + await this.mutateWindow(async () => { + if (typeof this.windowId !== "string") { + return; + } + + await getWindowManager().executeAction(this.windowId, "minimize"); + }); + } + + async maximize(): Promise { + await this.mutateWindow(async () => { + if (typeof this.windowId !== "string") { + return; + } + + await getWindowManager().executeAction(this.windowId, "maximize"); + }); + } + private async mutateWindow(callback: () => Promise) : Promise { while(this.windowMutatePromise) { await this.windowMutatePromise; diff --git a/shared/js/ui/react-elements/modal/internal/index.tsx b/shared/js/ui/react-elements/modal/internal/index.tsx index ed7e1c5f..8627e6f9 100644 --- a/shared/js/ui/react-elements/modal/internal/index.tsx +++ b/shared/js/ui/react-elements/modal/internal/index.tsx @@ -145,6 +145,9 @@ export class InternalModalInstance implements ModalInstanceController { this.events.fire("notify_close"); } + async minimize(): Promise { } + async maximize(): Promise { } + destroy() { this.destructModal(); this.events.destroy(); diff --git a/shared/js/video-viewer/Renderer.tsx b/shared/js/video-viewer/Renderer.tsx index c803065a..9478596f 100644 --- a/shared/js/video-viewer/Renderer.tsx +++ b/shared/js/video-viewer/Renderer.tsx @@ -479,9 +479,9 @@ const TitleRenderer = (props: { events: Registry }) => { }); if(followId && followingName) { - return W2G - Following {followingName}; + return W2G - Following {followingName}; } else { - return W2G - Watcher; + return W2G - Watcher; } }; diff --git a/webpack-client.config.ts b/webpack-client.config.ts index c88970f8..d451f594 100644 --- a/webpack-client.config.ts +++ b/webpack-client.config.ts @@ -3,7 +3,7 @@ import * as config_base from "./webpack.config"; export = env => config_base.config(env, "client").then(config => { Object.assign(config.entry, { - "shared-app": ["./client/app/entry-points/AppMain.ts"], + "main-app": ["./client/app/entry-points/AppMain.ts"], "modal-external": ["./client/app/entry-points/ModalWindow.ts"] }); diff --git a/webpack-web.config.ts b/webpack-web.config.ts index cfe0cdfc..1ae8ff87 100644 --- a/webpack-web.config.ts +++ b/webpack-web.config.ts @@ -3,7 +3,7 @@ import * as config_base from "./webpack.config"; export = env => config_base.config(env, "web").then(config => { Object.assign(config.entry, { - "shared-app": ["./web/app/entry-points/AppMain.ts"], + "main-app": ["./web/app/entry-points/AppMain.ts"], "modal-external": ["./web/app/entry-points/ModalWindow.ts"] }); diff --git a/webpack.config.ts b/webpack.config.ts index 959c4439..be9b04ef 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -76,7 +76,7 @@ const generateDefinitions = async (target: string) => { mode: JSON.stringify(isDevelopment ? "debug" : "release"), version: JSON.stringify(localBuildInfo.gitVersion), timestamp: localBuildInfo.gitTimestamp, - entry_chunk_name: JSON.stringify(target === "web" ? "shared-app" : "client-app") + entry_chunk_name: JSON.stringify("main-app") } as BuildDefinitions } as any; };