From 4ccd5c607268c06c4f23d7c24d649ef3c89a0d94 Mon Sep 17 00:00:00 2001 From: yanas Date: Wed, 12 Jul 2017 10:35:00 -0500 Subject: [PATCH] Fix(AddPeopleDialog): Close dialog on submit (#1761) * Fix(AddPeopleDialog): Fixes error state and close dialog * (to-squash) Addresses comments --- css/modals/_dialog.scss | 4 ++ lang/main.json | 3 +- package.json | 1 + .../components/web/InlineDialogFailure.js | 4 +- .../invite/components/AddPeopleDialog.web.js | 62 +++++++++++++++++-- 5 files changed, 68 insertions(+), 6 deletions(-) diff --git a/css/modals/_dialog.scss b/css/modals/_dialog.scss index e4f6d5321..3ae9c1578 100644 --- a/css/modals/_dialog.scss +++ b/css/modals/_dialog.scss @@ -86,6 +86,10 @@ border: $modalMockAKInputBorder; color: inherit; } + + &-error { + margin-bottom: 8px; + } } .modal-dialog-footer { font-size: $modalButtonFontSize; diff --git a/lang/main.json b/lang/main.json index 2a15b5da8..461854422 100644 --- a/lang/main.json +++ b/lang/main.json @@ -463,7 +463,8 @@ "add": "Add", "noResults": "No matching search results", "searchPlaceholder": "Search for people and rooms to add", - "title": "Add people to your call" + "title": "Add people to your call", + "failedToAdd": "Failed to add participants" }, "inlineDialogFailure": { "msg": "We stumbled a bit.", diff --git a/package.json b/package.json index 226ec979a..d65d2015c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@atlaskit/field-text": "2.7.0", "@atlaskit/icon": "7.0.0", "@atlaskit/inline-dialog": "3.2.0", + "@atlaskit/inline-message": "2.1.1", "@atlaskit/modal-dialog": "2.1.2", "@atlaskit/multi-select": "6.2.0", "@atlaskit/spinner": "2.2.3", diff --git a/react/features/base/react/components/web/InlineDialogFailure.js b/react/features/base/react/components/web/InlineDialogFailure.js index 654e1ef3b..bad4d41b8 100644 --- a/react/features/base/react/components/web/InlineDialogFailure.js +++ b/react/features/base/react/components/web/InlineDialogFailure.js @@ -35,11 +35,13 @@ class InlineDialogFailure extends Component { const { t } = this.props; const supportLink = interfaceConfig.SUPPORT_URL; + const supportString = t('inlineDialogFailure.supportMsg'); const supportLinkElem = supportLink ? ( // eslint-disable-line no-extra-parens
- { t('inlineDialogFailure.supportMsg') } + { supportString.padEnd(supportString.length + 1) } + - { this._getUserInputForm() } + { this._renderUserInputForm() } ); } @@ -143,11 +151,12 @@ class AddPeopleDialog extends Component { * @returns {ReactElement} * @private */ - _getUserInputForm() { + _renderUserInputForm() { const { t } = this.props; return (
+ { this._renderErrorMessage() } { this.setState({ @@ -220,6 +231,49 @@ class AddPeopleDialog extends Component { } } + /** + * Renders the error message if the add doesn't succeed. + * + * @returns {ReactElement|null} + * @private + */ + _renderErrorMessage() { + if (!this.state.addToCallError) { + return null; + } + + const { t } = this.props; + const supportString = t('inlineDialogFailure.supportMsg'); + const supportLink = interfaceConfig.SUPPORT_URL; + const supportLinkContent + = ( // eslint-disable-line no-extra-parens + + + { supportString.padEnd(supportString.length + 1) } + + + + { t('inlineDialogFailure.support') } + + + . + + ); + + return ( +
+ + { supportLinkContent } + +
+ ); + } + /** * Sets the instance variable for the multi select component * element so it can be accessed directly. @@ -256,4 +310,4 @@ function _mapStateToProps(state) { } export default translate( - connect(_mapStateToProps)(AddPeopleDialog)); + connect(_mapStateToProps, { hideDialog })(AddPeopleDialog));