瀏覽代碼

feat(chat): Make chat push content to the side in tile view

master
Mihai Uscat 5 年之前
父節點
當前提交
f9d545c531

+ 20
- 0
css/_base.scss 查看文件

@@ -33,6 +33,26 @@ body {
33 33
     }
34 34
 }
35 35
 
36
+/**
37
+ * AtlasKit sets a default margin on the rendered modals, so
38
+ * when the shift-right class is set when the chat opens, we
39
+ * pad the modal container in order for the modals to be centered
40
+ * while also taking the chat size into consideration.
41
+*/
42
+@media (min-width: 480px + $sidebarWidth) {
43
+    .shift-right [class^="Modal__FillScreen"] {
44
+        padding-left: $sidebarWidth;
45
+    }
46
+}
47
+
48
+/**
49
+ * Similarly, we offset the notifications when the chat is open by
50
+ * padding the container.
51
+*/
52
+.shift-right [class^="styledFlagGroup-"] {
53
+    padding-left: $sidebarWidth;
54
+}
55
+
36 56
 .jitsi-icon svg {
37 57
     fill: white;
38 58
 }

+ 10
- 1
css/filmstrip/_tile_view.scss 查看文件

@@ -46,7 +46,16 @@
46 46
         position: fixed;
47 47
         top: 0;
48 48
         width: 100%;
49
-        z-index: $filmstripVideosZ
49
+        z-index: $filmstripVideosZ;
50
+
51
+        &.shift-right {
52
+            margin-left: $sidebarWidth;
53
+            width: calc(100% - #{$sidebarWidth});
54
+
55
+            #filmstripRemoteVideos {
56
+                width: calc(100vw - #{$sidebarWidth});
57
+            }
58
+        }
50 59
     }
51 60
 
52 61
     /**

+ 14
- 2
react/features/filmstrip/actions.web.js 查看文件

@@ -1,5 +1,7 @@
1 1
 // @flow
2 2
 
3
+import { CHAT_SIZE } from '../chat/constants';
4
+
3 5
 import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
4 6
 import { calculateThumbnailSizeForHorizontalView, calculateThumbnailSizeForTileView } from './functions';
5 7
 
@@ -13,15 +15,25 @@ const TILE_VIEW_SIDE_MARGINS = 10 * 2;
13 15
  *
14 16
  * @param {Object} dimensions - Whether the filmstrip is visible.
15 17
  * @param {Object} windowSize - The size of the window.
18
+ * @param {boolean} isChatOpen - Whether the chat panel is displayed, in
19
+ * order to properly compute the tile view size.
16 20
  * @returns {{
17 21
  *     type: SET_TILE_VIEW_DIMENSIONS,
18 22
  *     dimensions: Object
19 23
  * }}
20 24
  */
21
-export function setTileViewDimensions(dimensions: Object, windowSize: Object) {
25
+export function setTileViewDimensions(dimensions: Object, windowSize: Object, isChatOpen: boolean) {
26
+    const { clientWidth, clientHeight } = windowSize;
27
+    let widthToUse = clientWidth;
28
+
29
+    if (isChatOpen) {
30
+        widthToUse -= CHAT_SIZE;
31
+    }
32
+
22 33
     const thumbnailSize = calculateThumbnailSizeForTileView({
23 34
         ...dimensions,
24
-        ...windowSize
35
+        clientWidth: widthToUse,
36
+        clientHeight
25 37
     });
26 38
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
27 39
 

+ 1
- 1
react/features/filmstrip/components/native/TileView.js 查看文件

@@ -10,7 +10,7 @@ import type { Dispatch } from 'redux';
10 10
 
11 11
 import { connect } from '../../../base/redux';
12 12
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
13
-import { setTileViewDimensions } from '../../actions';
13
+import { setTileViewDimensions } from '../../actions.native';
14 14
 
15 15
 import Thumbnail from './Thumbnail';
16 16
 import styles from './styles';

+ 4
- 2
react/features/filmstrip/components/web/Filmstrip.js 查看文件

@@ -371,13 +371,15 @@ function _mapStateToProps(state) {
371 371
     const reduceHeight
372 372
         = !isFilmstripOnly && state['features/toolbox'].visible && interfaceConfig.TOOLBAR_BUTTONS.length;
373 373
     const remoteVideosVisible = shouldRemoteVideosBeVisible(state);
374
-    const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${reduceHeight ? 'reduce-height' : ''}`.trim();
374
+    const { isOpen: shiftRight } = state['features/chat'];
375
+    const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${
376
+        reduceHeight ? 'reduce-height' : ''
377
+    } ${shiftRight ? 'shift-right' : ''}`.trim();
375 378
     const videosClassName = `filmstrip__videos${
376 379
         isFilmstripOnly ? ' filmstrip__videos-filmstripOnly' : ''}${
377 380
         visible ? '' : ' hidden'}`;
378 381
     const { gridDimensions = {}, filmstripWidth } = state['features/filmstrip'].tileViewDimensions;
379 382
 
380
-
381 383
     return {
382 384
         _className: className,
383 385
         _columns: gridDimensions.columns,

+ 12
- 5
react/features/filmstrip/middleware.web.js 查看文件

@@ -10,7 +10,7 @@ import {
10 10
 } from '../video-layout';
11 11
 
12 12
 import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
13
-import { setHorizontalViewDimensions, setTileViewDimensions } from './actions';
13
+import { setHorizontalViewDimensions, setTileViewDimensions } from './actions.web';
14 14
 
15 15
 import './subscriber.web';
16 16
 
@@ -29,11 +29,18 @@ MiddlewareRegistry.register(store => next => action => {
29 29
         case LAYOUTS.TILE_VIEW: {
30 30
             const { gridDimensions } = state['features/filmstrip'].tileViewDimensions;
31 31
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
32
+            const { isOpen } = state['features/chat'];
32 33
 
33
-            store.dispatch(setTileViewDimensions(gridDimensions, {
34
-                clientHeight,
35
-                clientWidth
36
-            }));
34
+            store.dispatch(
35
+                setTileViewDimensions(
36
+                    gridDimensions,
37
+                    {
38
+                        clientHeight,
39
+                        clientWidth
40
+                    },
41
+                    isOpen
42
+                )
43
+            );
37 44
             break;
38 45
         }
39 46
         case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW:

+ 56
- 10
react/features/filmstrip/subscriber.web.js 查看文件

@@ -5,7 +5,7 @@ import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
5 5
 import { StateListenerRegistry, equals } from '../base/redux';
6 6
 import { getCurrentLayout, getTileViewGridDimensions, shouldDisplayTileView, LAYOUTS } from '../video-layout';
7 7
 
8
-import { setHorizontalViewDimensions, setTileViewDimensions } from './actions';
8
+import { setHorizontalViewDimensions, setTileViewDimensions } from './actions.web';
9 9
 
10 10
 /**
11 11
  * Listens for changes in the number of participants to calculate the dimensions of the tile view grid and the tiles.
@@ -19,12 +19,19 @@ StateListenerRegistry.register(
19 19
             const gridDimensions = getTileViewGridDimensions(state);
20 20
             const oldGridDimensions = state['features/filmstrip'].tileViewDimensions.gridDimensions;
21 21
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
22
+            const { isOpen } = state['features/chat'];
22 23
 
23 24
             if (!equals(gridDimensions, oldGridDimensions)) {
24
-                store.dispatch(setTileViewDimensions(gridDimensions, {
25
-                    clientHeight,
26
-                    clientWidth
27
-                }));
25
+                store.dispatch(
26
+                    setTileViewDimensions(
27
+                        gridDimensions,
28
+                        {
29
+                            clientHeight,
30
+                            clientWidth
31
+                        },
32
+                        isOpen
33
+                    )
34
+                );
28 35
             }
29 36
         }
30 37
     });
@@ -40,12 +47,18 @@ StateListenerRegistry.register(
40 47
         switch (layout) {
41 48
         case LAYOUTS.TILE_VIEW: {
42 49
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
50
+            const { isOpen } = state['features/chat'];
43 51
 
44
-            store.dispatch(setTileViewDimensions(
45
-                getTileViewGridDimensions(state), {
46
-                    clientHeight,
47
-                    clientWidth
48
-                }));
52
+            store.dispatch(
53
+                setTileViewDimensions(
54
+                    getTileViewGridDimensions(state),
55
+                    {
56
+                        clientHeight,
57
+                        clientWidth
58
+                    },
59
+                    isOpen
60
+                )
61
+            );
49 62
             break;
50 63
         }
51 64
         case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW:
@@ -76,3 +89,36 @@ StateListenerRegistry.register(
76 89
         }
77 90
     }
78 91
 );
92
+
93
+/**
94
+ * Listens for changes in the chat state to calculate the dimensions of the tile view grid and the tiles.
95
+ */
96
+StateListenerRegistry.register(
97
+    /* selector */ state => state['features/chat'].isOpen,
98
+    /* listener */ (isChatOpen, store) => {
99
+        const state = store.getState();
100
+
101
+        if (isChatOpen) {
102
+            // $FlowFixMe
103
+            document.body.classList.add('shift-right');
104
+        } else {
105
+            // $FlowFixMe
106
+            document.body.classList.remove('shift-right');
107
+        }
108
+
109
+        if (shouldDisplayTileView(state)) {
110
+            const gridDimensions = getTileViewGridDimensions(state);
111
+            const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
112
+
113
+            store.dispatch(
114
+                setTileViewDimensions(
115
+                    gridDimensions,
116
+                    {
117
+                        clientHeight,
118
+                        clientWidth
119
+                    },
120
+                    isChatOpen
121
+                )
122
+            );
123
+        }
124
+    });

Loading…
取消
儲存