From fbad72611e267e315356a4d0f2ed790ec0a6c7e0 Mon Sep 17 00:00:00 2001 From: Prash Date: Wed, 9 May 2018 23:35:33 -0700 Subject: [PATCH 1/3] fix soundcheck reload, css, add separate modal, add dev env bypass --- src/client/redux/sagas/soundcheck.js | 5 +-- src/client/ui-components/modal/index.css | 3 ++ src/client/ui-components/modal/index.js | 35 +++++++++++++++++++ src/client/ui-components/soundcheck/index.css | 3 ++ src/client/ui-components/soundcheck/index.js | 11 +++--- .../soundcheck/soundcheck-wrapper.js | 14 +++----- .../ui-components/toggle-button/index.css | 4 +-- src/client/utils/window.js | 1 + src/server/services/auth.js | 15 ++++++-- 9 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 src/client/ui-components/modal/index.css create mode 100644 src/client/ui-components/modal/index.js create mode 100644 src/client/ui-components/soundcheck/index.css diff --git a/src/client/redux/sagas/soundcheck.js b/src/client/redux/sagas/soundcheck.js index 2704d74..f72b236 100644 --- a/src/client/redux/sagas/soundcheck.js +++ b/src/client/redux/sagas/soundcheck.js @@ -9,7 +9,7 @@ import { } from '../ducks/soundcheck' import { INITIALIZE_SUCCESS } from '../ducks/room' import { getDevices, getUserMedia } from '../../utils/navigator' -import { setLocalStorage, getLocalStorage } from '../../utils/window' +import { setLocalStorage, getLocalStorage, reload } from '../../utils/window' import config from '../../config' function* soundcheckInitialize () { @@ -88,7 +88,8 @@ function* soundcheckUpdate ({ audioInput, audioOutput, videoInput, audioEnabled, roomId, stream }) - // @todo: TODO: Pass stream updates to all users + // reload to refresh stream updates + reload() } catch (err) { console.log('Error initializing soundcheck') console.error(err) diff --git a/src/client/ui-components/modal/index.css b/src/client/ui-components/modal/index.css new file mode 100644 index 0000000..2001fc2 --- /dev/null +++ b/src/client/ui-components/modal/index.css @@ -0,0 +1,3 @@ +.modal-header { + color: #337ab7; +} \ No newline at end of file diff --git a/src/client/ui-components/modal/index.js b/src/client/ui-components/modal/index.js new file mode 100644 index 0000000..a9c72e5 --- /dev/null +++ b/src/client/ui-components/modal/index.js @@ -0,0 +1,35 @@ + +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { Modal } from 'react-bootstrap' +import './index.css' + +class ModalWrapper extends Component { + render () { + return ( + + + {this.props.header} + + + {this.props.content} + + + ) + } +} + +ModalWrapper.propTypes = { + onClose: PropTypes.func, + show: PropTypes.bool, + content: PropTypes.any, + header: PropTypes.string +} + +export default ModalWrapper diff --git a/src/client/ui-components/soundcheck/index.css b/src/client/ui-components/soundcheck/index.css new file mode 100644 index 0000000..c53640b --- /dev/null +++ b/src/client/ui-components/soundcheck/index.css @@ -0,0 +1,3 @@ +.foot-note { + font-size: small; +} diff --git a/src/client/ui-components/soundcheck/index.js b/src/client/ui-components/soundcheck/index.js index dd31bf7..89e7aff 100644 --- a/src/client/ui-components/soundcheck/index.js +++ b/src/client/ui-components/soundcheck/index.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types' import ToggleButton from '../toggle-button' import { Row, Col, FormControl, FormGroup, Button } from 'react-bootstrap' import { map, filter, values } from 'lodash' +import './index.css' const getDevices = (devices, kind) => filter(devices, (device, deviceId) => device.kind === kind) const getVideoInputDevices = devices => getDevices(devices, 'videoinput') @@ -100,7 +101,7 @@ class Soundcheck extends Component {
- Video Input Source + Video Input 🎥 {this.renderDropdownMenu( @@ -126,7 +127,7 @@ class Soundcheck extends Component { - Audio Input Source + Audio Input 🎙️ {this.renderDropdownMenu( @@ -153,7 +154,7 @@ class Soundcheck extends Component { - Audio Output Source + Audio Output 🔈 {this.renderDropdownMenu( @@ -168,7 +169,9 @@ class Soundcheck extends Component { - + + Note: Your page will reload after save + + Note: Your page will reload after save - -

- - OR - -

-
- - - {' '} + return this.props.roomId + ? ( +
+ Join room +   - -
- ) + + ) + : ( +
+ +

+ - OR - +

+
+ + + {' '} + +
+
+ ) } } + +JoinOrCreateRoom.propTypes = { + roomId: PropTypes.string +} diff --git a/src/client/ui-components/soundcheck/index.js b/src/client/ui-components/soundcheck/index.js index ea87057..bae3424 100644 --- a/src/client/ui-components/soundcheck/index.js +++ b/src/client/ui-components/soundcheck/index.js @@ -11,6 +11,7 @@ const getDevices = (devices, kind) => filter(devices, (device, deviceId) => devi const getVideoInputDevices = devices => getDevices(devices, 'videoinput') const getAudioInputDevices = devices => getDevices(devices, 'audioinput') const getAudioOutputDevices = devices => getDevices(devices, 'audiooutput') +const Emoji = ({ emoji, label }) => {emoji} class Soundcheck extends Component { constructor (props) { @@ -108,7 +109,7 @@ class Soundcheck extends Component {
- Video Input 🎥 + Video Input {this.renderDropdownMenu( @@ -134,7 +135,7 @@ class Soundcheck extends Component { - Audio Input 🎙️ + Audio Input {this.renderDropdownMenu( @@ -161,7 +162,7 @@ class Soundcheck extends Component { - Audio Output 🔈 + Audio Output {this.renderDropdownMenu( diff --git a/src/client/utils/room.js b/src/client/utils/room.js index 670cc09..cda458b 100644 --- a/src/client/utils/room.js +++ b/src/client/utils/room.js @@ -22,3 +22,13 @@ export const getRandomAvatarUrl = ( } return `${AVATAR_URL_PREFIX}/avatars/face/${features.eyes}/${features.nose}/${features.mouth}/${features.color || 'eeee'}` } + +export const parseRoomIdFromNextUrl = (nextUrl) => { + return nextUrl + ? decodeURIComponent( + nextUrl + .replace('?next=', '') + ) + .replace('/room/', '') + : null +} diff --git a/src/client/utils/window.js b/src/client/utils/window.js index ab87a9e..1f8e0bf 100644 --- a/src/client/utils/window.js +++ b/src/client/utils/window.js @@ -1,3 +1,10 @@ +import { parse } from 'query-string' +export const getNextUrl = () => { + const urlSearch = parse(window.location.search) + return urlSearch && urlSearch.next + ? `?next=${encodeURIComponent(urlSearch.next)}` + : null +} export const getLocalStorage = (key) => JSON.parse(window.localStorage.getItem(key) || null) export const setLocalStorage = (key, val) => window.localStorage.setItem(key, JSON.stringify(val)) export const existsInLocalStorage = (key) => window.localStorage.getItem(key) !== undefined diff --git a/src/client/views/room/index.css b/src/client/views/room/index.css index 82ad0b4..1579358 100644 --- a/src/client/views/room/index.css +++ b/src/client/views/room/index.css @@ -1,4 +1,5 @@ .room-toolbar { margin: auto; text-align: center; + padding-bottom: 10px; } \ No newline at end of file diff --git a/src/client/views/welcome/index.js b/src/client/views/welcome/index.js index 24a31f7..a133db8 100644 --- a/src/client/views/welcome/index.js +++ b/src/client/views/welcome/index.js @@ -1,10 +1,14 @@ import React, { Component } from 'react' import JoinOrCreateRoom from '../../ui-components/join-or-create-room' import { Row, Col, Grid, Jumbotron } from 'react-bootstrap' +import { getNextUrl } from '../../utils/window' +import { parseRoomIdFromNextUrl } from '../../utils/room' import './index.css' class Welcome extends Component { render () { + const next = getNextUrl() + const roomId = parseRoomIdFromNextUrl(next) return ( @@ -43,7 +47,9 @@ class Welcome extends Component {
- +
diff --git a/yarn.lock b/yarn.lock index 6488760..cb11606 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7014,6 +7014,13 @@ query-string@^4.1.0: object-assign "^4.1.0" strict-uri-encode "^1.0.0" +query-string@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.1.0.tgz#01e7d69f6a0940dac67a937d6c6325647aa4532a" + dependencies: + decode-uri-component "^0.2.0" + strict-uri-encode "^2.0.0" + querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -8152,6 +8159,10 @@ strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + string-length@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac"