From 76261de805284e414ab249ef77d71781af56f49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Tue, 15 Jun 2021 15:16:01 +0200 Subject: [PATCH] Enabling back the open report feature --- front/src/Components/Video/VideoMedia.svelte | 12 ++++++++++-- front/src/Phaser/Menu/MenuScene.ts | 11 +++++++++++ front/src/Stores/ShowReportScreenStore.ts | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 front/src/Stores/ShowReportScreenStore.ts diff --git a/front/src/Components/Video/VideoMedia.svelte b/front/src/Components/Video/VideoMedia.svelte index cbee1644..311d5304 100644 --- a/front/src/Components/Video/VideoMedia.svelte +++ b/front/src/Components/Video/VideoMedia.svelte @@ -6,6 +6,9 @@ import blockSignImg from "./images/blockSign.svg"; import {DivImportance} from "../../WebRtc/LayoutManager"; import {videoFocusStore} from "../../Stores/VideoFocusStore"; + import {EnableCameraScene, EnableCameraSceneName} from "../../Phaser/Login/EnableCameraScene"; + import {MenuScene, MenuSceneName} from "../../Phaser/Menu/MenuScene"; + import {showReportScreenStore} from "../../Stores/ShowReportScreenStore"; export let peer: VideoPeer; let streamStore = peer.streamStore; @@ -43,6 +46,11 @@ } } + function openReport(peer: VideoPeer): void { + console.log('OPENING REPORT'); + showReportScreenStore.set({ userId:peer.userId, userName: peer.userName }); + } +
@@ -58,12 +66,12 @@ {#if $constraintStore && $constraintStore.audio === false} Muted {/if} - - + {#if $constraintStore && $constraintStore.audio !== false} {/if} diff --git a/front/src/Phaser/Menu/MenuScene.ts b/front/src/Phaser/Menu/MenuScene.ts index 54fa395a..01e27c2b 100644 --- a/front/src/Phaser/Menu/MenuScene.ts +++ b/front/src/Phaser/Menu/MenuScene.ts @@ -11,6 +11,7 @@ import {WarningContainer, warningContainerHtml, warningContainerKey} from "../Co import {worldFullWarningStream} from "../../Connexion/WorldFullWarningStream"; import {menuIconVisible} from "../../Stores/MenuStore"; import {videoConstraintStore} from "../../Stores/MediaStore"; +import {showReportScreenStore} from "../../Stores/ShowReportScreenStore"; export const MenuSceneName = 'MenuScene'; const gameMenuKey = 'gameMenu'; @@ -82,6 +83,12 @@ export class MenuScene extends Phaser.Scene { this.closeAll(); this.gameReportElement.open(parseInt(userId), userName); }); + showReportScreenStore.subscribe((user) => { + this.closeAll(); + if (user !== null) { + this.gameReportElement.open(user.userId, user.userName); + } + }); this.input.keyboard.on('keyup-TAB', () => { this.sideMenuOpened ? this.closeSideMenu() : this.openSideMenu(); @@ -98,6 +105,10 @@ export class MenuScene extends Phaser.Scene { worldFullWarningStream.stream.subscribe(() => this.showWorldCapacityWarning()); } + public openReport(userId: number, userName: string): void { + this.gameReportElement.open(userId, userName); + } + //todo put this method in a parent menuElement class static revealMenusAfterInit(menuElement: Phaser.GameObjects.DOMElement, rootDomId: string) { //Dom elements will appear inside the viewer screen when creating before being moved out of it, which create a flicker effect. diff --git a/front/src/Stores/ShowReportScreenStore.ts b/front/src/Stores/ShowReportScreenStore.ts new file mode 100644 index 00000000..f05e545a --- /dev/null +++ b/front/src/Stores/ShowReportScreenStore.ts @@ -0,0 +1,3 @@ +import {writable} from "svelte/store"; + +export const showReportScreenStore = writable<{userId: number, userName: string}|null>(null);