import React from 'react'; import { INDEXES } from 'App/constants/zindex'; import { connect } from 'react-redux'; import { Button, Loader, Icon } from 'UI'; import { PlayerContext } from 'App/components/Session/playerContext'; interface Props { userDisplayName: string; getWindowType: () => WindowType | null; } export enum WindowType { Call, Control, Record, } enum Actions { CallEnd, ControlEnd, RecordingEnd, } const WIN_VARIANTS = { [WindowType.Call]: { text: 'to accept the call', icon: 'call' as const, action: Actions.CallEnd, iconColor: 'teal', }, [WindowType.Control]: { text: 'to accept remote control request', icon: 'remote-control' as const, action: Actions.ControlEnd, iconColor: 'teal', }, [WindowType.Record]: { text: 'to accept recording request', icon: 'record-circle' as const, iconColor: 'red', action: Actions.RecordingEnd, } }; function RequestingWindow({ userDisplayName, getWindowType }: Props) { const windowType = getWindowType() if (!windowType) return; const { player } = React.useContext(PlayerContext) const { assistManager: { initiateCallEnd, releaseRemoteControl, stopRecording, } } = player const actions = { [Actions.CallEnd]: initiateCallEnd, [Actions.ControlEnd]: releaseRemoteControl, [Actions.RecordingEnd]: stopRecording, } return (