Remove login on room chooser
parent
43b218fb3a
commit
dd6d07391d
|
|
@ -1,21 +1,15 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { withStyles } from '@material-ui/core/styles';
|
import { withStyles } from '@material-ui/core/styles';
|
||||||
import { withRoomContext } from '../RoomContext';
|
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useIntl, FormattedMessage } from 'react-intl';
|
import { useIntl, FormattedMessage } from 'react-intl';
|
||||||
import randomString from 'random-string';
|
import randomString from 'random-string';
|
||||||
import Dialog from '@material-ui/core/Dialog';
|
import Dialog from '@material-ui/core/Dialog';
|
||||||
import DialogContentText from '@material-ui/core/DialogContentText';
|
import DialogContentText from '@material-ui/core/DialogContentText';
|
||||||
import IconButton from '@material-ui/core/IconButton';
|
|
||||||
import AccountCircle from '@material-ui/icons/AccountCircle';
|
|
||||||
import Avatar from '@material-ui/core/Avatar';
|
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from '@material-ui/core/Typography';
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from '@material-ui/core/Button';
|
||||||
import TextField from '@material-ui/core/TextField';
|
import TextField from '@material-ui/core/TextField';
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
|
||||||
import CookieConsent from 'react-cookie-consent';
|
import CookieConsent from 'react-cookie-consent';
|
||||||
import MuiDialogTitle from '@material-ui/core/DialogTitle';
|
import MuiDialogTitle from '@material-ui/core/DialogTitle';
|
||||||
import MuiDialogContent from '@material-ui/core/DialogContent';
|
import MuiDialogContent from '@material-ui/core/DialogContent';
|
||||||
|
|
@ -88,63 +82,12 @@ const styles = (theme) =>
|
||||||
|
|
||||||
const DialogTitle = withStyles(styles)((props) =>
|
const DialogTitle = withStyles(styles)((props) =>
|
||||||
{
|
{
|
||||||
const [ open, setOpen ] = useState(false);
|
const { children, classes, ...other } = props;
|
||||||
|
|
||||||
const intl = useIntl();
|
|
||||||
|
|
||||||
useEffect(() =>
|
|
||||||
{
|
|
||||||
const openTimer = setTimeout(() => setOpen(true), 1000);
|
|
||||||
const closeTimer = setTimeout(() => setOpen(false), 4000);
|
|
||||||
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
clearTimeout(openTimer);
|
|
||||||
clearTimeout(closeTimer);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const { children, classes, myPicture, onLogin, ...other } = props;
|
|
||||||
|
|
||||||
const handleTooltipClose = () =>
|
|
||||||
{
|
|
||||||
setOpen(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleTooltipOpen = () =>
|
|
||||||
{
|
|
||||||
setOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MuiDialogTitle disableTypography className={classes.dialogTitle} {...other}>
|
<MuiDialogTitle disableTypography className={classes.dialogTitle} {...other}>
|
||||||
{ window.config && window.config.logo && <img alt='Logo' className={classes.logo} src={window.config.logo} /> }
|
{ window.config && window.config.logo && <img alt='Logo' className={classes.logo} src={window.config.logo} /> }
|
||||||
<Typography variant='h5'>{children}</Typography>
|
<Typography variant='h5'>{children}</Typography>
|
||||||
{ window.config && window.config.loginEnabled &&
|
|
||||||
<Tooltip
|
|
||||||
onClose={handleTooltipClose}
|
|
||||||
onOpen={handleTooltipOpen}
|
|
||||||
open={open}
|
|
||||||
title={intl.formatMessage({
|
|
||||||
id : 'tooltip.login',
|
|
||||||
defaultMessage : 'Click to log in'
|
|
||||||
})}
|
|
||||||
placement='left'
|
|
||||||
>
|
|
||||||
<IconButton
|
|
||||||
aria-label='Account'
|
|
||||||
className={classes.loginButton}
|
|
||||||
color='inherit'
|
|
||||||
onClick={onLogin}
|
|
||||||
>
|
|
||||||
{ myPicture ?
|
|
||||||
<Avatar src={myPicture} className={classes.largeAvatar} />
|
|
||||||
:
|
|
||||||
<AccountCircle className={classes.largeIcon} />
|
|
||||||
}
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
</MuiDialogTitle>
|
</MuiDialogTitle>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -165,9 +108,6 @@ const DialogActions = withStyles((theme) => ({
|
||||||
}))(MuiDialogActions);
|
}))(MuiDialogActions);
|
||||||
|
|
||||||
const ChooseRoom = ({
|
const ChooseRoom = ({
|
||||||
roomClient,
|
|
||||||
loggedIn,
|
|
||||||
myPicture,
|
|
||||||
classes
|
classes
|
||||||
}) =>
|
}) =>
|
||||||
{
|
{
|
||||||
|
|
@ -184,13 +124,7 @@ const ChooseRoom = ({
|
||||||
paper : classes.dialogPaper
|
paper : classes.dialogPaper
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle
|
<DialogTitle>
|
||||||
myPicture={myPicture}
|
|
||||||
onLogin={() =>
|
|
||||||
{
|
|
||||||
loggedIn ? roomClient.logout() : roomClient.login();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{ window.config && window.config.title ? window.config.title : 'Multiparty meeting' }
|
{ window.config && window.config.title ? window.config.title : 'Multiparty meeting' }
|
||||||
<hr />
|
<hr />
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
@ -255,34 +189,7 @@ const ChooseRoom = ({
|
||||||
|
|
||||||
ChooseRoom.propTypes =
|
ChooseRoom.propTypes =
|
||||||
{
|
{
|
||||||
roomClient : PropTypes.any.isRequired,
|
classes : PropTypes.object.isRequired
|
||||||
loginEnabled : PropTypes.bool.isRequired,
|
|
||||||
loggedIn : PropTypes.bool.isRequired,
|
|
||||||
myPicture : PropTypes.string,
|
|
||||||
classes : PropTypes.object.isRequired
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) =>
|
export default withStyles(styles)(ChooseRoom);
|
||||||
{
|
|
||||||
return {
|
|
||||||
loginEnabled : state.me.loginEnabled,
|
|
||||||
loggedIn : state.me.loggedIn,
|
|
||||||
myPicture : state.me.picture
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withRoomContext(connect(
|
|
||||||
mapStateToProps,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
areStatesEqual : (next, prev) =>
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
prev.me.loginEnabled === next.me.loginEnabled &&
|
|
||||||
prev.me.loggedIn === next.me.loggedIn &&
|
|
||||||
prev.me.picture === next.me.picture
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)(withStyles(styles)(ChooseRoom)));
|
|
||||||
Loading…
Reference in New Issue