Selaa lähdekoodia

Finally! Let there be... responsive-ui!

We started on the way to responsive UI and its design with aspect ratio
and keeping the filmstrip on the short side of the app's visible
rectangle.

Shortly, we're going to introduce reduced UI for Picture-in-Picture. And
that's where we'll need another dimensions-based detector akin to the
aspect ratio detector.

While the AspectRatioDetector, the up-and-coming ReducedUIDetector, and
their base DimensionsDetector are definitely separate abstractions and
implementations not mixed for the purposes of easy extensibility and
maintenance, the three of them are our building blocks on top of which
we'll build our responsive UI.
master
Lyubo Marinov 7 vuotta sitten
vanhempi
commit
c9d8b5c827

+ 1
- 1
react/features/app-settings/components/AbstractAppSettings.js Näytä tiedosto

@@ -173,7 +173,7 @@ export function _mapStateToProps(state: Object) {
173 173
     const _profile = getProfile(state);
174 174
 
175 175
     return {
176
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio,
176
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
177 177
         _profile,
178 178
         _serverURL,
179 179
         _visible: state['features/app-settings'].visible

+ 1
- 1
react/features/app-settings/components/AppSettings.native.js Näytä tiedosto

@@ -12,9 +12,9 @@ import {
12 12
 } from 'react-native';
13 13
 import { connect } from 'react-redux';
14 14
 
15
-import { ASPECT_RATIO_NARROW } from '../../base/aspect-ratio';
16 15
 import { translate } from '../../base/i18n';
17 16
 import { getSafetyOffset, isIPad } from '../../base/react';
17
+import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
18 18
 
19 19
 import { _mapStateToProps, AbstractAppSettings } from './AbstractAppSettings';
20 20
 import { hideAppSettings } from '../actions';

+ 2
- 2
react/features/app-settings/components/FormRow.native.js Näytä tiedosto

@@ -4,9 +4,9 @@ import React, { Component } from 'react';
4 4
 import { Text, View } from 'react-native';
5 5
 import { connect } from 'react-redux';
6 6
 
7
-import { ASPECT_RATIO_WIDE } from '../../base/aspect-ratio';
8 7
 import { translate } from '../../base/i18n';
9 8
 import { getSafetyOffset } from '../../base/react';
9
+import { ASPECT_RATIO_WIDE } from '../../base/responsive-ui';
10 10
 
11 11
 import styles, { ANDROID_UNDERLINE_COLOR, CONTAINER_PADDING } from './styles';
12 12
 
@@ -162,7 +162,7 @@ class FormRow extends Component<Props> {
162 162
  */
163 163
 export function _mapStateToProps(state: Object) {
164 164
     return {
165
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio
165
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio
166 166
     };
167 167
 }
168 168
 

+ 2
- 2
react/features/app-settings/components/FormSectionHeader.native.js Näytä tiedosto

@@ -4,9 +4,9 @@ import React, { Component } from 'react';
4 4
 import { Text, View } from 'react-native';
5 5
 import { connect } from 'react-redux';
6 6
 
7
-import { ASPECT_RATIO_WIDE } from '../../base/aspect-ratio';
8 7
 import { translate } from '../../base/i18n';
9 8
 import { getSafetyOffset } from '../../base/react';
9
+import { ASPECT_RATIO_WIDE } from '../../base/responsive-ui';
10 10
 
11 11
 import styles, { CONTAINER_PADDING } from './styles';
12 12
 
@@ -110,7 +110,7 @@ class FormSectionHeader extends Component<Props> {
110 110
  */
111 111
 export function _mapStateToProps(state: Object) {
112 112
     return {
113
-        _aspectRatio: state['features/base/aspect-ratio'].aspectRatio
113
+        _aspectRatio: state['features/base/responsive-ui'].aspectRatio
114 114
     };
115 115
 }
116 116
 

+ 1
- 1
react/features/app/components/App.native.js Näytä tiedosto

@@ -6,8 +6,8 @@ import { Linking } from 'react-native';
6 6
 
7 7
 import '../../analytics';
8 8
 import '../../authentication';
9
-import { AspectRatioDetector } from '../../base/aspect-ratio';
10 9
 import { Platform } from '../../base/react';
10
+import { AspectRatioDetector } from '../../base/responsive-ui';
11 11
 import '../../mobile/audio-mode';
12 12
 import '../../mobile/background';
13 13
 import '../../mobile/callkit';

+ 0
- 1
react/features/base/dimensions-detector/components/index.js Näytä tiedosto

@@ -1 +0,0 @@
1
-export { default as DimensionsDetector } from './DimensionsDetector';

+ 0
- 1
react/features/base/dimensions-detector/index.js Näytä tiedosto

@@ -1 +0,0 @@
1
-export * from './components';

react/features/base/aspect-ratio/actionTypes.js → react/features/base/responsive-ui/actionTypes.js Näytä tiedosto


react/features/base/aspect-ratio/actions.js → react/features/base/responsive-ui/actions.js Näytä tiedosto

@@ -25,7 +25,7 @@ export function setAspectRatio(width: number, height: number): Object {
25 25
                 = width < height ? ASPECT_RATIO_NARROW : ASPECT_RATIO_WIDE;
26 26
 
27 27
             if (aspectRatio
28
-                    !== getState()['features/base/aspect-ratio'].aspectRatio) {
28
+                    !== getState()['features/base/responsive-ui'].aspectRatio) {
29 29
                 return dispatch({
30 30
                     type: SET_ASPECT_RATIO,
31 31
                     aspectRatio

react/features/base/aspect-ratio/components/AspectRatioAware.js → react/features/base/responsive-ui/components/AspectRatioAware.js Näytä tiedosto

@@ -67,11 +67,11 @@ export function makeAspectRatioAware(
67 67
  * @param {Object} state - The whole redux state.
68 68
  * @private
69 69
  * @returns {{
70
- *      aspectRatio: Symbol
70
+ *     aspectRatio: Symbol
71 71
  * }}
72 72
  */
73 73
 function _mapStateToProps(state) {
74 74
     return {
75
-        aspectRatio: state['features/base/aspect-ratio'].aspectRatio
75
+        aspectRatio: state['features/base/responsive-ui'].aspectRatio
76 76
     };
77 77
 }

react/features/base/aspect-ratio/components/AspectRatioDetector.native.js → react/features/base/responsive-ui/components/AspectRatioDetector.js Näytä tiedosto

@@ -3,9 +3,8 @@
3 3
 import React, { Component } from 'react';
4 4
 import { connect } from 'react-redux';
5 5
 
6
-import { DimensionsDetector } from '../../dimensions-detector';
7
-
8 6
 import { setAspectRatio } from '../actions';
7
+import DimensionsDetector from './DimensionsDetector';
9 8
 
10 9
 /**
11 10
  * AspectRatioDetector component's property types.

react/features/base/dimensions-detector/components/DimensionsDetector.native.js → react/features/base/responsive-ui/components/DimensionsDetector.native.js Näytä tiedosto


+ 0
- 0
react/features/base/responsive-ui/components/DimensionsDetector.web.js Näytä tiedosto


react/features/base/aspect-ratio/components/index.js → react/features/base/responsive-ui/components/index.js Näytä tiedosto

@@ -1,2 +1,3 @@
1 1
 export * from './AspectRatioAware';
2 2
 export { default as AspectRatioDetector } from './AspectRatioDetector';
3
+export { default as DimensionsDetector } from './DimensionsDetector';

react/features/base/dimensions-detector/components/styles.js → react/features/base/responsive-ui/components/styles.js Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 import { createStyleSheet } from '../../styles';
2 2
 
3 3
 /**
4
- * The styles of the feature base/aspect-ratio.
4
+ * The styles of the feature base/responsive-ui.
5 5
  */
6 6
 export default createStyleSheet({
7 7
     /**

react/features/base/aspect-ratio/constants.js → react/features/base/responsive-ui/constants.js Näytä tiedosto


react/features/base/aspect-ratio/index.js → react/features/base/responsive-ui/index.js Näytä tiedosto


react/features/base/aspect-ratio/reducer.js → react/features/base/responsive-ui/reducer.js Näytä tiedosto

@@ -4,14 +4,14 @@ import { SET_ASPECT_RATIO } from './actionTypes';
4 4
 import { ASPECT_RATIO_NARROW } from './constants';
5 5
 
6 6
 /**
7
- * The initial redux state of the feature base/aspect-ratio.
7
+ * The initial redux state of the feature base/responsive-ui.
8 8
  */
9 9
 const _INITIAL_STATE = {
10 10
     aspectRatio: ASPECT_RATIO_NARROW
11 11
 };
12 12
 
13 13
 ReducerRegistry.register(
14
-    'features/base/aspect-ratio',
14
+    'features/base/responsive-ui',
15 15
     (state = _INITIAL_STATE, action) => {
16 16
         switch (action.type) {
17 17
         case SET_ASPECT_RATIO:

+ 3
- 3
react/features/filmstrip/components/Filmstrip.native.js Näytä tiedosto

@@ -5,14 +5,14 @@ import React, { Component } from 'react';
5 5
 import { ScrollView } from 'react-native';
6 6
 import { connect } from 'react-redux';
7 7
 
8
+import { Container } from '../../base/react';
8 9
 import {
9 10
     isNarrowAspectRatio,
10 11
     makeAspectRatioAware
11
-} from '../../base/aspect-ratio';
12
-import { Container } from '../../base/react';
12
+} from '../../base/responsive-ui';
13 13
 
14
-import Thumbnail from './Thumbnail';
15 14
 import { styles } from './_';
15
+import Thumbnail from './Thumbnail';
16 16
 
17 17
 /**
18 18
  * Implements a React {@link Component} which represents the filmstrip on

+ 4
- 4
react/features/toolbox/components/Toolbox.native.js Näytä tiedosto

@@ -9,10 +9,6 @@ import {
9 9
     createToolbarEvent,
10 10
     sendAnalytics
11 11
 } from '../../analytics';
12
-import {
13
-    isNarrowAspectRatio,
14
-    makeAspectRatioAware
15
-} from '../../base/aspect-ratio';
16 12
 import { toggleAudioOnly } from '../../base/conference';
17 13
 import {
18 14
     MEDIA_TYPE,
@@ -22,6 +18,10 @@ import {
22 18
     VIDEO_MUTISM_AUTHORITY
23 19
 } from '../../base/media';
24 20
 import { Container } from '../../base/react';
21
+import {
22
+    isNarrowAspectRatio,
23
+    makeAspectRatioAware
24
+} from '../../base/responsive-ui';
25 25
 import { ColorPalette } from '../../base/styles';
26 26
 import { beginRoomLockRequest } from '../../room-lock';
27 27
 import { beginShareRoom } from '../../share-room';

Loading…
Peruuta
Tallenna