Added login button.

master
Håvar Aambø Fosstveit 2018-06-18 13:33:56 +02:00
parent 6d46a777c0
commit cee74f9b29
9 changed files with 59 additions and 48 deletions

View File

@ -125,6 +125,8 @@ export default class RoomClient
login() login()
{ {
this._dispatch(stateActions.setLoginInProgress(true));
const url = `/login?roomId=${this._room.roomId}&peerName=${this._peerName}`; const url = `/login?roomId=${this._room.roomId}&peerName=${this._peerName}`;
this._loginWindow = window.open(url, 'loginWindow'); this._loginWindow = window.open(url, 'loginWindow');
@ -998,6 +1000,8 @@ export default class RoomClient
)); ));
} }
this.closeLoginWindow(); this.closeLoginWindow();
this._dispatch(stateActions.setLoginInProgress(false));
break; break;
} }

View File

@ -24,9 +24,8 @@ class Room extends React.Component
amActiveSpeaker, amActiveSpeaker,
screenProducer, screenProducer,
onRoomLinkCopy, onRoomLinkCopy,
onSetAudioMode,
onRestartIce,
onToggleSettings, onToggleSettings,
onLogin,
onShareScreen, onShareScreen,
onUnShareScreen, onUnShareScreen,
onNeedExtension, onNeedExtension,
@ -142,25 +141,6 @@ class Room extends React.Component
}} }}
/> />
<div
className={classnames('button', 'audio-only', {
on : me.audioOnly,
disabled : me.audioOnlyInProgress
})}
data-tip='Toggle audio only mode'
data-type='dark'
onClick={() => onSetAudioMode(!me.audioOnly)}
/>
<div
className={classnames('button', 'restart-ice', {
disabled : me.restartIceInProgress
})}
data-tip='Restart ICE'
data-type='dark'
onClick={() => onRestartIce()}
/>
<div <div
className={classnames('button', 'settings', { className={classnames('button', 'settings', {
on : room.showSettings, on : room.showSettings,
@ -171,6 +151,15 @@ class Room extends React.Component
onClick={() => onToggleSettings()} onClick={() => onToggleSettings()}
/> />
<div
className={classnames('button', 'login', 'off', {
disabled : me.loginInProgress
})}
data-tip='Login'
data-type='dark'
onClick={() => onLogin()}
/>
<div <div
className={classnames('button', 'raise-hand', { className={classnames('button', 'raise-hand', {
on : me.raiseHand, on : me.raiseHand,
@ -211,14 +200,13 @@ Room.propTypes =
amActiveSpeaker : PropTypes.bool.isRequired, amActiveSpeaker : PropTypes.bool.isRequired,
screenProducer : appPropTypes.Producer, screenProducer : appPropTypes.Producer,
onRoomLinkCopy : PropTypes.func.isRequired, onRoomLinkCopy : PropTypes.func.isRequired,
onSetAudioMode : PropTypes.func.isRequired,
onRestartIce : PropTypes.func.isRequired,
onShareScreen : PropTypes.func.isRequired, onShareScreen : PropTypes.func.isRequired,
onUnShareScreen : PropTypes.func.isRequired, onUnShareScreen : PropTypes.func.isRequired,
onNeedExtension : PropTypes.func.isRequired, onNeedExtension : PropTypes.func.isRequired,
onToggleSettings : PropTypes.func.isRequired, onToggleSettings : PropTypes.func.isRequired,
onToggleHand : PropTypes.func.isRequired, onToggleHand : PropTypes.func.isRequired,
onLeaveMeeting : PropTypes.func.isRequired onLeaveMeeting : PropTypes.func.isRequired,
onLogin : PropTypes.func.isRequired
}; };
const mapStateToProps = (state) => const mapStateToProps = (state) =>
@ -245,17 +233,6 @@ const mapDispatchToProps = (dispatch) =>
text : 'Room link copied to the clipboard' text : 'Room link copied to the clipboard'
})); }));
}, },
onSetAudioMode : (enable) =>
{
if (enable)
dispatch(requestActions.enableAudioOnly());
else
dispatch(requestActions.disableAudioOnly());
},
onRestartIce : () =>
{
dispatch(requestActions.restartIce());
},
onToggleSettings : () => onToggleSettings : () =>
{ {
dispatch(stateActions.toggleSettings()); dispatch(stateActions.toggleSettings());
@ -282,6 +259,10 @@ const mapDispatchToProps = (dispatch) =>
onNeedExtension : () => onNeedExtension : () =>
{ {
dispatch(requestActions.installExtension()); dispatch(requestActions.installExtension());
},
onLogin : () =>
{
dispatch(requestActions.userLogin());
} }
}; };
}; };

View File

@ -15,6 +15,7 @@ const initialState =
webcamInProgress : false, webcamInProgress : false,
audioInProgress : false, audioInProgress : false,
screenShareInProgress : false, screenShareInProgress : false,
loginInProgress : false,
audioOnly : false, audioOnly : false,
audioOnlyInProgress : false, audioOnlyInProgress : false,
raiseHand : false, raiseHand : false,
@ -96,6 +97,13 @@ const me = (state = initialState, action) =>
return { ...state, screenShareInProgress: flag }; return { ...state, screenShareInProgress: flag };
} }
case 'SET_LOGIN_IN_PROGRESS':
{
const { flag } = action.payload;
return { ...state, loginInProgress: flag };
}
case 'SET_DISPLAY_NAME': case 'SET_DISPLAY_NAME':
{ {
let { displayName } = action.payload; let { displayName } = action.payload;

View File

@ -119,6 +119,13 @@ export const resumePeerVideo = (peerName) =>
}; };
}; };
export const userLogin = () =>
{
return {
type : 'USER_LOGIN'
};
};
export const raiseHand = () => export const raiseHand = () =>
{ {
return { return {

View File

@ -156,6 +156,13 @@ export default ({ dispatch, getState }) => (next) =>
break; break;
} }
case 'USER_LOGIN':
{
client.login();
break;
}
case 'LOWER_HAND': case 'LOWER_HAND':
{ {
client.sendRaiseHandState(false); client.sendRaiseHandState(false);

View File

@ -134,6 +134,14 @@ export const setMyRaiseHandState = (flag) =>
}; };
}; };
export const setLoginInProgress = (flag) =>
{
return {
type : 'SET_LOGIN_IN_PROGRESS',
payload : { flag }
};
};
export const toggleSettings = () => export const toggleSettings = () =>
{ {
return { return {

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
</svg>

After

Width:  |  Height:  |  Size: 217 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" fill="#FFFFFF"/>
</svg>

After

Width:  |  Height:  |  Size: 232 B

View File

@ -216,19 +216,9 @@
opacity: 0.5; opacity: 0.5;
} }
&.audio-only { &.login {
background-image: url('/resources/images/icon_audio_only_white.svg'); &.off {
background-image: url('/resources/images/icon_login_white.svg');
&.on {
background-image: url('/resources/images/icon_audio_only_black.svg');
}
}
&.restart-ice {
background-image: url('/resources/images/icon_restart_ice_white.svg');
&.on {
background-image: url('/resources/images/icon_restart_ice__black.svg');
} }
} }