Added advanced options for sticky app bar, lastn. Optimized some component rendering.
parent
4975c08c0d
commit
8ba29338d1
|
|
@ -171,6 +171,9 @@ export default class RoomClient
|
||||||
else
|
else
|
||||||
this._maxSpotlights = mobileLastN;
|
this._maxSpotlights = mobileLastN;
|
||||||
|
|
||||||
|
if (store.getState().settings.lastN !== this._maxSpotlights)
|
||||||
|
this._maxSpotlights = store.getState().settings.lastN;
|
||||||
|
|
||||||
// Manager of spotlight
|
// Manager of spotlight
|
||||||
this._spotlights = null;
|
this._spotlights = null;
|
||||||
|
|
||||||
|
|
@ -823,6 +826,14 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeMaxSpotlights(maxSpotlights)
|
||||||
|
{
|
||||||
|
this._spotlights.maxSpotlights = maxSpotlights;
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
settingsActions.setLastN(maxSpotlights));
|
||||||
|
}
|
||||||
|
|
||||||
// Updated consumers based on spotlights
|
// Updated consumers based on spotlights
|
||||||
async updateSpotlights(spotlights)
|
async updateSpotlights(spotlights)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -198,4 +198,19 @@ export default class Spotlights extends EventEmitter
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get maxSpotlights()
|
||||||
|
{
|
||||||
|
return this._maxSpotlights;
|
||||||
|
}
|
||||||
|
|
||||||
|
set maxSpotlights(maxSpotlights)
|
||||||
|
{
|
||||||
|
const oldMaxSpotlights = this._maxSpotlights;
|
||||||
|
|
||||||
|
this._maxSpotlights = maxSpotlights;
|
||||||
|
|
||||||
|
if (oldMaxSpotlights !== this._maxSpotlights)
|
||||||
|
this._spotlightsUpdated();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,15 @@ export const setDisplayName = (displayName) =>
|
||||||
export const toggleAdvancedMode = () =>
|
export const toggleAdvancedMode = () =>
|
||||||
({
|
({
|
||||||
type : 'TOGGLE_ADVANCED_MODE'
|
type : 'TOGGLE_ADVANCED_MODE'
|
||||||
|
});
|
||||||
|
|
||||||
|
export const toggleStickyAppBar = () =>
|
||||||
|
({
|
||||||
|
type : 'TOGGLE_STICKY_APPBAR'
|
||||||
|
});
|
||||||
|
|
||||||
|
export const setLastN = (lastN) =>
|
||||||
|
({
|
||||||
|
type : 'SET_LAST_N',
|
||||||
|
payload : { lastN }
|
||||||
});
|
});
|
||||||
|
|
@ -116,6 +116,7 @@ const TopBar = (props) =>
|
||||||
roomClient,
|
roomClient,
|
||||||
room,
|
room,
|
||||||
lobbyPeers,
|
lobbyPeers,
|
||||||
|
stickyAppBar,
|
||||||
myPicture,
|
myPicture,
|
||||||
loggedIn,
|
loggedIn,
|
||||||
loginEnabled,
|
loginEnabled,
|
||||||
|
|
@ -165,7 +166,7 @@ const TopBar = (props) =>
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
position='fixed'
|
position='fixed'
|
||||||
className={room.toolbarsVisible ? classes.show : classes.hide}
|
className={room.toolbarsVisible || stickyAppBar ? classes.show : classes.hide}
|
||||||
>
|
>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<PulsingBadge
|
<PulsingBadge
|
||||||
|
|
@ -331,6 +332,7 @@ TopBar.propTypes =
|
||||||
roomClient : PropTypes.object.isRequired,
|
roomClient : PropTypes.object.isRequired,
|
||||||
room : appPropTypes.Room.isRequired,
|
room : appPropTypes.Room.isRequired,
|
||||||
lobbyPeers : PropTypes.array,
|
lobbyPeers : PropTypes.array,
|
||||||
|
stickyAppBar : PropTypes.bool,
|
||||||
myPicture : PropTypes.string,
|
myPicture : PropTypes.string,
|
||||||
loggedIn : PropTypes.bool.isRequired,
|
loggedIn : PropTypes.bool.isRequired,
|
||||||
loginEnabled : PropTypes.bool.isRequired,
|
loginEnabled : PropTypes.bool.isRequired,
|
||||||
|
|
@ -350,7 +352,7 @@ const mapStateToProps = (state) =>
|
||||||
({
|
({
|
||||||
room : state.room,
|
room : state.room,
|
||||||
lobbyPeers : lobbyPeersKeySelector(state),
|
lobbyPeers : lobbyPeersKeySelector(state),
|
||||||
advancedMode : state.settings.advancedMode,
|
stickyAppBar : state.settings.stickyAppBar,
|
||||||
loggedIn : state.me.loggedIn,
|
loggedIn : state.me.loggedIn,
|
||||||
loginEnabled : state.me.loginEnabled,
|
loginEnabled : state.me.loginEnabled,
|
||||||
myPicture : state.me.picture,
|
myPicture : state.me.picture,
|
||||||
|
|
@ -388,6 +390,7 @@ export default withRoomContext(connect(
|
||||||
return (
|
return (
|
||||||
prev.room === next.room &&
|
prev.room === next.room &&
|
||||||
prev.lobbyPeers === next.lobbyPeers &&
|
prev.lobbyPeers === next.lobbyPeers &&
|
||||||
|
prev.settings.stickyAppBar === next.settings.stickyAppBar &&
|
||||||
prev.me.loggedIn === next.me.loggedIn &&
|
prev.me.loggedIn === next.me.loggedIn &&
|
||||||
prev.me.loginEnabled === next.me.loginEnabled &&
|
prev.me.loginEnabled === next.me.loginEnabled &&
|
||||||
prev.me.picture === next.me.picture &&
|
prev.me.picture === next.me.picture &&
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class Democratic extends React.PureComponent
|
||||||
|
|
||||||
const width = this.peersRef.current.clientWidth - PADDING_H;
|
const width = this.peersRef.current.clientWidth - PADDING_H;
|
||||||
const height = this.peersRef.current.clientHeight -
|
const height = this.peersRef.current.clientHeight -
|
||||||
(this.props.toolbarsVisible ? PADDING_V : PADDING_H);
|
(this.props.toolbarsVisible || this.props.stickyAppBar ? PADDING_V : PADDING_H);
|
||||||
|
|
||||||
let x, y, space;
|
let x, y, space;
|
||||||
|
|
||||||
|
|
@ -134,6 +134,7 @@ class Democratic extends React.PureComponent
|
||||||
spotlightsPeers,
|
spotlightsPeers,
|
||||||
spotlightsLength,
|
spotlightsLength,
|
||||||
toolbarsVisible,
|
toolbarsVisible,
|
||||||
|
stickyAppBar,
|
||||||
classes
|
classes
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
|
@ -147,7 +148,7 @@ class Democratic extends React.PureComponent
|
||||||
<div
|
<div
|
||||||
className={classnames(
|
className={classnames(
|
||||||
classes.root,
|
classes.root,
|
||||||
toolbarsVisible ? classes.showingToolBar : classes.hiddenToolBar
|
toolbarsVisible || stickyAppBar ? classes.showingToolBar : classes.hiddenToolBar
|
||||||
)}
|
)}
|
||||||
ref={this.peersRef}
|
ref={this.peersRef}
|
||||||
>
|
>
|
||||||
|
|
@ -186,6 +187,7 @@ Democratic.propTypes =
|
||||||
spotlightsLength : PropTypes.number,
|
spotlightsLength : PropTypes.number,
|
||||||
spotlightsPeers : PropTypes.array.isRequired,
|
spotlightsPeers : PropTypes.array.isRequired,
|
||||||
toolbarsVisible : PropTypes.bool.isRequired,
|
toolbarsVisible : PropTypes.bool.isRequired,
|
||||||
|
stickyAppBar : PropTypes.bool,
|
||||||
classes : PropTypes.object.isRequired
|
classes : PropTypes.object.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -196,7 +198,8 @@ const mapStateToProps = (state) =>
|
||||||
boxes : videoBoxesSelector(state),
|
boxes : videoBoxesSelector(state),
|
||||||
spotlightsPeers : spotlightPeersSelector(state),
|
spotlightsPeers : spotlightPeersSelector(state),
|
||||||
spotlightsLength : spotlightsLengthSelector(state),
|
spotlightsLength : spotlightsLengthSelector(state),
|
||||||
toolbarsVisible : state.room.toolbarsVisible
|
toolbarsVisible : state.room.toolbarsVisible,
|
||||||
|
stickyAppBar : state.settings.stickyAppBar
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -212,7 +215,8 @@ export default connect(
|
||||||
prev.producers === next.producers &&
|
prev.producers === next.producers &&
|
||||||
prev.consumers === next.consumers &&
|
prev.consumers === next.consumers &&
|
||||||
prev.room.spotlights === next.room.spotlights &&
|
prev.room.spotlights === next.room.spotlights &&
|
||||||
prev.room.toolbarsVisible === next.room.toolbarsVisible
|
prev.room.toolbarsVisible === next.room.toolbarsVisible &&
|
||||||
|
prev.settings.stickyAppBar === next.settings.stickyAppBar
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,9 +197,13 @@ class Room extends React.PureComponent
|
||||||
|
|
||||||
<View advancedMode={advancedMode} />
|
<View advancedMode={advancedMode} />
|
||||||
|
|
||||||
<LockDialog />
|
{ room.lockDialogOpen &&
|
||||||
|
<LockDialog />
|
||||||
|
}
|
||||||
|
|
||||||
<Settings />
|
{ room.settingsOpen &&
|
||||||
|
<Settings />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ const Settings = ({
|
||||||
me,
|
me,
|
||||||
settings,
|
settings,
|
||||||
onToggleAdvancedMode,
|
onToggleAdvancedMode,
|
||||||
|
onToggleStickyAppBar,
|
||||||
handleCloseSettings,
|
handleCloseSettings,
|
||||||
handleChangeMode,
|
handleChangeMode,
|
||||||
classes
|
classes
|
||||||
|
|
@ -296,6 +297,48 @@ const Settings = ({
|
||||||
defaultMessage : 'Advanced mode'
|
defaultMessage : 'Advanced mode'
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
{ settings.advancedMode &&
|
||||||
|
<React.Fragment>
|
||||||
|
<form className={classes.setting} autoComplete='off'>
|
||||||
|
<FormControl className={classes.formControl}>
|
||||||
|
<Select
|
||||||
|
value={settings.lastN || ''}
|
||||||
|
onChange={(event) =>
|
||||||
|
{
|
||||||
|
if (event.target.value)
|
||||||
|
roomClient.changeMaxSpotlights(event.target.value);
|
||||||
|
}}
|
||||||
|
name='Last N'
|
||||||
|
autoWidth
|
||||||
|
className={classes.selectEmpty}
|
||||||
|
>
|
||||||
|
{ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ].map((lastN) =>
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<MenuItem key={lastN} value={lastN}>
|
||||||
|
{lastN}
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Select>
|
||||||
|
<FormHelperText>
|
||||||
|
<FormattedMessage
|
||||||
|
id='settings.lastn'
|
||||||
|
defaultMessage='Select the amount of speakers visible'
|
||||||
|
/>
|
||||||
|
</FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</form>
|
||||||
|
<FormControlLabel
|
||||||
|
className={classes.setting}
|
||||||
|
control={<Checkbox checked={settings.stickyAppBar} onChange={onToggleStickyAppBar} value='stickyAppBar' />}
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id : 'settings.stickyAppBar',
|
||||||
|
defaultMessage : 'Sticky App Bar'
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => handleCloseSettings({ settingsOpen: false })} color='primary'>
|
<Button onClick={() => handleCloseSettings({ settingsOpen: false })} color='primary'>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
|
@ -315,6 +358,7 @@ Settings.propTypes =
|
||||||
room : appPropTypes.Room.isRequired,
|
room : appPropTypes.Room.isRequired,
|
||||||
settings : PropTypes.object.isRequired,
|
settings : PropTypes.object.isRequired,
|
||||||
onToggleAdvancedMode : PropTypes.func.isRequired,
|
onToggleAdvancedMode : PropTypes.func.isRequired,
|
||||||
|
onToggleStickyAppBar : PropTypes.func.isRequired,
|
||||||
handleChangeMode : PropTypes.func.isRequired,
|
handleChangeMode : PropTypes.func.isRequired,
|
||||||
handleCloseSettings : PropTypes.func.isRequired,
|
handleCloseSettings : PropTypes.func.isRequired,
|
||||||
classes : PropTypes.object.isRequired
|
classes : PropTypes.object.isRequired
|
||||||
|
|
@ -331,6 +375,7 @@ const mapStateToProps = (state) =>
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
onToggleAdvancedMode : settingsActions.toggleAdvancedMode,
|
onToggleAdvancedMode : settingsActions.toggleAdvancedMode,
|
||||||
|
onToggleStickyAppBar : settingsActions.toggleStickyAppBar,
|
||||||
handleChangeMode : roomActions.setDisplayMode,
|
handleChangeMode : roomActions.setDisplayMode,
|
||||||
handleCloseSettings : roomActions.setSettingsOpen
|
handleCloseSettings : roomActions.setSettingsOpen
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ const initialState =
|
||||||
selectedWebcam : null,
|
selectedWebcam : null,
|
||||||
selectedAudioDevice : null,
|
selectedAudioDevice : null,
|
||||||
advancedMode : false,
|
advancedMode : false,
|
||||||
resolution : 'high' // low, medium, high, veryhigh, ultra
|
resolution : 'medium', // low, medium, high, veryhigh, ultra
|
||||||
|
lastN : 4
|
||||||
};
|
};
|
||||||
|
|
||||||
const settings = (state = initialState, action) =>
|
const settings = (state = initialState, action) =>
|
||||||
|
|
@ -35,6 +36,20 @@ const settings = (state = initialState, action) =>
|
||||||
return { ...state, advancedMode };
|
return { ...state, advancedMode };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'SET_LAST_N':
|
||||||
|
{
|
||||||
|
const { lastN } = action.payload;
|
||||||
|
|
||||||
|
return { ...state, lastN };
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'TOGGLE_STICKY_APPBAR':
|
||||||
|
{
|
||||||
|
const stickyAppBar = !state.stickyAppBar;
|
||||||
|
|
||||||
|
return { ...state, stickyAppBar };
|
||||||
|
}
|
||||||
|
|
||||||
case 'SET_VIDEO_RESOLUTION':
|
case 'SET_VIDEO_RESOLUTION':
|
||||||
{
|
{
|
||||||
const { resolution } = action.payload;
|
const { resolution } = action.payload;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue