From 6473e6fa3c5e554ddb7bdedad22c1cae2c375a1d Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Fri, 16 Aug 2019 16:35:08 -0300 Subject: [PATCH] Rename context functions and restruct the join load component --- bigbluebutton-html5/imports/startup/client/base.jsx | 4 ++-- bigbluebutton-html5/imports/startup/client/intl.jsx | 4 ++-- .../ui/components/authenticated-handler/component.jsx | 4 ++-- .../imports/ui/components/join-handler/component.jsx | 4 ++-- .../imports/ui/components/join-loading/component.jsx | 11 +++++------ .../ui/components/join-loading/context/context.jsx | 10 +++++----- .../imports/ui/components/subscriptions/component.jsx | 5 +++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 8ba3051b01..7b4dbe945e 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -16,7 +16,7 @@ import Breakouts from '/imports/api/breakouts'; import AudioService from '/imports/ui/components/audio/service'; import { FormattedMessage } from 'react-intl'; import { notify } from '/imports/ui/services/notification'; -import { withConsumer } from '/imports/ui/components/join-loading/context/context'; +import { withJoinLoadingConsumer } from '/imports/ui/components/join-loading/context/context'; const HTML = document.getElementsByTagName('html')[0]; @@ -313,4 +313,4 @@ const BaseContainer = withTracker(() => { }; })(Base); -export default withConsumer(BaseContainer); +export default withJoinLoadingConsumer(BaseContainer); diff --git a/bigbluebutton-html5/imports/startup/client/intl.jsx b/bigbluebutton-html5/imports/startup/client/intl.jsx index f319a8bf19..8f541853ec 100644 --- a/bigbluebutton-html5/imports/startup/client/intl.jsx +++ b/bigbluebutton-html5/imports/startup/client/intl.jsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; import Settings from '/imports/ui/services/settings'; -import { withConsumer } from '/imports/ui/components/join-loading/context/context'; +import { withJoinLoadingConsumer } from '/imports/ui/components/join-loading/context/context'; // currently supported locales. import ar from 'react-intl/locale-data/ar'; @@ -155,7 +155,7 @@ class IntlStartup extends Component { } } -export default withConsumer(IntlStartup); +export default withJoinLoadingConsumer(IntlStartup); IntlStartup.propTypes = propTypes; IntlStartup.defaultProps = defaultProps; diff --git a/bigbluebutton-html5/imports/ui/components/authenticated-handler/component.jsx b/bigbluebutton-html5/imports/ui/components/authenticated-handler/component.jsx index e3ade6a9e3..81a172d86d 100644 --- a/bigbluebutton-html5/imports/ui/components/authenticated-handler/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/authenticated-handler/component.jsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { Session } from 'meteor/session'; import logger from '/imports/startup/client/logger'; import Auth from '/imports/ui/services/auth'; -import { withConsumer } from '/imports/ui/components/join-loading/context/context'; +import { withJoinLoadingConsumer } from '/imports/ui/components/join-loading/context/context'; const STATUS_CONNECTING = 'connecting'; const CHAT_CONFIG = Meteor.settings.public.chat; @@ -101,4 +101,4 @@ class AuthenticatedHandler extends Component { } -export default withConsumer(AuthenticatedHandler); +export default withJoinLoadingConsumer(AuthenticatedHandler); diff --git a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx index 0179390c46..54c4fb6b45 100644 --- a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx @@ -6,7 +6,7 @@ import { setCustomLogoUrl } from '/imports/ui/components/user-list/service'; import { makeCall } from '/imports/ui/services/api'; import deviceInfo from '/imports/utils/deviceInfo'; import logger from '/imports/startup/client/logger'; -import { withConsumer } from '/imports/ui/components/join-loading/context/context'; +import { withJoinLoadingConsumer } from '/imports/ui/components/join-loading/context/context'; const propTypes = { children: PropTypes.element.isRequired, @@ -193,6 +193,6 @@ class JoinHandler extends Component { } } -export default withConsumer(JoinHandler); +export default withJoinLoadingConsumer(JoinHandler); JoinHandler.propTypes = propTypes; diff --git a/bigbluebutton-html5/imports/ui/components/join-loading/component.jsx b/bigbluebutton-html5/imports/ui/components/join-loading/component.jsx index 949408320a..c52f5c81b1 100644 --- a/bigbluebutton-html5/imports/ui/components/join-loading/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-loading/component.jsx @@ -11,12 +11,11 @@ const JoinLoadComponent = (props) => { return ( {(showLoading && !hasError) && ()} - {hasError && ( - - - - )} - { !hasError && children} + {hasError ? ( + + + + ) : children} ); }; diff --git a/bigbluebutton-html5/imports/ui/components/join-loading/context/context.jsx b/bigbluebutton-html5/imports/ui/components/join-loading/context/context.jsx index bb2de63767..3c40b6c545 100644 --- a/bigbluebutton-html5/imports/ui/components/join-loading/context/context.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-loading/context/context.jsx @@ -27,7 +27,7 @@ const initialState = { showLoading: true, hasError: false, }; -const withProvider = Component => (props) => { +const JoinLoading = Component => (props) => { const [state, dispatch] = useReducer(reducer, initialState); const contextValue = { ...props, @@ -49,15 +49,15 @@ const joinLoadingContextConsumer = Component => props => ( ); -const withConsumer = Component => joinLoadingContextConsumer(Component); +const withJoinLoadingConsumer = Component => joinLoadingContextConsumer(Component); -const withJoinLoadingContext = Component => withProvider(withConsumer(Component)); +const withJoinLoadingContext = Component => JoinLoading(withJoinLoadingConsumer(Component)); export { withJoinLoadingContext, - withConsumer, + withJoinLoadingConsumer, joinLoadingContextConsumer, - withProvider, + JoinLoading, reducer, initialState, JoinLoadingContext, diff --git a/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx b/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx index a5dd58ae52..33e4d51a79 100755 --- a/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/subscriptions/component.jsx @@ -8,7 +8,8 @@ import Annotations from '/imports/api/annotations'; import AnnotationsTextService from '/imports/ui/components/whiteboard/annotations/text/service'; import AnnotationsLocal from '/imports/ui/components/whiteboard/service'; import mapUser from '/imports/ui/services/user/mapUser'; -import { withConsumer } from '/imports/ui/components/join-loading/context/context'; +import { withJoinLoadingConsumer } from '/imports/ui/components/join-loading/context/context'; + const CHAT_CONFIG = Meteor.settings.public.chat; const CHAT_ENABLED = CHAT_CONFIG.enabled; const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id; @@ -34,7 +35,7 @@ class Subscriptions extends Component { } } -export default withConsumer(withTracker(({ dispatch }) => { +export default withJoinLoadingConsumer(withTracker(({ dispatch }) => { const { credentials } = Auth; const { meetingId, requesterUserId } = credentials; if (Session.get('codeError')) {