Lint clean up

master
Håvar Aambø Fosstveit 2019-03-31 22:22:25 +02:00
parent 2f19746fa9
commit 77298b6f2e
19 changed files with 139 additions and 145 deletions

View File

@ -91,7 +91,10 @@ class HiddenPeers extends React.PureComponent
} = this.props; } = this.props;
return ( return (
<div className={classnames(classes.root, this.state.className)} onClick={() => openUsersTab()}> <div
className={classnames(classes.root, this.state.className)}
onClick={() => openUsersTab()}
>
<p>+{hiddenPeersCount} <br /> participant <p>+{hiddenPeersCount} <br /> participant
{(hiddenPeersCount === 1) ? null : 's'} {(hiddenPeersCount === 1) ? null : 's'}
</p> </p>

View File

@ -26,7 +26,7 @@ const styles = (theme) =>
}, },
selfMessage : selfMessage :
{ {
marginLeft : 'auto', marginLeft : 'auto'
}, },
remoteMessage : remoteMessage :
{ {
@ -48,7 +48,7 @@ const styles = (theme) =>
borderRadius : '50%', borderRadius : '50%',
height : '2rem', height : '2rem',
alignSelf : 'center' alignSelf : 'center'
}, }
}); });
const Message = (props) => const Message = (props) =>

View File

@ -35,6 +35,7 @@ class MessageList extends React.PureComponent
{ {
if (nextProps.chatmessages.length !== this.props.chatmessages.length) if (nextProps.chatmessages.length !== this.props.chatmessages.length)
return true; return true;
return false; return false;
} }
@ -55,6 +56,7 @@ class MessageList extends React.PureComponent
{ {
const { const {
chatmessages, chatmessages,
myPicture,
classes classes
} = this.props; } = this.props;
@ -66,7 +68,7 @@ class MessageList extends React.PureComponent
const messageTime = new Date(message.time); const messageTime = new Date(message.time);
const picture = (message.sender === 'response' ? const picture = (message.sender === 'response' ?
message.picture : this.props.myPicture) || EmptyAvatar; message.picture : myPicture) || EmptyAvatar;
return ( return (
<Message <Message
@ -88,12 +90,14 @@ class MessageList extends React.PureComponent
MessageList.propTypes = MessageList.propTypes =
{ {
chatmessages : PropTypes.array, chatmessages : PropTypes.array,
myPicture : PropTypes.string,
classes : PropTypes.object.isRequired classes : PropTypes.object.isRequired
}; };
const mapStateToProps = (state) => const mapStateToProps = (state) =>
({ ({
chatmessages : state.chatmessages chatmessages : state.chatmessages,
myPicture : state.me.picture
}); });
export default connect(mapStateToProps, null)(withStyles(styles)(MessageList)); export default connect(mapStateToProps, null)(withStyles(styles)(MessageList));

View File

@ -57,16 +57,14 @@ class MeetingDrawer extends React.PureComponent
variant='fullWidth' variant='fullWidth'
> >
<Tab <Tab
label= label={
{
<Badge color='secondary' badgeContent={unreadMessages}> <Badge color='secondary' badgeContent={unreadMessages}>
Chat Chat
</Badge> </Badge>
} }
/> />
<Tab <Tab
label= label={
{
<Badge color='secondary' badgeContent={unreadFiles}> <Badge color='secondary' badgeContent={unreadFiles}>
File sharing File sharing
</Badge> </Badge>

View File

@ -68,7 +68,7 @@ const styles = () =>
backgroundImage : `url(${HandIcon})`, backgroundImage : `url(${HandIcon})`,
opacity : 1 opacity : 1
} }
}, }
}); });
const ListMe = (props) => const ListMe = (props) =>

View File

@ -11,7 +11,7 @@ import ResizeObserver from 'resize-observer-polyfill';
const RATIO = 1.334; const RATIO = 1.334;
const PADDING = 100; const PADDING = 100;
const styles = (theme) => const styles = () =>
({ ({
root : root :
{ {

View File

@ -9,7 +9,7 @@ import { withRoomContext } from '../../RoomContext';
import Peer from '../Containers/Peer'; import Peer from '../Containers/Peer';
import HiddenPeers from '../Containers/HiddenPeers'; import HiddenPeers from '../Containers/HiddenPeers';
const styles = (theme) => const styles = () =>
({ ({
root : root :
{ {

View File

@ -5,7 +5,7 @@ import { withStyles } from '@material-ui/core/styles';
import * as appPropTypes from '../appPropTypes'; import * as appPropTypes from '../appPropTypes';
import EditableInput from '../Controls/EditableInput'; import EditableInput from '../Controls/EditableInput';
const styles = (theme) => const styles = () =>
({ ({
root : root :
{ {
@ -143,7 +143,7 @@ const styles = (theme) =>
display : 'flex', display : 'flex',
flexDirection : 'column', flexDirection : 'column',
justifyContent : 'center', justifyContent : 'center',
alignItems : 'center', alignItems : 'center'
}, },
volumeBar : volumeBar :
{ {

View File

@ -59,9 +59,11 @@ function run()
const peerName = randomString({ length: 8 }).toLowerCase(); const peerName = randomString({ length: 8 }).toLowerCase();
const urlParser = new UrlParse(window.location.href, true); const urlParser = new UrlParse(window.location.href, true);
let roomId = (urlParser.pathname).substr(1) let roomId = (urlParser.pathname).substr(1)
? (urlParser.pathname).substr(1).toLowerCase() : urlParser.query.roomId.toLowerCase(); ? (urlParser.pathname).substr(1).toLowerCase() : urlParser.query.roomId.toLowerCase();
const produce = urlParser.query.produce !== 'false'; const produce = urlParser.query.produce !== 'false';
let displayName = urlParser.query.displayName; let displayName = urlParser.query.displayName;
const useSimulcast = urlParser.query.simulcast === 'true'; const useSimulcast = urlParser.query.simulcast === 'true';
@ -94,6 +96,7 @@ function run()
// Get displayName from cookie (if not already given as param). // Get displayName from cookie (if not already given as param).
const userCookie = cookiesManager.getUser() || {}; const userCookie = cookiesManager.getUser() || {};
let displayNameSet; let displayNameSet;
if (!displayName) if (!displayName)
@ -116,7 +119,14 @@ function run()
stateActions.setRoomUrl(roomUrl)); stateActions.setRoomUrl(roomUrl));
store.dispatch( store.dispatch(
stateActions.setMe({ peerName, displayName, displayNameSet, device, loginEnabled: window.config.loginEnabled })); stateActions.setMe({
peerName,
displayName,
displayNameSet,
device,
loginEnabled : window.config.loginEnabled
})
);
roomClient = new RoomClient( roomClient = new RoomClient(
{ roomId, peerName, displayName, device, useSimulcast, produce }); { roomId, peerName, displayName, device, useSimulcast, produce });

View File

@ -24,12 +24,7 @@ export function register(config)
checkValidServiceWorker(swUrl, config); checkValidServiceWorker(swUrl, config);
navigator.serviceWorker.ready.then(() => navigator.serviceWorker.ready.then(() =>
{ {});
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} }
else else
{ {
@ -58,30 +53,17 @@ function registerValidSW(swUrl, config)
{ {
if (navigator.serviceWorker.controller) if (navigator.serviceWorker.controller)
{ {
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
if (config && config.onUpdate) if (config && config.onUpdate)
config.onUpdate(registration); config.onUpdate(registration);
} }
else else if (config && config.onSuccess)
{
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess)
config.onSuccess(registration); config.onSuccess(registration);
} }
}
}; };
}; };
}) })
.catch((error) => .catch(() =>
{ {});
console.error('Error during service worker registration:', error);
});
} }
function checkValidServiceWorker(swUrl, config) function checkValidServiceWorker(swUrl, config)
@ -90,6 +72,7 @@ function checkValidServiceWorker(swUrl, config)
.then((response) => .then((response) =>
{ {
const contentType = response.headers.get('content-type'); const contentType = response.headers.get('content-type');
if (response.status === 404 || if (response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)) (contentType != null && contentType.indexOf('javascript') === -1))
{ {
@ -107,11 +90,7 @@ function checkValidServiceWorker(swUrl, config)
} }
}) })
.catch(() => .catch(() =>
{ {});
console.log(
'No internet connection found. App is running in offline mode.'
);
});
} }
export function unregister() export function unregister()