feat(tile-view) allow to toggle tile view while alone

This commit is contained in:
Saúl Ibarra Corretgé 2021-03-24 15:52:46 +01:00 committed by Saúl Ibarra Corretgé
parent e035d33fa9
commit e0c77dcd95
2 changed files with 1 additions and 10 deletions

View File

@ -9,7 +9,6 @@ import {
import { TILE_VIEW_ENABLED, getFeatureFlag } from '../../base/flags'; import { TILE_VIEW_ENABLED, getFeatureFlag } from '../../base/flags';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import { IconTileView } from '../../base/icons'; import { IconTileView } from '../../base/icons';
import { getParticipantCount } from '../../base/participants';
import { connect } from '../../base/redux'; import { connect } from '../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components'; import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
import { setTileView } from '../actions'; import { setTileView } from '../actions';
@ -87,8 +86,7 @@ class TileViewButton<P: Props> extends AbstractButton<P, *> {
*/ */
function _mapStateToProps(state, ownProps) { function _mapStateToProps(state, ownProps) {
const enabled = getFeatureFlag(state, TILE_VIEW_ENABLED, true); const enabled = getFeatureFlag(state, TILE_VIEW_ENABLED, true);
const lonelyMeeting = getParticipantCount(state) < 2; const { visible = enabled } = ownProps;
const { visible = enabled && !lonelyMeeting } = ownProps;
return { return {
_tileViewEnabled: shouldDisplayTileView(state), _tileViewEnabled: shouldDisplayTileView(state),

View File

@ -107,13 +107,6 @@ export function getTileViewGridDimensions(state: Object) {
export function shouldDisplayTileView(state: Object = {}) { export function shouldDisplayTileView(state: Object = {}) {
const participantCount = getParticipantCount(state); const participantCount = getParticipantCount(state);
// In case of a lonely meeting, we don't allow tile view.
// But it's a special case too, as we don't even render the button,
// see TileViewButton component.
if (participantCount < 2) {
return false;
}
const tileViewEnabledFeatureFlag = getFeatureFlag(state, TILE_VIEW_ENABLED, true); const tileViewEnabledFeatureFlag = getFeatureFlag(state, TILE_VIEW_ENABLED, true);
const { disableTileView } = state['features/base/config']; const { disableTileView } = state['features/base/config'];