Raise hand first step (no signalling yet)

master
Stefan Otto 2018-03-16 11:20:48 +01:00
parent 886d77216a
commit edd10bf034
7 changed files with 112 additions and 0 deletions

View File

@ -486,6 +486,35 @@ export default class RoomClient
});
}
raiseHand()
{
logger.debug('raiseHand()');
this._dispatch(
stateActions.setRaiseHandInProgress(true));
this._dispatch(
stateActions.setRaiseHandState(true));
this._dispatch(
stateActions.setRaiseHandInProgress(false));
}
lowerHand()
{
logger.debug('lowerHand()');
this._dispatch(
stateActions.setRaiseHandInProgress(true));
this._dispatch(
stateActions.setRaiseHandState(false));
this._dispatch(
stateActions.setRaiseHandInProgress(false));
}
restartIce()
{
logger.debug('restartIce()');

View File

@ -23,6 +23,7 @@ class Room extends React.Component
onRoomLinkCopy,
onSetAudioMode,
onRestartIce,
onToggleHand,
onLeaveMeeting
} = this.props;
@ -98,6 +99,16 @@ class Room extends React.Component
onClick={() => onRestartIce()}
/>
<div
className={classnames('button', 'raise-hand', {
on : me.raiseHand,
disabled : me.raiseHandInProgress
})}
data-tip='Raise hand'
data-type='dark'
onClick={() => onToggleHand(!me.raiseHand)}
/>
<div
className={classnames('button', 'leave-meeting')}
data-tip='Leave meeting'
@ -125,6 +136,7 @@ Room.propTypes =
onRoomLinkCopy : PropTypes.func.isRequired,
onSetAudioMode : PropTypes.func.isRequired,
onRestartIce : PropTypes.func.isRequired,
onToggleHand : PropTypes.func.isRequired,
onLeaveMeeting : PropTypes.func.isRequired
};
@ -158,6 +170,13 @@ const mapDispatchToProps = (dispatch) =>
{
dispatch(requestActions.restartIce());
},
onToggleHand : (enable) =>
{
if (enable)
dispatch(requestActions.raiseHand());
else
dispatch(requestActions.lowerHand());
},
onLeaveMeeting : () =>
{
dispatch(requestActions.leaveRoom());

View File

@ -10,6 +10,8 @@ const initialState =
webcamInProgress : false,
audioOnly : false,
audioOnlyInProgress : false,
raiseHand : false,
raiseHandInProgress : false,
restartIceInProgress : false
};
@ -70,6 +72,20 @@ const me = (state = initialState, action) =>
return { ...state, audioOnlyInProgress: flag };
}
case 'SET_RAISE_HAND_STATE':
{
const { enabled } = action.payload;
return { ...state, raiseHand: enabled };
}
case 'SET_RAISE_HAND_STATE_IN_PROGRESS':
{
const { flag } = action.payload;
return { ...state, raiseHandInProgress: flag };
}
case 'SET_RESTART_ICE_IN_PROGRESS':
{
const { flag } = action.payload;

View File

@ -78,6 +78,20 @@ export const disableAudioOnly = () =>
};
};
export const raiseHand = () =>
{
return {
type : 'RAISE_HAND'
};
};
export const lowerHand = () =>
{
return {
type : 'LOWER_HAND'
};
};
export const restartIce = () =>
{
return {

View File

@ -102,6 +102,20 @@ export default ({ dispatch, getState }) => (next) =>
break;
}
case 'RAISE_HAND':
{
client.raiseHand();
break;
}
case 'LOWER_HAND':
{
client.lowerHand();
break;
}
case 'RESTART_ICE':
{
client.restartIce();

View File

@ -70,6 +70,22 @@ export const setAudioOnlyInProgress = (flag) =>
};
};
export const setRaiseHandState = (enabled) =>
{
return {
type : 'SET_RAISE_HAND_STATE',
payload : { enabled }
};
};
export const setRaiseHandInProgress = (flag) =>
{
return {
type : 'SET_RAISE_HAND_STATE_IN_PROGRESS',
payload : { flag }
};
};
export const setRestartIceInProgress = (flag) =>
{
return {

View File

@ -232,6 +232,10 @@
}
}
&.raise-hand {
background-image: url('/resources/images/leave-meeting.svg');
}
&.leave-meeting {
background-image: url('/resources/images/leave-meeting.svg');
}