Clean up lock code.
parent
130ed19f13
commit
c461ee4eb7
|
|
@ -64,7 +64,7 @@ export const setSettingsTab = (tab) =>
|
||||||
payload : { tab }
|
payload : { tab }
|
||||||
});
|
});
|
||||||
|
|
||||||
export const setLockDialogOpen = ({ lockDialogOpen }) =>
|
export const setLockDialogOpen = (lockDialogOpen) =>
|
||||||
({
|
({
|
||||||
type : 'SET_LOCK_DIALOG_OPEN',
|
type : 'SET_LOCK_DIALOG_OPEN',
|
||||||
payload : { lockDialogOpen }
|
payload : { lockDialogOpen }
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,6 @@ import DialogActions from '@material-ui/core/DialogActions';
|
||||||
import DialogContent from '@material-ui/core/DialogContent';
|
import DialogContent from '@material-ui/core/DialogContent';
|
||||||
import DialogContentText from '@material-ui/core/DialogContentText';
|
import DialogContentText from '@material-ui/core/DialogContentText';
|
||||||
import Button from '@material-ui/core/Button';
|
import Button from '@material-ui/core/Button';
|
||||||
// import FormLabel from '@material-ui/core/FormLabel';
|
|
||||||
// import FormControl from '@material-ui/core/FormControl';
|
|
||||||
// import FormGroup from '@material-ui/core/FormGroup';
|
|
||||||
// import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
||||||
// import Checkbox from '@material-ui/core/Checkbox';
|
|
||||||
// import InputLabel from '@material-ui/core/InputLabel';
|
|
||||||
// import OutlinedInput from '@material-ui/core/OutlinedInput';
|
|
||||||
// import Switch from '@material-ui/core/Switch';
|
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListSubheader from '@material-ui/core/ListSubheader';
|
import ListSubheader from '@material-ui/core/ListSubheader';
|
||||||
import ListLobbyPeer from './ListLobbyPeer';
|
import ListLobbyPeer from './ListLobbyPeer';
|
||||||
|
|
@ -59,10 +51,8 @@ const styles = (theme) =>
|
||||||
});
|
});
|
||||||
|
|
||||||
const LockDialog = ({
|
const LockDialog = ({
|
||||||
// roomClient,
|
|
||||||
room,
|
room,
|
||||||
handleCloseLockDialog,
|
handleCloseLockDialog,
|
||||||
// handleAccessCode,
|
|
||||||
lobbyPeers,
|
lobbyPeers,
|
||||||
classes
|
classes
|
||||||
}) =>
|
}) =>
|
||||||
|
|
@ -71,7 +61,7 @@ const LockDialog = ({
|
||||||
<Dialog
|
<Dialog
|
||||||
className={classes.root}
|
className={classes.root}
|
||||||
open={room.lockDialogOpen}
|
open={room.lockDialogOpen}
|
||||||
onClose={() => handleCloseLockDialog({ lockDialogOpen: false })}
|
onClose={() => handleCloseLockDialog(false)}
|
||||||
classes={{
|
classes={{
|
||||||
paper : classes.dialogPaper
|
paper : classes.dialogPaper
|
||||||
}}
|
}}
|
||||||
|
|
@ -82,54 +72,6 @@ const LockDialog = ({
|
||||||
defaultMessage='Lobby administration'
|
defaultMessage='Lobby administration'
|
||||||
/>
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
{/*
|
|
||||||
<FormControl component='fieldset' className={classes.formControl}>
|
|
||||||
<FormLabel component='legend'>Room lock</FormLabel>
|
|
||||||
<FormGroup>
|
|
||||||
<FormControlLabel
|
|
||||||
control={
|
|
||||||
<Switch checked={room.locked} onChange={() =>
|
|
||||||
{
|
|
||||||
if (room.locked)
|
|
||||||
{
|
|
||||||
roomClient.unlockRoom();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
roomClient.lockRoom();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>}
|
|
||||||
label='Lock'
|
|
||||||
/>
|
|
||||||
TODO: access code
|
|
||||||
<FormControlLabel disabled={ room.locked ? false : true }
|
|
||||||
control={
|
|
||||||
<Checkbox checked={room.joinByAccessCode}
|
|
||||||
onChange={
|
|
||||||
(event) => roomClient.setJoinByAccessCode(event.target.checked)
|
|
||||||
}
|
|
||||||
/>}
|
|
||||||
label='Join by Access code'
|
|
||||||
/>
|
|
||||||
<InputLabel htmlFor='access-code-input' />
|
|
||||||
<OutlinedInput
|
|
||||||
disabled={ room.locked ? false : true }
|
|
||||||
id='acces-code-input'
|
|
||||||
label='Access code'
|
|
||||||
labelWidth={0}
|
|
||||||
variant='outlined'
|
|
||||||
value={room.accessCode}
|
|
||||||
onChange={(event) => handleAccessCode(event.target.value)}
|
|
||||||
>
|
|
||||||
</OutlinedInput>
|
|
||||||
<Button onClick={() => roomClient.setAccessCode(room.accessCode)} color='primary'>
|
|
||||||
save
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
</FormGroup>
|
|
||||||
</FormControl>
|
|
||||||
*/}
|
|
||||||
{ lobbyPeers.length > 0 ?
|
{ lobbyPeers.length > 0 ?
|
||||||
<List
|
<List
|
||||||
dense
|
dense
|
||||||
|
|
@ -160,7 +102,7 @@ const LockDialog = ({
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
}
|
}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => handleCloseLockDialog({ lockDialogOpen: false })} color='primary'>
|
<Button onClick={() => handleCloseLockDialog(false)} color='primary'>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='label.close'
|
id='label.close'
|
||||||
defaultMessage='Close'
|
defaultMessage='Close'
|
||||||
|
|
@ -173,7 +115,6 @@ const LockDialog = ({
|
||||||
|
|
||||||
LockDialog.propTypes =
|
LockDialog.propTypes =
|
||||||
{
|
{
|
||||||
// roomClient : PropTypes.any.isRequired,
|
|
||||||
room : appPropTypes.Room.isRequired,
|
room : appPropTypes.Room.isRequired,
|
||||||
handleCloseLockDialog : PropTypes.func.isRequired,
|
handleCloseLockDialog : PropTypes.func.isRequired,
|
||||||
handleAccessCode : PropTypes.func.isRequired,
|
handleAccessCode : PropTypes.func.isRequired,
|
||||||
|
|
@ -202,12 +143,7 @@ export default withRoomContext(connect(
|
||||||
areStatesEqual : (next, prev) =>
|
areStatesEqual : (next, prev) =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
prev.room.locked === next.room.locked &&
|
prev.room === next.room &&
|
||||||
prev.room.joinByAccessCode === next.room.joinByAccessCode &&
|
|
||||||
prev.room.accessCode === next.room.accessCode &&
|
|
||||||
prev.room.code === next.room.code &&
|
|
||||||
prev.room.lockDialogOpen === next.room.lockDialogOpen &&
|
|
||||||
prev.room.codeHidden === next.room.codeHidden &&
|
|
||||||
prev.lobbyPeers === next.lobbyPeers
|
prev.lobbyPeers === next.lobbyPeers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||||
},
|
},
|
||||||
setLockDialogOpen : (lockDialogOpen) =>
|
setLockDialogOpen : (lockDialogOpen) =>
|
||||||
{
|
{
|
||||||
dispatch(roomActions.setLockDialogOpen({ lockDialogOpen }));
|
dispatch(roomActions.setLockDialogOpen(lockDialogOpen));
|
||||||
},
|
},
|
||||||
toggleToolArea : () =>
|
toggleToolArea : () =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue