From 2209394d094452b22c8d33ec05d4493195164cc7 Mon Sep 17 00:00:00 2001 From: Mihai-Andrei Uscat <52234168+muscat1@users.noreply.github.com> Date: Thu, 22 Jul 2021 09:37:44 +0300 Subject: [PATCH] feat(Filmstrip): Collapse filmstrip to avoid toolbar overlap on mobile --- css/_variables.scss | 1 + css/filmstrip/_tile_view.scss | 15 +++++++- .../filmstrip/components/web/Filmstrip.js | 38 ++++++++++++++++--- react/features/filmstrip/constants.js | 5 +++ 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/css/_variables.scss b/css/_variables.scss index f296aa1bca..1b0a6a49bf 100644 --- a/css/_variables.scss +++ b/css/_variables.scss @@ -46,6 +46,7 @@ $menuBG:#242528; $newToolbarFontSize: 24px; $newToolbarHangupFontSize: 32px; $newToolbarSize: 48px; +$newToolbarSizeMobile: 60px; $newToolbarSizeWithPadding: calc(#{$newToolbarSize} + 24px); $toolbarTitleFontSize: 19px; $overflowMenuItemColor: #fff; diff --git a/css/filmstrip/_tile_view.scss b/css/filmstrip/_tile_view.scss index bd516aac1a..9db32db740 100644 --- a/css/filmstrip/_tile_view.scss +++ b/css/filmstrip/_tile_view.scss @@ -35,6 +35,7 @@ display: flex; justify-content: center; align-items: center; + transition: margin-bottom .3s ease-in; } .filmstrip { @@ -52,11 +53,23 @@ margin-left: $sidebarWidth; width: calc(100% - #{$sidebarWidth}); - .remote-videos{ + .remote-videos { width: calc(100vw - #{$sidebarWidth}); } } } + + &.collapse { + #remoteVideos { + height: calc(100% - #{$newToolbarSizeMobile}) !important; + margin-bottom: $newToolbarSizeMobile; + } + + .remote-videos { + // !important is needed here as overflow is set via element.style in a FixedSizeGrid. + overflow: hidden auto !important; + } + } } /** diff --git a/react/features/filmstrip/components/web/Filmstrip.js b/react/features/filmstrip/components/web/Filmstrip.js index 50c0da29d9..ff9c6d82f2 100644 --- a/react/features/filmstrip/components/web/Filmstrip.js +++ b/react/features/filmstrip/components/web/Filmstrip.js @@ -10,6 +10,7 @@ import { sendAnalytics } from '../../../analytics'; import { getToolbarButtons } from '../../../base/config'; +import { isMobileBrowser } from '../../../base/environment/utils'; import { translate } from '../../../base/i18n'; import { Icon, IconMenuDown, IconMenuUp } from '../../../base/icons'; import { connect } from '../../../base/redux'; @@ -17,7 +18,13 @@ import { showToolbox } from '../../../toolbox/actions.web'; import { isButtonEnabled, isToolboxVisible } from '../../../toolbox/functions.web'; import { LAYOUTS, getCurrentLayout } from '../../../video-layout'; import { setFilmstripVisible, setVisibleRemoteParticipants } from '../../actions'; -import { TILE_HORIZONTAL_MARGIN, TILE_VERTICAL_MARGIN, TOOLBAR_HEIGHT } from '../../constants'; +import { + ASPECT_RATIO_BREAKPOINT, + TILE_HORIZONTAL_MARGIN, + TILE_VERTICAL_MARGIN, + TOOLBAR_HEIGHT, + TOOLBAR_HEIGHT_MOBILE +} from '../../constants'; import { shouldRemoteVideosBeVisible } from '../../functions'; import AudioTracksContainer from './AudioTracksContainer'; @@ -485,10 +492,6 @@ function _mapStateToProps(state) { const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length; const remoteVideosVisible = shouldRemoteVideosBeVisible(state); const { isOpen: shiftRight } = state['features/chat']; - const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${ - reduceHeight ? 'reduce-height' : '' - } ${shiftRight ? 'shift-right' : ''}`.trim(); - const videosClassName = `filmstrip__videos${visible ? '' : ' hidden'}`; const { gridDimensions = {}, filmstripHeight, @@ -496,12 +499,35 @@ function _mapStateToProps(state) { thumbnailSize: tileViewThumbnailSize } = state['features/filmstrip'].tileViewDimensions; const _currentLayout = getCurrentLayout(state); + + const { clientHeight, clientWidth } = state['features/base/responsive-ui']; + const availableSpace = clientHeight - filmstripHeight; + let filmstripPadding = 0; + + if (availableSpace > 0) { + const paddingValue = TOOLBAR_HEIGHT_MOBILE - availableSpace; + + if (paddingValue > 0) { + filmstripPadding = paddingValue; + } + } else { + filmstripPadding = TOOLBAR_HEIGHT_MOBILE; + } + + const collapseTileView = reduceHeight + && isMobileBrowser() + && clientWidth <= ASPECT_RATIO_BREAKPOINT; + + const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${ + reduceHeight ? 'reduce-height' : '' + } ${shiftRight ? 'shift-right' : ''} ${collapseTileView ? 'collapse' : ''}`.trim(); + const videosClassName = `filmstrip__videos${visible ? '' : ' hidden'}`; let _thumbnailSize, remoteFilmstripHeight, remoteFilmstripWidth; switch (_currentLayout) { case LAYOUTS.TILE_VIEW: _thumbnailSize = tileViewThumbnailSize; - remoteFilmstripHeight = filmstripHeight; + remoteFilmstripHeight = filmstripHeight - (collapseTileView && filmstripPadding > 0 ? filmstripPadding : 0); remoteFilmstripWidth = filmstripWidth; break; case LAYOUTS.VERTICAL_FILMSTRIP_VIEW: { diff --git a/react/features/filmstrip/constants.js b/react/features/filmstrip/constants.js index 4f33006215..0b83fd8ded 100644 --- a/react/features/filmstrip/constants.js +++ b/react/features/filmstrip/constants.js @@ -163,6 +163,11 @@ export const TILE_HORIZONTAL_MARGIN = 4; */ export const TOOLBAR_HEIGHT = 72; +/** + * The height of the whole toolbar. + */ +export const TOOLBAR_HEIGHT_MOBILE = 60; + /** * The size of the horizontal border of a thumbnail. *