Rename context functions and restruct the join load component
This commit is contained in:
parent
6865bd6daf
commit
6473e6fa3c
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -11,12 +11,11 @@ const JoinLoadComponent = (props) => {
|
||||
return (
|
||||
<Fragment>
|
||||
{(showLoading && !hasError) && (<LoadingScreen />)}
|
||||
{hasError && (
|
||||
<IntlProvider locale={locale}>
|
||||
<ErrorScreen />
|
||||
</IntlProvider>
|
||||
)}
|
||||
{ !hasError && children}
|
||||
{hasError ? (
|
||||
<IntlProvider locale={locale}>
|
||||
<ErrorScreen />
|
||||
</IntlProvider>
|
||||
) : children}
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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')) {
|
||||
|
Loading…
Reference in New Issue
Block a user