From 7b65531ca7ce27abb203a0ee1775cb8b8b2848e0 Mon Sep 17 00:00:00 2001 From: sylenien Date: Thu, 15 Sep 2022 12:24:16 +0200 Subject: [PATCH] change(ui): add await window for call request --- .../RequestingWindow/RequestingWindow.tsx | 27 +++++++++++++++++++ .../Assist/RequestingWindow/index.ts | 1 + .../AssistActions/AssistActions.tsx | 15 ++++++++--- .../components/Session_/Player/Overlay.tsx | 8 +++++- frontend/app/components/ui/SVG.tsx | 3 ++- frontend/app/constants/zindex.ts | 1 + .../managers/AssistManager.ts | 7 ++++- frontend/app/player/singletone.js | 4 ++- frontend/app/svg/icons/call.svg | 5 ++++ 9 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 frontend/app/components/Assist/RequestingWindow/RequestingWindow.tsx create mode 100644 frontend/app/components/Assist/RequestingWindow/index.ts create mode 100644 frontend/app/svg/icons/call.svg diff --git a/frontend/app/components/Assist/RequestingWindow/RequestingWindow.tsx b/frontend/app/components/Assist/RequestingWindow/RequestingWindow.tsx new file mode 100644 index 000000000..7d6f2c790 --- /dev/null +++ b/frontend/app/components/Assist/RequestingWindow/RequestingWindow.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import { INDEXES } from 'App/constants/zindex' +import { connect } from 'react-redux'; +import { Button, Loader, Icon } from 'UI' +import { initiateCallEnd } from 'Player'; + +interface Props { + userDisplayName: string +} + +function RequestingWindow({ userDisplayName }: Props) { + + return ( +
+
+ + Waiting for + {userDisplayName} + to accept the call + + +
+
+ ) +} + +export default connect((state) => ({ userDisplayName: state.getIn(['sessions', 'current', 'userDisplayName']) }))(RequestingWindow) diff --git a/frontend/app/components/Assist/RequestingWindow/index.ts b/frontend/app/components/Assist/RequestingWindow/index.ts new file mode 100644 index 000000000..9dbd99dfe --- /dev/null +++ b/frontend/app/components/Assist/RequestingWindow/index.ts @@ -0,0 +1 @@ +export { default } from './RequestingWindow' diff --git a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx index 948b86967..58773acaf 100644 --- a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx +++ b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx @@ -54,9 +54,11 @@ function AssistActions({ const [callObject, setCallObject] = useState<{ end: () => void } | null>(null); const onCall = calling === CallingState.OnCall || calling === CallingState.Reconnecting; + const callRequesting = calling === CallingState.Connecting const cannotCall = peerConnectionStatus !== ConnectionStatus.Connected || (isEnterprise && !hasPermission); const remoteActive = remoteControlStatus === RemoteControlStatus.Enabled; + useEffect(() => { return callObject?.end() }, []) @@ -101,6 +103,8 @@ function AssistActions({ }, [agentIds, isCallActive]) const confirmCall = async () => { + if (callRequesting) return; + if ( await confirm({ header: 'Start Call', @@ -112,6 +116,11 @@ function AssistActions({ } }; + const requestControl = () => { + if (callRequesting) return; + requestReleaseRemoteControl() + } + React.useEffect(() => { if (!livePlay) { if (annotating) { @@ -145,8 +154,8 @@ function AssistActions({ )}