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; type: WindowType; } export enum WindowType { Call, Control, } enum Actions { CallEnd, ControlEnd } const WIN_VARIANTS = { [WindowType.Call]: { text: 'to accept the call', icon: 'call' as const, action: Actions.CallEnd, }, [WindowType.Control]: { text: 'to accept remote control request', icon: 'remote-control' as const, action: Actions.ControlEnd, }, }; function RequestingWindow({ userDisplayName, type }: Props) { const { player } = React.useContext(PlayerContext) const { assistManager: { initiateCallEnd, releaseRemoteControl, } } = player const actions = { [Actions.CallEnd]: initiateCallEnd, [Actions.ControlEnd]: releaseRemoteControl } return (
Waiting for {userDisplayName}
{WIN_VARIANTS[type].text}
); } export default connect((state: any) => ({ userDisplayName: state.getIn(['sessions', 'current', 'userDisplayName']), }))(RequestingWindow);