From 9a7e149c350411f3364a9c698c10d627ec594ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5var=20Aamb=C3=B8=20Fosstveit?= Date: Thu, 1 Mar 2018 15:49:12 +0100 Subject: [PATCH] Add button to leave meeting --- app/lib/components/Room.jsx | 176 ++++++++++++++++++-------------- app/stylus/components/Room.styl | 6 +- 2 files changed, 102 insertions(+), 80 deletions(-) diff --git a/app/lib/components/Room.jsx b/app/lib/components/Room.jsx index 37786b5..39ae6be 100644 --- a/app/lib/components/Room.jsx +++ b/app/lib/components/Room.jsx @@ -11,96 +11,109 @@ import Me from './Me'; import Peers from './Peers'; import Notifications from './Notifications'; -const Room = ( - { - room, - me, - amActiveSpeaker, - onRoomLinkCopy, - onSetAudioMode, - onRestartIce - }) => +class Room extends React.Component { - return ( - -
- + render() + { + const { + room, + me, + amActiveSpeaker, + onRoomLinkCopy, + onSetAudioMode, + onRestartIce, + onLeaveMeeting + } = this.props; -
-
-

{room.state}

-
+ return ( + +
+ -
-
- - { - // If this is a 'Open in new window/tab' don't prevent - // click default action. - if ( - event.ctrlKey || event.shiftKey || event.metaKey || - // Middle click (IE > 9 and everyone else). - (event.button && event.button === 1) - ) - { - return; - } - - event.preventDefault(); - }} - > - invitation link - +
+
+

{room.state}

-
- +
+
+ + { + // If this is a 'Open in new window/tab' don't prevent + // click default action. + if ( + event.ctrlKey || event.shiftKey || event.metaKey || + // Middle click (IE > 9 and everyone else). + (event.button && event.button === 1) + ) + { + return; + } -
- -
+ event.preventDefault(); + }} + > + invitation link +
+
+
-
-
onSetAudioMode(!me.audioOnly)} - /> +
onRestartIce()} + > + +
+ +
+
onSetAudioMode(!me.audioOnly)} + /> + +
onRestartIce()} + /> + +
onLeaveMeeting()} + /> +
+ +
- - -
- - ); -}; + + ); + } +} Room.propTypes = { @@ -109,7 +122,8 @@ Room.propTypes = amActiveSpeaker : PropTypes.bool.isRequired, onRoomLinkCopy : PropTypes.func.isRequired, onSetAudioMode : PropTypes.func.isRequired, - onRestartIce : PropTypes.func.isRequired + onRestartIce : PropTypes.func.isRequired, + onLeaveMeeting : PropTypes.func.isRequired }; const mapStateToProps = (state) => @@ -141,6 +155,10 @@ const mapDispatchToProps = (dispatch) => onRestartIce : () => { dispatch(requestActions.restartIce()); + }, + onLeaveMeeting : () => + { + dispatch(requestActions.leaveRoom()); } }; }; diff --git a/app/stylus/components/Room.styl b/app/stylus/components/Room.styl index 5e5bc84..5cd6b26 100644 --- a/app/stylus/components/Room.styl +++ b/app/stylus/components/Room.styl @@ -191,7 +191,7 @@ background-position: center; background-size: 75%; background-repeat: no-repeat; - background-color: rgba(#fff, 0.15); + background-color: rgba(#fff, 0.3); cursor: pointer; transition-property: opacity, background-color; transition-duration: 0.15s; @@ -231,6 +231,10 @@ background-image: url('/resources/images/icon_restart_ice__black.svg'); } } + + &.leave-meeting { + background-image: url('/resources/images/leave-meeting.svg'); + } } } }