From 9a35dcbc3e4b3e227ead00c37d1ffbb4049ecd87 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 21 Apr 2022 18:49:09 +0200 Subject: [PATCH] feat(ui) - toggle annotation manually --- .../AssistActions/AassistActions.css | 7 +++++ .../AssistActions/AssistActions.tsx | 26 ++++++++++++++++--- .../components/Session_/playerBlockHeader.css | 2 +- .../managers/AssistManager.ts | 6 ++--- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/frontend/app/components/Assist/components/AssistActions/AassistActions.css b/frontend/app/components/Assist/components/AssistActions/AassistActions.css index 8a5758d90..77d9b7c81 100644 --- a/frontend/app/components/Assist/components/AssistActions/AassistActions.css +++ b/frontend/app/components/Assist/components/AssistActions/AassistActions.css @@ -2,3 +2,10 @@ opacity: 0.5; pointer-events: none; } + +.divider { + width: 1px; + height: 49px; + margin: 0 10px; + background-color: $gray-light; +} \ No newline at end of file diff --git a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx index 58eadd472..75a770b51 100644 --- a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx +++ b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx @@ -5,7 +5,7 @@ import cn from 'classnames' import { toggleChatWindow } from 'Duck/sessions'; import { connectPlayer } from 'Player/store'; import ChatWindow from '../../ChatWindow'; -import { callPeer, requestReleaseRemoteControl } from 'Player' +import { callPeer, requestReleaseRemoteControl, toggleAnnotation } from 'Player' import { CallingState, ConnectionStatus, RemoteControlStatus } from 'Player/MessageDistributor/managers/AssistManager'; import RequestLocalStream from 'Player/MessageDistributor/managers/LocalStream'; import type { LocalStream } from 'Player/MessageDistributor/managers/LocalStream'; @@ -31,13 +31,14 @@ interface Props { userId: String, toggleChatWindow: (state) => void, calling: CallingState, + annotating: boolean, peerConnectionStatus: ConnectionStatus, remoteControlStatus: RemoteControlStatus, hasPermission: boolean, isEnterprise: boolean, } -function AssistActions({ toggleChatWindow, userId, calling, peerConnectionStatus, remoteControlStatus, hasPermission, isEnterprise }: Props) { +function AssistActions({ toggleChatWindow, userId, calling, annotating, peerConnectionStatus, remoteControlStatus, hasPermission, isEnterprise }: Props) { const [ incomeStream, setIncomeStream ] = useState(null); const [ localStream, setLocalStream ] = useState(null); const [ callObject, setCallObject ] = useState<{ end: ()=>void } | null >(null); @@ -81,6 +82,23 @@ function AssistActions({ toggleChatWindow, userId, calling, peerConnectionStatus return (
+ {onCall && ( + <> +
+ +
+
+ + )}
- +
+
{ export default con(connectPlayer(state => ({ calling: state.calling, + annotating: state.annotating, remoteControlStatus: state.remoteControl, peerConnectionStatus: state.peerConnectionStatus, }))(AssistActions)) diff --git a/frontend/app/components/Session_/playerBlockHeader.css b/frontend/app/components/Session_/playerBlockHeader.css index 3aa858053..bec261a1d 100644 --- a/frontend/app/components/Session_/playerBlockHeader.css +++ b/frontend/app/components/Session_/playerBlockHeader.css @@ -8,7 +8,7 @@ .divider { width: 1px; height: 49px; - margin: 0 15px; + margin: 0 10px; background-color: $gray-light; } diff --git a/frontend/app/player/MessageDistributor/managers/AssistManager.ts b/frontend/app/player/MessageDistributor/managers/AssistManager.ts index 892054cc4..0cd752f1d 100644 --- a/frontend/app/player/MessageDistributor/managers/AssistManager.ts +++ b/frontend/app/player/MessageDistributor/managers/AssistManager.ts @@ -323,7 +323,7 @@ export default class AssistManager { private handleCallEnd() { this.callArgs && this.callArgs.onCallEnd() this.callConnection && this.callConnection.close() - update({ calling: CallingState.NoCall }) + update({ calling: CallingState.NoCall, annotating: false }) this.callArgs = null this.annot?.remove() this.annot = null @@ -377,7 +377,7 @@ export default class AssistManager { if (typeof enable !== "boolean") { enable = !!getState().annotating } - if (enable && !this.annot) { + if (!enable && !this.annot) { const annot = this.annot = new AnnotationCanvas() annot.mount(this.md.overlay) annot.canvas.addEventListener("mousedown", e => { @@ -404,7 +404,7 @@ export default class AssistManager { this.socket.emit("moveAnnotation", [ data.x, data.y ]) }) update({ annotating: true }) - } else if (!enable && !!this.annot) { + } else if (enable && !!this.annot) { this.annot.remove() this.annot = null update({ annotating: false })