Parcourir la source

feat(prejoin) show error when trying to join and name is required

master
Tudor-Ovidiu Avram il y a 4 ans
Parent
révision
10c2652a4f
4 fichiers modifiés avec 53 ajouts et 12 suppressions
  1. 1
    0
      .gitignore
  2. 10
    0
      css/_prejoin.scss
  3. 1
    0
      lang/main.json
  4. 41
    12
      react/features/prejoin/components/Prejoin.js

+ 1
- 0
.gitignore Voir le fichier

@@ -84,3 +84,4 @@ android/app/google-services.json
84 84
 ios/app/dropbox.key
85 85
 ios/app/GoogleService-Info.plist
86 86
 
87
+.vscode

+ 10
- 0
css/_prejoin.scss Voir le fichier

@@ -39,6 +39,16 @@
39 39
         margin-bottom: 14px;
40 40
         width: 100%;
41 41
     }
42
+
43
+    &-error {
44
+        color: white;
45
+        background-color: rgba(229, 75, 75, 0.5);
46
+        width: 100%;
47
+        padding: 3px;
48
+        margin-top: 4px;
49
+        font-size: 13px;
50
+        text-align: center;
51
+    }
42 52
 }
43 53
 
44 54
 @mixin name-placeholder {

+ 1
- 0
lang/main.json Voir le fichier

@@ -520,6 +520,7 @@
520 520
         "errorDialOutDisconnected": "Could not dial out. Disconnected",
521 521
         "errorDialOutFailed": "Could not dial out. Call failed",
522 522
         "errorDialOutStatus": "Error getting dial out status",
523
+        "errorMissingName": "Please enter your name to join the meeting",
523 524
         "errorStatusCode": "Error dialing out, status code: {{status}}",
524 525
         "errorValidation": "Number validation failed",
525 526
         "iWantToDialIn": "I want to dial in",

+ 41
- 12
react/features/prejoin/components/Prejoin.js Voir le fichier

@@ -48,11 +48,6 @@ type Props = {
48 48
      */
49 49
     hasJoinByPhoneButton: boolean,
50 50
 
51
-    /**
52
-     * If join button is disabled or not.
53
-     */
54
-    joinButtonDisabled: boolean,
55
-
56 51
     /**
57 52
      * Joins the current meeting.
58 53
      */
@@ -98,6 +93,11 @@ type Props = {
98 93
      */
99 94
     showCameraPreview: boolean,
100 95
 
96
+    /**
97
+     * If should show an error when joining without a name.
98
+     */
99
+    showErrorOnJoin: boolean,
100
+
101 101
     /**
102 102
      * Flag signaling the visibility of join label, input and buttons
103 103
      */
@@ -131,6 +131,11 @@ type Props = {
131 131
 
132 132
 type State = {
133 133
 
134
+    /**
135
+     * Flag controlling the visibility of the error label.
136
+     */
137
+    showError: boolean,
138
+
134 139
     /**
135 140
      * Flag controlling the visibility of the 'join by phone' buttons.
136 141
      */
@@ -161,16 +166,38 @@ class Prejoin extends Component<Props, State> {
161 166
         super(props);
162 167
 
163 168
         this.state = {
169
+            showError: false,
164 170
             showJoinByPhoneButtons: false
165 171
         };
166 172
 
167 173
         this._closeDialog = this._closeDialog.bind(this);
168 174
         this._showDialog = this._showDialog.bind(this);
175
+        this._onJoinButtonClick = this._onJoinButtonClick.bind(this);
169 176
         this._onToggleButtonClick = this._onToggleButtonClick.bind(this);
170 177
         this._onDropdownClose = this._onDropdownClose.bind(this);
171 178
         this._onOptionsClick = this._onOptionsClick.bind(this);
172 179
         this._setName = this._setName.bind(this);
173 180
     }
181
+    _onJoinButtonClick: () => void;
182
+
183
+    /**
184
+     * Handler for the join button.
185
+     *
186
+     * @param {Object} e - The synthetic event.
187
+     * @returns {void}
188
+     */
189
+    _onJoinButtonClick() {
190
+        if (this.props.showErrorOnJoin) {
191
+            this.setState({
192
+                showError: true
193
+            });
194
+
195
+            return;
196
+        }
197
+
198
+        this.setState({ showError: false });
199
+        this.props.joinConference();
200
+    }
174 201
 
175 202
     _onToggleButtonClick: () => void;
176 203
 
@@ -258,7 +285,6 @@ class Prejoin extends Component<Props, State> {
258 285
      */
259 286
     render() {
260 287
         const {
261
-            joinButtonDisabled,
262 288
             hasJoinByPhoneButton,
263 289
             joinConference,
264 290
             joinConferenceWithoutAudio,
@@ -272,8 +298,8 @@ class Prejoin extends Component<Props, State> {
272 298
             videoTrack
273 299
         } = this.props;
274 300
 
275
-        const { _closeDialog, _onDropdownClose, _onOptionsClick, _setName, _showDialog } = this;
276
-        const { showJoinByPhoneButtons } = this.state;
301
+        const { _closeDialog, _onDropdownClose, _onJoinButtonClick, _onOptionsClick, _setName, _showDialog } = this;
302
+        const { showJoinByPhoneButtons, showError } = this.state;
277 303
 
278 304
         return (
279 305
             <PreMeetingScreen
@@ -294,6 +320,10 @@ class Prejoin extends Component<Props, State> {
294 320
                                 placeHolder = { t('dialog.enterDisplayName') }
295 321
                                 value = { name } />
296 322
 
323
+                            {showError && <div
324
+                                className = 'prejoin-error'
325
+                                data-testid = 'prejoin.errorMessage'>{t('prejoin.errorMissingName')}</div>}
326
+
297 327
                             <div className = 'prejoin-preview-dropdown-container'>
298 328
                                 <InlineDialog
299 329
                                     content = { <div className = 'prejoin-preview-dropdown-btns'>
@@ -319,9 +349,8 @@ class Prejoin extends Component<Props, State> {
319 349
                                     isOpen = { showJoinByPhoneButtons }
320 350
                                     onClose = { _onDropdownClose }>
321 351
                                     <ActionButton
322
-                                        disabled = { joinButtonDisabled }
323 352
                                         hasOptions = { true }
324
-                                        onClick = { joinConference }
353
+                                        onClick = { _onJoinButtonClick }
325 354
                                         onOptionsClick = { _onOptionsClick }
326 355
                                         testId = 'prejoin.joinMeeting'
327 356
                                         type = 'primary'>
@@ -383,7 +412,7 @@ class Prejoin extends Component<Props, State> {
383 412
  */
384 413
 function mapStateToProps(state, ownProps): Object {
385 414
     const name = getDisplayName(state);
386
-    const joinButtonDisabled = isDisplayNameRequired(state) && !name;
415
+    const showErrorOnJoin = isDisplayNameRequired(state) && !name;
387 416
     const { showJoinActions } = ownProps;
388 417
     const isInviteButtonEnabled = isButtonEnabled('invite');
389 418
 
@@ -397,11 +426,11 @@ function mapStateToProps(state, ownProps): Object {
397 426
 
398 427
     return {
399 428
         buttonIsToggled: isPrejoinSkipped(state),
400
-        joinButtonDisabled,
401 429
         name,
402 430
         deviceStatusVisible: isDeviceStatusVisible(state),
403 431
         roomName: getRoomName(state),
404 432
         showDialog: isJoinByPhoneDialogVisible(state),
433
+        showErrorOnJoin,
405 434
         hasJoinByPhoneButton: isJoinByPhoneButtonVisible(state),
406 435
         showCameraPreview: !isVideoMutedByUser(state),
407 436
         showConferenceInfo,

Chargement…
Annuler
Enregistrer