Skip to content

Commit 3dfaa65

Browse files
authored
[Rooms] Fix overflow gallery to use all available space when you are a consumer (#3825)
* Fix overflow gallery to use all available space when there is no local video * Change files * Duplicate change files for beta release * remove unneeded layout prop from OverflowGallery
1 parent 33c624e commit 3dfaa65

6 files changed

Lines changed: 28 additions & 14 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Overflow gallery",
5+
"comment": "Fix overflow gallery to use all available space when there is no local video",
6+
"packageName": "@azure/communication-react",
7+
"email": "79475487+mgamis-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Overflow gallery",
5+
"comment": "Fix overflow gallery to use all available space when there is no local video",
6+
"packageName": "@azure/communication-react",
7+
"email": "79475487+mgamis-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/react-components/src/components/VideoGallery/DefaultLayout.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ export const DefaultLayout = (props: DefaultLayoutProps): JSX.Element => {
118118
onChildrenPerPageChange={(n: number) => {
119119
childrenPerPage.current = n;
120120
}}
121-
/* @conditional-compile-remove(gallery-layouts) */
122-
layout={'default'}
123121
parentWidth={parentWidth}
124122
/>
125123
);

packages/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const FloatingLocalVideoLayout = (props: FloatingLocalVideoLayoutProps):
208208
isShort={isShort}
209209
onFetchTilesToRender={setIndexesToRender}
210210
isNarrow={isNarrow}
211-
shouldFloatLocalVideo={true}
211+
shouldFloatLocalVideo={!!localVideoComponent}
212212
overflowGalleryElements={overflowGalleryTiles}
213213
horizontalGalleryStyles={styles?.horizontalGallery}
214214
/* @conditional-compile-remove(vertical-gallery) */
@@ -230,7 +230,8 @@ export const FloatingLocalVideoLayout = (props: FloatingLocalVideoLayoutProps):
230230
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,
231231
setIndexesToRender,
232232
/* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,
233-
parentWidth
233+
parentWidth,
234+
localVideoComponent
234235
]);
235236

236237
return (

packages/react-components/src/components/VideoGallery/OverflowGallery.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { VerticalGalleryStyles } from '../VerticalGallery';
1313
/* @conditional-compile-remove(vertical-gallery) */
1414
import { OverflowGalleryPosition } from '../VideoGallery';
1515
/* @conditional-compile-remove(gallery-layouts) */
16-
import { VideoGalleryLayout } from '../VideoGallery';
1716
import { ScrollableHorizontalGallery } from './ScrollableHorizontalGallery';
1817
import {
1918
SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM,
@@ -46,8 +45,6 @@ export const OverflowGallery = (props: {
4645
/* @conditional-compile-remove(vertical-gallery) */
4746
overflowGalleryPosition?: OverflowGalleryPosition;
4847
onChildrenPerPageChange?: (childrenPerPage: number) => void;
49-
/* @conditional-compile-remove(gallery-layouts) */
50-
layout?: VideoGalleryLayout;
5148
parentWidth?: number;
5249
}): JSX.Element => {
5350
const {
@@ -94,14 +91,13 @@ export const OverflowGallery = (props: {
9491
const scrollableHorizontalGalleryContainerStyles = useMemo(() => {
9592
if (isNarrow && parentWidth) {
9693
return {
97-
width:
98-
props.layout === 'default'
99-
? `${_convertPxToRem(parentWidth) - 1}rem`
100-
: `${_convertPxToRem(parentWidth) - SMALL_FLOATING_MODAL_SIZE_REM.width - 1}rem`
94+
width: shouldFloatLocalVideo
95+
? `${_convertPxToRem(parentWidth) - SMALL_FLOATING_MODAL_SIZE_REM.width - 1}rem`
96+
: `${_convertPxToRem(parentWidth) - 1}rem`
10197
};
10298
}
10399
return undefined;
104-
}, [isNarrow, parentWidth, props.layout]);
100+
}, [isNarrow, parentWidth, shouldFloatLocalVideo]);
105101

106102
/* @conditional-compile-remove(vertical-gallery) */
107103
if (overflowGalleryPosition === 'verticalRight') {

packages/react-components/src/components/VideoGallery/SpeakerVideoLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const SpeakerVideoLayout = (props: SpeakerVideoLayoutProps): JSX.Element
183183
isShort={isShort}
184184
onFetchTilesToRender={setIndexesToRender}
185185
isNarrow={isNarrow}
186-
shouldFloatLocalVideo={true}
186+
shouldFloatLocalVideo={!!localVideoComponent}
187187
overflowGalleryElements={overflowGalleryTiles}
188188
horizontalGalleryStyles={styles?.horizontalGallery}
189189
/* @conditional-compile-remove(vertical-gallery) */
@@ -205,7 +205,8 @@ export const SpeakerVideoLayout = (props: SpeakerVideoLayoutProps): JSX.Element
205205
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryPosition,
206206
setIndexesToRender,
207207
/* @conditional-compile-remove(vertical-gallery) */ styles?.verticalGallery,
208-
parentWidth
208+
parentWidth,
209+
localVideoComponent
209210
]);
210211

211212
return (

0 commit comments

Comments
 (0)